Global symbol "$EVAL_ERROR" requires explicit package name

164 views
Skip to first unread message

Cev Ing

unread,
Nov 26, 2015, 11:02:19 AM11/26/15
to marpa parser
When I try the example from the synopsis of Scanless::R, I get the error

Global symbol "$EVAL_ERROR" requires explicit package name

Is it necessary to import the variable from a Marpa package?

Ruslan Shvedov

unread,
Nov 26, 2015, 11:12:10 AM11/26/15
to marpa-...@googlegroups.com
Nope, you an add use English; -- it's a long name for eval's return value. 

But then you'll have to add the grammar and input string.

If you need a full runnable example, the code from https://metacpan.org/pod/distribution/Marpa-R2/pod/Scanless.pod#Synopsis will serve you better.
 

--
You received this message because you are subscribed to the Google Groups "marpa parser" group.
To unsubscribe from this group and stop receiving emails from it, send an email to marpa-parser...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jeffrey Kegler

unread,
Nov 26, 2015, 11:27:06 AM11/26/15
to Marpa Parser Mailing LIst
Also, one feature of Marpa is that *all* examples of code are in the test suite -- so they all do actually run in some context.

The one for the Scanless::R synopsis is in t/sl_gyn.t.  Note that, in the test suite, the context may be some intricate framework required by the testing, but it nonetheless will be a context in which the example was made to work.

Cev Ing

unread,
Nov 26, 2015, 11:51:04 AM11/26/15
to marpa parser


Am Donnerstag, 26. November 2015 17:12:10 UTC+1 schrieb rns:

Nope, you an add use English; -- it's a long name for eval's return value.

Ah thanks I got it. Never used the English packages.
 
If you need a full runnable example, the code from https://metacpan.org/pod/distribution/Marpa-R2/pod/Scanless.pod#Synopsis will serve you better.

I was looking for an example with actions. The example of Scannless just blesses and traverses the blessed objects.

Ruslan Shvedov

unread,
Nov 26, 2015, 1:00:57 PM11/26/15
to marpa-...@googlegroups.com
Then, per Jeffrey's advice, you can adapt code from https://github.com/jeffreykegler/Marpa--R2/blob/master/cpan/t/sl_gsyn.t

Jeffrey Kegler

unread,
Nov 26, 2015, 5:49:10 PM11/26/15
to Marpa Parser Mailing LIst
For your specific issue, two solutions are

1.) Add "use English qw( -no_match_vars );" to your Perl script.  Make sure to use the form I just quoted, in order to avoid an efficiency issue.

2.) Translate all the "Englished" vars to their "Pure Perl" form.   There is a man page with the translations.  For example, $EVAL_ERROR translates to $@ in pure Perl.

I use the "Englished" forms in the examples, because they are supposed to be easier to read, and "English" is a core module.
Reply all
Reply to author
Forward
0 new messages