Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Enbugger on Windows (add your own -d)

by tye (Sage)
on Jan 19, 2012 at 22:28 UTC ( #948861=note: print w/replies, xml ) Need Help??


in reply to Enbugger on Windows

if( 'morgon' eq $ENV{PERLDEBUG} ) { delete $ENV{PERLDEBUG}; exec( $^X, '-d', $0, @ARGV ); die "Can't exec $^X: $!\n"; }

Though, if perl2exe ends up passing -I or similar switches to the extracted perl.exe, then this trick requires minor adjustments. You'll also need to generate the exe so that it includes perl5db.pl and maybe a couple of other things.

- tye        

Replies are listed 'Best First'.
Re^2: Enbugger on Windows (add your own -d)
by morgon (Curate) on Jan 20, 2012 at 15:15 UTC
    This is unfortunately not working for me.

    In my perl2exe-compiled binary $^X is set to the exe itself and the -d does then not start the debugger but is passed on to the application.

    Any ideas on what I could try?

      Sad that perl2exe breaks $^X. They probably consider this a "feature". You could try asking the OS more directly:

      use Win32::API (); sub GetPerlExePath { my $f= 'GetModuleFileName'; my $m= Win32::API->new( 'kernel32', $f, 'III', 'I' ) or die "Can't find $f() in kernel32.dll: $^E\n"; my $l= 512; my $s= ' ' x $l; my $a= unpack "I", pack "P", $s; my $r= $m->Call( 0, $a, $l ); die "$f failed: $^E\n" if ! $r; $s= substr( $s, 0, $r ); return $s; }

      - tye        

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://948861]
help
Chatterbox?
choroba waits
[thepkd]: $aohoaoh ->{'foo'} has to be dereferenced to access its contents right?
[thepkd]: sorry. i mean $aohoaoh[0]
[GotToBTru]: $aohoaoh is an array reference tho
[thepkd]: some guy was suggesting $aohoaoh[0]->{'foo '}[0]->{}. This wouldnt work.
[GotToBTru]: you're mixing notation there I think
[GotToBTru]: $aohoaoh->[0] is a hash reference, so $aohoaoh->[0]->{ key1} would work
[1nickt]: If 1nickt is the some guy, that's not what he said.

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (11)
As of 2016-12-06 13:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (104 votes). Check out past polls.