Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: A plague on all your features

by tobyink (Canon)
on Mar 06, 2023 at 14:19 UTC ( [id://11150785]=note: print w/replies, xml ) Need Help??


in reply to A plague on all your features

Interesting. You can maybe figure out why 'c' and 'd' differ so much using this:

use strict; use warnings; no strict 'refs'; use Data::Dumper; $Data::Dumper::Sortkeys = 1; $Data::Dumper::Deparse = 1; print Dumper( { map { $_ => $_->() } 'a' .. 'g' } ); sub dumphints { my @caller = caller(0); $caller[10]; } sub a {dumphints()} {use feature ':5.10'; sub b {dumphints()}} {use 5.010; sub c {dumphints()}} {no feature ':all'; use feature ':5.10'; sub d {dumphints()}} {use feature 'say'; sub e {dumphints()}} { no feature 'say'; sub f {dumphints()}} {use feature 'say'; no feature 'say'; sub g {dumphints()}}

I find the output for 'c' honestly surprising.

Replies are listed 'Best First'.
Re^2: A plague on all your features
by ikegami (Patriarch) on Mar 07, 2023 at 00:43 UTC
    $VAR1 = { 'a' => undef, 'b' => { 'feature_bareword_filehandles' => 1, 'feature_indirect' => 1, 'feature_multidimensional' => 1, 'feature_say' => 1, 'feature_state' => 1, 'feature_switch' => 1 }, 'c' => undef, 'd' => { 'feature_bareword_filehandles' => 1, 'feature_indirect' => 1, 'feature_multidimensional' => 1, 'feature_say' => 1, 'feature_state' => 1, 'feature_switch' => 1 }, 'e' => { 'feature_bareword_filehandles' => 1, 'feature_indirect' => 1, 'feature_multidimensional' => 1, 'feature_say' => 1 }, 'f' => { 'feature_bareword_filehandles' => 1, 'feature_indirect' => 1, 'feature_multidimensional' => 1 }, 'g' => { 'feature_bareword_filehandles' => 1, 'feature_indirect' => 1, 'feature_multidimensional' => 1 } };

      I don't know why the hints are undef for c, but I can confirm it's accurate.

      $ diff -u \ <( perl -MO=Concise,b b.pl 2>&1 ) \ <( perl -MO=Concise,c b.pl 2>&1 ) --- /dev/fd/63 2023-03-06 20:59:39.932888013 -0400 +++ /dev/fd/62 2023-03-06 20:59:39.932888013 -0400 @@ -1,8 +1,8 @@ b.pl syntax OK -main::b: +main::c: 5 <1> leavesub[1 ref] K/REFC,1 ->(end) - <@> lineseq KP ->5 -1 <;> nextstate(main 1252 b.pl:15) v:%,*,&,x*,x&,x$,fea=15 ->2 +1 <;> nextstate(main 1257 b.pl:16) v:*,&,x*,x&,x$,fea=1 ->2 4 <1> entersub KS ->5 - <1> ex-list K ->4 2 <0> pushmark s ->3

      Note the different value of the hints (fea= for "feature") for the two lines.

        Actually, the whole v: thing is the hints, not just the fea= portion. And we see another difference: The %. Not sure what it means, but it relates to %^H. Presumably the presence of %^H. Again, present for b but not c.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2024-04-19 20:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found