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
Keyword 'module' disables automatic calling of MAIN sub when file is run as a program. #2372
Comments
From @moleculesSHORT VERSION (notice lack of output when file is run): $ cat lib/A.pm our sub MAIN ( $filename ) { $ lib/A.pm LONG VERSION: However, using the 'module' keyword makes it cease working as a program. Without the 'module' keyword, the following works fine as a program, $ cat lib/A.pm our sub MAIN ( $filename ) { $ lib/A.pm foo.txt $ lib/A.pm shell returned 29 Then with the keyword 'module', it doesn't work right. Notice the lack $ cat lib/A.pm our sub MAIN ( $filename ) { $ lib/A.pm Thanks, |
From @usev6This was answered recently on SO: http://stackoverflow.com/questions/29281305/how-do-i-make-a-modulino-in-perl6 The recommended solution was "to add MAIN to the module and import it into the script's mainline. This way, everything declared within the module is visible within MAIN without having to explicitly export everything: module main { sub MAIN(*@filenames) is export(:MAIN) { import main :MAIN; |
From @cokeOn Wed Apr 01 11:46:59 2015, bartolin@gmx.de wrote:
Based on bartolin's last comment, closing this ticket. |
The RT System itself - Status changed from 'new' to 'open' |
@coke - Status changed from 'open' to 'rejected' |
Migrated from rt.perl.org#84342 (status was 'rejected')
Searchable as RT84342$
The text was updated successfully, but these errors were encountered: