Is there any way I can just say:
use ISO::types::ILLString; my $s = new ILLString("This is a string");
First, what you're talking about isn't object related. It's just package functions.
You need to look at the Exporter module. Bascially, you want to do this (off the topof my head)
package ISO::types::ILLString;
use Exporter; our @EXPORT = qw( ILLString );
sub ILLString { # blah blah blah }
1;
Now, whenever you say "use ISO::types::ILLString", you get ILLString imported into your namespace.
There is a second way to do this. You can also say:
use Exporter; our @EXPORT_OK = qw ( ILLString );
This means that ILLString isn't automatically imported into the namespace, but it will be if, in your Perl program, you use the following syntax:
use ISO::types::ILLString ('ILLString');
The advantage of doing it this way is that it is the program, not the module, that decides whether or not to import the name. This is useful because you may already have ILLString defined elsewhere and don't want to overwrite it. It can be a little nasty if a module imports symbols into your main namespace that you don't know about and then you spend hours chasing down bugs when 'ILLString' doesn't refer to what you think it does anymore. I think that this is now the standard practice for non-core Perl modules. From the Exporter Perldoc page:
As a general rule, if the module is trying to be object oriented then export nothing. If it's just a collection of functions then @EXPORT_OK anything but use @EXPORT with caution.
Cheers.
-- William Wueppelmann Electronic Systems Specialist Canadian Institute for Historical Microreproductions (CIHM)