[Israel.pm] object oriented anonymous autoloading?

Ronen Angluster beerholder at gmail.com
Sun Oct 12 12:51:30 PDT 2008

Hi all!
the subject is actually drawn from a lack of better understanding in
this particular topic...
given this code:
package MyPackge;
sub new {
my $this = shift;
bless $self;
return $self
and if i run:
my $object = MyPackage->new();
is there a way to "autoload" the object so that if i "print $object"
the object will return a given value(or a subroutine that will return
a value)
instead of its own ref & memory address ?
i tried using AUTOLOAD (which works great for missing methods and
such) but it seems that since i don't try to activate any method
on the object, perl just return the value of the object, i.e: its reference.
Thanks in advance,

More information about the Perl mailing list