Having just figured out this, I was wondering how the -M would handle a terminal :: affixed to a package name,

$ perl -MFoo:: -e1

What I got was...

Can't locate Foo/.pm in @INC (you may need to install the Foo:: module) ( @INC contains: [...]).

This seems to indicate that it doesn't work, so curiosity compelled me....

$ mkdir Foo; $ echo "package Foo { sub k { die 42 } }; 1;" > Foo/.pm $ PERL5LIB=. perl -MFoo:: -e'Foo::->k'

That did in fact work. Is this convention of use mod::; resolving to mod/.pm supported? Was this a holdover from antiquity. Where did this behavior come from?

With this schema I could do,

Foo/.pm # package Foo Foo/Bar/.pm # package Foo::Bar Foo/Bar/Baz/.pm # package Foo::Bar::Baz;

then I could do

use Foo::; # resolves to Foo/.pm use Foo::Bar::; # resolves to Foo/Bar/.pm use Foo::Bar::Baz::; # resolves to Foo/Bar/Baz/.pm Foo::->new; Foo::Bar::->new; Foo::Bar::Baz::->new;

I like this because this adds the benefit of

Making all of my classes bare words. Adding consistency between use and invocation.

Is this design by intent? Is it documented anywhere? Has anyone ever thought of this awesome idea before?