# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #114354]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=114354 >


$ perl6 -v
This is perl6 version 2012.07-208-gb87659a built on parrot 4.5.0
revision RELEASE_4_5_0

$ cat script
use A;

sub MAIN {
    say "script's MAIN";
}

$ cat lib/A.pm
class A {
}

sub MAIN {
    say "A's MAIN";
}

$ perl6 -Ilib script
A's MAIN
script's MAIN

S06 is pretty clear that A's MAIN shouldn't be invoked in this case:

 <http://perlcabal.org/syn/S06.html#Declaring_a_MAIN_subroutine>

"This call is performed if and only if [...] the compilation unit was
directly invoked rather than by being required by another compilation
unit"

Reply via email to