Hi Anonymous,
...to a module's method when two modules have the same method name...
But if there's a conflict of method names, is there a way to unambiguously call a module's method?...


Though you have been given a great answer, I consider it not over "stressed" to say your requirements taste like an Object-Oriented in IMHO.
Since, the first two principle stated in perlobj answers thus:

1. An object is simply a data structure that knows to which class it belongs.
2. A class is simply a package. A class provides methods that expect to operate on objects.

So, awakening the Old dragon of OOP in Perl ( Yes, I know the "new" beasts ( Moose and it's different cousins ) are good extension of the Perl 5 object system ), one can do:
package Module1; sub main { my $obj = shift; my $class = { name => __PACKAGE__, }; return bless $class, $obj; } package Module2; sub main { my $obj = shift; my $class = { name => __PACKAGE__, }; return bless $class, $obj; } package main; my $an1 = Module1->main(); print $an1->{name}, $/; my $an2 = Module2->main(); print $an2->{name}, $/; ## And if you must use your dispatch table ## you can do my %dispatch = ( main => Module1->main(), another_page => Module2->main(), ); print "Am in ", $dispatch{main}{name}, $/; print "Am in ", $dispatch{another_page}{name};

NOTE:
All emphasis mine, to note my line of thought ( I hope, I didn't misinterpret the OP question)
both use warnings and strict were used though not stated.
If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me

In reply to Re: Dispatcher to module's method by 2teez
in thread Dispatcher to module's method by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.