FAQ
hi,

if i have something like this :


package Blah;

our %hash;

$::RD_AUTOACTION = q{ $Blah::hash{$item[0]} = $item[0]; 1 };# f.e.
my $grammar =q{

........
}


sub parse {
my $self = shift;
my $str = join ' ', @{ $$self{cmd} };
my $parser = new Parse::RecDescent ($grammar);
$parser->start($str) or die "parsing error !!\n"; }



Now I want to do something like this :

$::RD_AUTOACTION = q{ $$self{_blah}{$item[0]} = $item[0]; 1 };

i.e. How to accesses object-instance-data from inside the grammar instead of the class-data.

Search Discussions

  • Ted Zlatanov at Oct 13, 2004 at 2:49 pm

    On Wed, 13 Oct 2004, raptor@tvskat.net wrote:

    package Blah;

    our %hash;

    $::RD_AUTOACTION = q{ $Blah::hash{$item[0]} = $item[0]; 1 };# f.e.
    ........
    sub parse {
    my $self = shift;
    my $str = join ' ', @{ $$self{cmd} };
    my $parser = new Parse::RecDescent ($grammar);
    $parser->start($str) or die "parsing error !!\n"; }

    Now I want to do something like this :

    $::RD_AUTOACTION = q{ $$self{_blah}{$item[0]} = $item[0]; 1 };

    i.e. How to accesses object-instance-data from inside the grammar
    instead of the class-data.
    I don't know the "proper" way, but why not make $parser a global
    variable and access it that way from the auto-action? Does it provide
    what you need?

    Ted

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprecdescent @
categoriesperl
postedOct 13, '04 at 8:38a
activeOct 13, '04 at 2:49p
posts2
users2
websitemetacpan.org...

2 users in discussion

Raptor: 1 post Ted Zlatanov: 1 post

People

Translate

site design / logo © 2019 Grokbase