This is really very clear.

On 2/17/06, Hans Meier (John Doe) <[EMAIL PROTECTED]> wrote:
> Ken Perl am Freitag, 17. Februar 2006 02.34:
> > what is the difference of :: and -> in this statements?
> >
> > $authInstance =
> > Operation::Auth::getInstance($session,$u->authMethod,$u->userId)
> >
> > $authInstance =
> > Operation::Auth->getInstance($session,$u->authMethod,$u->userId)
>
> The first '::' is part of a package name, the package is
>
>        package Operation::Auth
>
> The last '::' (in the first example) denotes a sub in this package and is a
> procedure invocation, the sub getting only the passed arguments.
>
> The '->' is a method invocation, and the class name ('Operation::Auth' in this
> case) is implicitly passed to getInstance as first argument (as Chas already
> said).
>
> The two notations are not interchangeable if the sub definition is for example
>
> sub getInstance {
>        my ($class, $session, $meth, $uid)[EMAIL PROTECTED];
>        ...
> }
>
> intended to be called as method.
>
> The first invocation would leed to an error since the first argument
> getInstance receives is $session, and not a class name.
>
>
> hth,
> joe
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>


--
perl -e 'print unpack(u,"62V5N\"FME;G\!E<FQ`9VUA:6PN8V]M\"[EMAIL PROTECTED]
")'

--
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