Re: RD_AUTOACTION, @item, %item and compiling
[email protected] (Aamer Akhter) Fri, 21 May 2004 20:52:34 -0400
| Newsgroups | perl.recdescent |
|---|---|
| Message-ID | <[email protected]> |
Aamer Akhter wrote:
> Hello,
>
> I have the following RD_AUTOACTION:
>
> $::RD_AUTOACTION = q{
> if ($#item==1 && ($item->isterminal || ref $item[1] ne 'ARRAY')) {
> #if only one item, and is either a terminal or an array
> $return = $item[1];
> } else {
> foreach my $i (keys %item) {
> if ($i=~ s/(\([\?s]\))$//o) {
> $item{$i} = \@{$item{$i.$1}};
> delete $item{$i.$1};
> }
> }
> $return = bless \%item, $item[0];
> }
> };
>
> If I precompile to a module, the code generated does not compile.
> Specifically, I get this error:
>
> perl0: Global symbol "$item" requires explicit package name at
> grammars/show_ip_interface_brief.pm line 114.
>
> Otherwise (without precompile) the AUTOACTION works fine.
>
> Obviously I can't do a my for the @item or %item. Any suggestions on how
> to get past this? I'm looking thru the RD_TRACE and .pm file for the
> differences right now, but wondering if somebody has run into this already.
>
I'm prelpexed, the only differences appear to be the difference in namespace,
the package encloser, and the constructor at the end of the .pm file.
any insight would be greatly appreciated.
> Thanks.
>
> aamer akhter
>
>
>
--
Aamer Akhter / [email protected]
NSITE cisco Systems