in reply to why "Bless" in OO Perl
does something like this:my $object = bless($reference, "MyClass");
and then whenever Perl sees something like this:sub bless { my ($reference, $class) = @_; $reference->{class_name} = $class; return $reference; }
it transforms it into this:$object->some_function($arg1);
which in this case would translate into:$object->{class_name}::some_function($object, $arg1);
There's a little more to it than that, to support inheritance and such, but that's the general idea.MyClass::some_function($object, $arg1);
|
|---|