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>