With the scope resolution operator, you get a normal subroutine call. But with the dereferencing operator, you get a method call in which the name of the class is passed implicitly as the first argument. So
Foo::bar(1, 2, 3);
calls sub bar in the Foo package and passes 1, 2, 3 as the arguments (which are aliased in @_). But
Foo->bar(1, 2, 3);
calls Foo::bar with the arguments Foo, 1, 2, 3. Likewise, if $obj is of class Foo, then
$obj->bar(1, 2, 3);
calls Foo::bar with the arguments Foo, 1, 2, 3.
See Methods in perlootut and Method Invocation in perlobj.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re^3: Variables in Common parent class
by Athanasius
in thread Variables in Common parent class
by perlbaski
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |