Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: Parsing Problems

by haj (Vicar)
on May 13, 2019 at 18:07 UTC ( [id://1233720]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Parsing Problems
in thread Parsing Problems

Two things stand out here:

  • $ARGV[2] might contain un-decoded UTF-8 characters in "modern" terminals. File systems with UTF-8 characters behave differently, depending on the platform (Windows/Unix).
  • (/$line) looks weird. That needs really special values for $line to produce valid Perl!

An idea is to print the string you're evaling, and of course checking whether eval produced an error in $@:

my $code = qq~modes::~ . $ARGV[2] . qq~::flex(/$line);~; warn $code; eval $code; warn "Eval failed: '$@'" if $@;

Replies are listed 'Best First'.
Re^4: Parsing Problems
by ftherese (Novice) on May 13, 2019 at 18:30 UTC
    Okay! Now we're getting somewhere. In the old environment, no error is reported. In the new environment: Undefined subroutine &modes::three::a called at (eval 32) line 1. ...

    Also, I mistyped because I'm on my phone it is \$line.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2025-06-19 19:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.