Plan 9 from Bell Labs’s /usr/web/sources/contrib/gabidiaz/root/sys/src/cmd/perl/lib/Attribute/Handlers/demo/demo_cycle.pl

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


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";

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].