John M. Dlugosz has asked for the wisdom of the Perl Monks concerning the following question:

I'm running Pugs on Windows. Trying to use the "rule" feature, I got this error:
pugs> my $z= "abc12345we678" "abc12345we678" pugs> $z ~~ ?/\d+/ Error eval perl5: "if (!$INC{'Pugs/Runtime/Match/HsBridge.pm'}) { unshift @INC, 'C:\Perl6\site\lib/auto/pugs/perl5/lib'; eval q[require 'Pugs/Runtime/Match/HsBridge.pm'] or die $@; } 'Pugs::Runtime::Match::HsBridge' " *** Can't locate Pugs/Runtime/Match/HsBridge.pm in @INC (@INC contains +: C:\Perl6\site\lib/auto/pugs/perl5/lib C:/Perl/lib C:/Perl/site/lib +.) at (eval 3) line 1. *** Cannot parse regex: \d+ *** Error: Error: Can't call method "__RUN__" on an undefined value.
Now after getting that the first time, I found where the .pm file is located (D:\pugs\perl5\Pugs-Compiler-Rule\blib\lib\Pugs\Runtime\Match and D:\pugs\perl5\Pugs-Compiler-Rule\lib\Pugs\Runtime\Match), and used PERL6LIB to tell it. So my session continues,
pugs> say @INC.join("\n") D:\pugs\perl5\Pugs-Compiler-Rule\lib C:\Perl6\lib C:\Perl6\lib C:\Perl6\site\lib C:\Perl6\site\lib C:\Perl6\lib\auto\pugs\perl6\lib C:\Perl6\site\lib\auto\pugs\perl6\lib . Bool::True
You can see that the @INC contents of the error message do not match what I see here. My immediate question is, what is going on here?. Beyond that, what directories should be in the LIB path, why doesn't the installed tree look anything like the default (I figured it would just have the wrong root as it assumes C:), and why isn't there a * in the name @INC anymore?

—John

Replies are listed 'Best First'.
Re: Pugs configuration - file locations
by moritz (Cardinal) on Feb 27, 2008 at 08:13 UTC
    You seem to be quite excited about pugs and Perl 6, so I strongly recommend you join the IRC channel #perl6 on irc.freenode.net, that's where the developers hang out.

    Regarding your problem: Pugs implements regexes and rules via the Perl 5 Module Pugs::Compiler::Rule, which is called through the perl 5 interpreter which is linked into pugs.

    So I guess it uses PERL5LIB to search for the module, not PERL6LIB, and not Perl 6's @*INC. (Yes, it shoudl be @*INC, not @INC, unless I'm very much mistaken). I don't have a pugs installation available to try it, though.

      That's it. Setting PERL5LIB got past that problem. Now I get
      pugs> my $z= "abc12345we678" "abc12345we678" pugs> $z ~~ ?/\d+/ *** Cannot parse regex: \d+ *** Error: Error: Can't use string ("1") as a subroutine ref while "st +rict refs" in use at D:\pugs\perl5\Pugs-Compiler-Rule\lib/Pugs /Compiler/Regex.pm line 85. Bool::False pugs>
      Owell...

      —John
      in Allen, Texas (Dallas metroplex)

        The question mark shouldn't be there. Just $z ~~ /\d+/.

        If you want to coerce that to boolean context, the question mark has to be in front of the expression:

        my $bool = ? $z ~~ m/\d+/
        (Don't know if ~~ or ? has the higher precedence, so you might need parenthesis. But I don't think so ;)