- or download this
# Autoattr.pm
package Autoattr;
...
goto \&$AUTOLOAD;
}
1;
- or download this
#!/usr/bin/perl -w
...
do {$_->bar(3); $_->bar},
do {$_->bar(2); $_->bar},
do {$_->bar(1); $_->bar};
- or download this
Autoattr::new('Foo')
+
Autoattr::AUTOLOAD=Foo::foo('Foo=HASH(0x225140)')
+
...
>>> barbarbar, barbar, bar
+
+
Autoattr::DESTROY('Foo=HASH(0x225140)')
- or download this
Autoattr::new('Bar')
+
Autoattr::AUTOLOAD=Bar::foo('Bar=HASH(0x225164)')
+
...
>>> 3, 2, 1
+
+
Autoattr::DESTROY('Bar=HASH(0x225164)')
- or download this
package Autoattr;
our $DEBUG;
...
;
$AUTOLOAD =~ /([^:]*)$/; goto $_[0]->can($1); # go to the new
+symbol
}