summaryrefslogtreecommitdiff
path: root/dist/Attribute-Handlers/demo/demo_cycle.pl
blob: 5f307a7036ad528ba2e7bf5bda446142283c0d62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package Selfish;

sub TIESCALAR {
	use Data::Dumper 'Dumper';
	print Dumper [ \@_ ];
	bless [ @_[1..$#_] ], $_[0];
}

sub FETCH {
	use Data::Dumper 'Dumper';
	Dumper [ @{$_[0]} ];
}

package main;

use Attribute::Handlers autotieref => { Selfish => Selfish };

my $next : Selfish("me");
print "$next\n";

my $last : Selfish("you","them","who?");
print "$last\n";

my $other : Selfish(["you","them","who?"]);
print "$other\n";