Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: Perl6, modifying @*INC

by moritz (Cardinal)
on Aug 05, 2010 at 15:49 UTC ( #853170=note: print w/ replies, xml ) Need Help??

in reply to Perl6, modifying @*INC

BEGIN{ push @*INC, 'C:\Rakudo\lib';}

Add a space before the opening curly: BEGIN { @*INC.push( 'C:\Rakudo\lib' );}

The reason is that {...} directly after a statement is parsed as a postcircumfix, which is very handy if you want to access hash elements like %hash{$key} (but which is intentionally not special-cased to hashes).

The error message could be improved, though.

Perl 6 - links to (nearly) everything that is Perl 6.
Comment on Re: Perl6, modifying @*INC
Select or Download Code
Replies are listed 'Best First'.
Re^2: Perl6, modifying @*INC
by molecules (Monk) on Aug 05, 2010 at 16:17 UTC

    I also noticed that the indirect method syntax for push doesn't work inside the BEGIN block. I wasn't sure if that was a feature or something still to be done.
      It's a well-known bug. Unfortunately we have some roadmap items to complete before we can fix that - we need to have static lexical pads at compile time to make built-in functions available in BEGIN blocks.
      Perl 6 - links to (nearly) everything that is Perl 6.

        I was just curious. I can't complain because I haven't helped develop Rakudo. :)

        Thanks for all of your work on Rakudo.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://853170]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2016-05-26 12:12 GMT
Find Nodes?
    Voting Booth?