http://www.perlmonks.org?node_id=304025


in reply to Re: Re: Using a subroutine as a module
in thread Using a subroutine as a module

I would rather use class methods than create a dummy object with no other purpose than to qualify the package to call.

File::Spec is an excellent example of when that works well.

In the more typical case, however, you would be just as well off importing nothing and always fully qualifying your calls (e.g. MyModule::foo() ). Importing some things is a programmer convenience to save typing and improve readability. If the sub names reflect what they do, conflicts should be rare (and can always be resolved by fully qualifying).

  • Comment on Re: Re: Re: Using a subroutine as a module