Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Parsing of subscript separator in B::Deparse

by dbwiz (Curate)
on Nov 23, 2003 at 18:23 UTC ( #309330=perlquestion: print w/replies, xml ) Need Help??

dbwiz has asked for the wisdom of the Perl Monks concerning the following question:

Using B::Deparse, I found a difference in parsing between Perl version 5.6.1 and the 5.8.x branch.

I know that this does not look terribly important, except maybe for obfuscation contests, but I thought better to mention it, just in case.

$ perl.5.6.1 -MO=Deparse -e '$a=$;;print $a' $a = $;; # two semicolons, one belonging to the variable, # the other one is a statement separator print $a; -e syntax OK $ perl.5.8.0 -MO=Deparse -e '$a=$;;print $a' $a = $; # the separator is missing print $a; -e syntax OK $ perl.5.8.1 -MO=Deparse -e '$a=$;;print $a' $a = $; # the separator is missing print $a; -e syntax OK

Is this a bug?

Replies are listed 'Best First'.
Re: Parsing of subscript separator in B::Deparse
by bart (Canon) on Nov 23, 2003 at 20:46 UTC
    That looks like a bug in B::Deparse for perl 5.8.x to me — not a bug in Perl. What versions are the module?

    Using ActivePerl 5.8.0 (build 804), $B::Deparse::VERSION is 0.63, this:

    D:\programs\activeperl\Perl\bin>perl -MO=Deparse -e "$;='#';$a=$;;prin +t $a"
    produces:
    $; = '#';
    $a = $;
    print $a;
    -e syntax OK
    
    Same bug. Yet the code works:
    D:\programs\activeperl\Perl\bin>perl -le "$;='#';$a=$;;print $a"
    resulting in:
    #
    
    So it's not a parsing bug. It's a deparsing bug.
Re: Parsing of subscript separator in B::Deparse
by liz (Monsignor) on Nov 23, 2003 at 18:35 UTC
    I would say yes, and one that still exists in 5.8.2 and the last blead snapshot. Please report using perlbug or at the PerlBug website.

    Liz

Re: Parsing of subscript separator in B::Deparse
by danger (Priest) on Nov 23, 2003 at 18:54 UTC

    Versions 5.6.1, 5.8.0, and 5.8.2 all get it right when the -p (parentheses) option is passed to Deparse:

    $ perl -MO=Deparse,-p -e '$a=$;;print $a' ($a = $;); print($a); -e syntax OK

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://309330]
Approved by Itatsumaki
Front-paged by PodMaster
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2023-06-10 17:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you go to conferences?






    Results (39 votes). Check out past polls.

    Notices?