MAIN Sub

2011-02-16 Thread Bottoms, Christopher A
Hello all,

As soon as I add the MAIN sub to my module file, my test file complains:

Method 'chars' not found for invocant of class 'Failure'
  in 'Cool::substr' at line 2365:CORE.setting
  in 'process-cmd-args' at line 7414:CORE.setting
  in  at line 7492:CORE.setting
  in 'MAIN_HELPER' at line 1
  in main program body at line 
1:/home/cbottoms/workspace/Rakudo/Impute/lib/MaizeDiversity/Impute.pm


I'm not sure if I'm doing something wrong, or if it is simply an implementation 
issue. I' m using Rakudo Start from January 2011, running on Fedora 7 GNU/Linux 
(64-bit).  Any ideas? Below is the code I'm using. 

# Module File
use v6;

sub MAIN ( $arg1, $arg2 ) {
return 1;
}

# End of Module File


# Test file:

use v6;
use Test;
BEGIN { @*INC.push('/home/cbottoms/workspace/Rakudo/Impute/lib'); }

use MaizeDiversity::Impute;

# End of test file


Thanks,

Christopher Bottoms

[perl #84266] [BUG] Importing a module with a MAIN sub causes Rakudo to die inappropriately

2011-02-16 Thread Carl Mäsak
# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #84266]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=84266 >


$ cat A.pm
use v6;
sub MAIN {
}

$ cat foo
use v6;
use A;

$ perl6 foo
Method 'chars' not found for invocant of class 'Failure'
  in 'Cool::substr' at line 2394:CORE.setting
  in 'process-cmd-args' at line 7489:CORE.setting
  in  at line 7567:CORE.setting
  in 'MAIN_HELPER' at line 1
  in main program body at line 1:A.pm


Re: MAIN Sub

2011-02-16 Thread Bruce Gray


On Feb 16, 2011, at 4:14 PM, Bottoms, Christopher A wrote:


Hello all,

As soon as I add the MAIN sub to my module file, my test file  
complains:

--snip--

In your module file, after the "use v6" line, add this line:
module MaizeDiversity::Impute;

--
Hope this helps,
Bruce Gray (Util of PerlMonks)


Re: MAIN Sub

2011-02-16 Thread Carl Mäsak
Christopher (>):
> As soon as I add the MAIN sub to my module file, my test file complains:

I've submitted this as a Rakudobug:

 

Thank you for reporting it.

// Carl


[perl #84280] [BUG] LTA error message when multi sub exported out of a module fails to bind to an argument that happens to be a block

2011-02-16 Thread Carl Mäsak
# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #84280]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=84280 >


$ cat A.pm
module A;

sub foo(Str $a) is export {
}

multi sub bar(Str $a) is export {
}

$ perl6 -e 'use A; foo { 1 }'
Nominal type check failed for parameter '$a'; expected Str but got Block instead
  in 'A::foo' at line 1:A.pm
  in main program body at line 1

$ perl6 -e 'use A; bar { 1 }'
get_attr_str() not implemented in class 'Sub'
  in main program body at line 7461