Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAIN in module invoked even when it shouldn't be in Rakudo #2844

Closed
p6rt opened this issue Aug 1, 2012 · 3 comments
Closed

MAIN in module invoked even when it shouldn't be in Rakudo #2844

p6rt opened this issue Aug 1, 2012 · 3 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Aug 1, 2012

Migrated from rt.perl.org#114354 (status was 'resolved')

Searchable as RT114354$

@p6rt
Copy link
Author

p6rt commented Aug 1, 2012

From @masak

$ 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"

@p6rt
Copy link
Author

p6rt commented Aug 1, 2012

From @moritz

Fixed now, and tested in S06-other/main.t.

@p6rt p6rt closed this as completed Aug 1, 2012
@p6rt
Copy link
Author

p6rt commented Aug 1, 2012

@moritz - Status changed from 'new' to 'resolved'

@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant