Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • I stared at this piece of selfdocumenting code for a while:

            my ($regexp, $reason) = /^(.*):(.*)$/;
            $regexp =~ s/^\.\+//;
            print $re "\t", fixup_re($regexp), "               {return \"$reason\";}\n";

    but I still can't figure out

    1. what the "reason" is for
    2. how to use the compiled resulting XS module from a Perl script

    Could you please provide a 3 (or so) line data file that we could just c

    • Yeah sorry - it's a hack that I didn't have any time to document.

      Input is a file that looks like this:

      [0-9a-f]+\.myntet\.ac:generi c

      i.e. "regexp:reason"

      Then to run, it's just:

      use MyModule;
      if (my $reason = MyModule::scan($string)) {
          print "Matched: $reason\n";

      • OK, I tried it... and it works. Kind of I had to delete the "time" in the system() call as Windows doesn't support it. Anyway, the sample compiled fast. Very fast. You scared me for no reason. :)

        I'm somewhat disappointed with what the module can do. I was hoping to have a basis to reimplement URI::Find [], thus: something that can find matches anywhere in a random text. There's two major reasons why it can't do that. First: it really is a lexer: it can only match prefixes in a string. To use your examp