Commit | Line | Data |
---|---|---|
0e9b9e0c | 1 | package Selfish; |
2 | ||
3 | sub TIESCALAR { | |
4 | use Data::Dumper 'Dumper'; | |
5 | print Dumper [ \@_ ]; | |
6 | bless [ @_[1..$#_] ], $_[0]; | |
7 | } | |
8 | ||
9 | sub FETCH { | |
10 | use Data::Dumper 'Dumper'; | |
11 | Dumper [ @{$_[0]} ]; | |
12 | } | |
13 | ||
14 | package main; | |
15 | ||
16 | use Attribute::Handlers autotieref => { Selfish => Selfish }; | |
17 | ||
18 | my $next : Selfish("me"); | |
19 | print "$next\n"; | |
20 | ||
21 | my $last : Selfish("you","them","who?"); | |
22 | print "$last\n"; | |
23 | ||
24 | my $other : Selfish(["you","them","who?"]); | |
25 | print "$other\n"; |