You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following example "Powerful and concise attribute definitions." from the main homepage generates an exception.
package MyApp {
use Zydeco;
class Person {
has name! (type => Str);
has age (type => Int) = 0;
has status (
enum => ['alive', 'dead'],
handles => 1,
default => 'alive',
);
has children (
is => private,
default => sub { [] },
handles_via => 'Array',
handles => { add_child => 'push', all_children => 'all' },
);
}
}
my $bob = MyApp->new_person(name => "Robert", age => 30);
$bob->is_dead; # ==> false
$bob->add_child(
MyApp->new_person(name => "Eve")
);
Here is the error message (perl v5.26.3 for MSWin32-x64-multi-thread)
Expected delegations to be a reference to an array; got HASH(0x53b6158) at c:/Perl64/site/lib/MooX/Press.pm line 1485.
BEGIN failed--compilation aborted at (eval 273)[c:/Perl64/site/lib/Zydeco.pm:2028] line 1.
at c:/Perl64/site/lib/B/Hooks/EndOfScope/XS.pm line 26.
Execution of H:\temp\Array.pl aborted due to compilation errors.
It works with one of the following adjustments (yes, there are two ways to fix the code):
a) change is => private to is => rwp
b) change handles => {...} inhandles = > [...]
The text was updated successfully, but these errors were encountered:
The following example "Powerful and concise attribute definitions." from the main homepage generates an exception.
Here is the error message (perl v5.26.3 for MSWin32-x64-multi-thread)
It works with one of the following adjustments (yes, there are two ways to fix the code):
a) change
is => private
tois => rwp
b) change
handles => {...}
inhandles = > [...]
The text was updated successfully, but these errors were encountered: