in reply to Email::Find question

OO is easy to understand once you get your head around the basic concepts. First you create an object using the constructor (almost always called 'new') and store it in a scalar like $obj. Then you call methods on that object using the -> notation. A 'callback' is a reference to a sub that you want to run every time an event happens (like your method finds an email address).

Try these tutorials perlman:perlobj and perlman:perltoot

# make a new object of type 'Object' and pass it a callback sub my $obj = new Object( sub{print "Hello World"} ); # call a method on that object $obj->method; # when we 'use' an OO module we effectively just add its packages to o +ur code # so lets just write a little package here that has a callback sub package Object; use Data::Dumper; sub new { my $class = shift; my $callback = shift; my $anon_ref = { 'callback' => $callback }; # make object by blessing our anon hash into $class my $object = bless $anon_ref, $class; return $object; } sub method { my $self = shift; print "This is what \$self looks like:\n\n", Dumper($self), "\n\n"; print "And here is our callback sub in operation\n\n"; &{$self->{'callback'}}; }

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print