Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: Knowing when a code string contains code that will be executed at compile-time/end?

by LanX (Saint)
on Aug 15, 2020 at 09:23 UTC ( [id://11120771]=note: print w/replies, xml ) Need Help??


in reply to Re: Knowing when a code string contains code that will be executed at compile-time/end? (updated)
in thread Knowing when a code string contains code that will be executed at compile-time/end?

Your examples use run time actions to create END blocks.

They should show up when applying B::Deparse

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

  • Comment on Re^2: Knowing when a code string contains code that will be executed at compile-time/end?

Replies are listed 'Best First'.
Re^3: Knowing when a code string contains code that will be executed at compile-time/end?
by haukex (Archbishop) on Aug 15, 2020 at 09:46 UTC
    They should show up when applying B::Deparse

    Nope, as the OP shows. Plus deparsing requires an eval of the string first.

    use warnings; use strict; use B::Deparse; my $code = q{ print "code\n"; s s s END { print "end\n" } see }; my $coderef = eval qq{ sub { $code } }; my $deparse = B::Deparse->new(); $deparse->ambient_pragmas(strict => 'all', warnings=>'all'); print $deparse->coderef2text($coderef), "\n"; __END__ { print "code\n"; s/ /();/ee; } end

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (1)
As of 2024-04-16 19:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found