If you've used modules then you've used packages, they were just inside the module file rather than inside your main script. Putting them in the main script however as you have above is legal and useful if you want to break something off into a class (basically a package is a class) but its not all that big and you don't want to keep track of two files. Although your code above wouldn't do anything until you have a package main; and the other packages would have to be called.
The most common use of this method is when you have a tied variable or an AUTOLOAD. Also some modules make use of creating classes from the modules main classes. I've been using wxPerl lately and it makes a lot of sense to use this method there as the main window (wxPerl is a GUI library) has to have its own constructor method.
Hope that helps
Chris
In reply to Re: Using a package into script
by cfreak
in thread Using a package into script
by nite_man
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |