On Jul 13, Todd W said:

I've been trying to undersand what mixins are and at the same time figuring
out how to make them easy to use. I just belched out this piece of code, but
I dont know if its doing anything special:

Perl allows you to call an object from any class to call a method from any class. Typically, $object->method searches through $object's class and inheritance tree. If you give a fully-qualified method name, such as OtherClass::method, then Perl calls that very specific method, which is what you've done below.

package MyMixins;

sub SomeMethod {...}

package MyClient;

sub new {...}

package main;

my $client = MyClient->new;
$client->MyMixins::SomeMethod;

Yeah, that looks about right.  Thrilling, wasn't it?

--
Jeff "japhy" Pinyan         %  How can we ever be the sold short or
RPI Acacia Brother #734     %  the cheated, we who for every service
http://japhy.perlmonk.org/  %  have long ago been overpaid?
http://www.perlmonks.org/   %    -- Meister Eckhart

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to