Syntactic Confectionery Delight | |
PerlMonks |
Re: Calling method inside and outside of packageby lyklev (Pilgrim) |
on Oct 28, 2010 at 19:50 UTC ( [id://868133]=note: print w/replies, xml ) | Need Help?? |
Your example works, because your routine xxx does nothing special. If you have a routine inside a package however, you will either want to do something with the data contained in your object, or you have a generic function that does not access your object's data.
In the first case you would call the function as kcott mentioned, so as If you call the function from inside the package, you cannot access the data contained in the object, because you are passing an empty string instead of an object to the function. If you have a simple function (say, for adding two numbers), you can write a function like you normally would, so without getting the class name from the arguments. And never call a routine or program test --- there is probably another function or program with that name, which will take you a few hours to find out.
In Section
Seekers of Perl Wisdom
|
|