Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Enbugger on Windows

by morgon (Curate)
on Jan 19, 2012 at 21:47 UTC ( #948851=perlquestion: print w/replies, xml ) Need Help??
morgon has asked for the wisdom of the Perl Monks concerning the following question:


in my current project I have to maintain a perl-app (a system-monitor) that runs on Windows.

At the moment the app is based on ActiveState and is (for ease of deployment - not for obfuscation) packaged with perl2exe.

The pain in some of my body parts is that when I have to investigate problems I deal with a Windows-exe, i.e. I cannot simply add traces to a script but have to go to my build-machine, package a new version and move it to the machine I need to investigate.

As I recently came across the very cool Enbugger-module I wonder if that could ease the pain for me a bit but I don't have any real Windows-experience.

So my question is:

Is there an Enbugger-ppm for ActiceState somewhere or can you build it for Strawberry - and does it work with perl2exe?

Many thanks!

Replies are listed 'Best First'.
Re: Enbugger on Windows (add your own -d)
by tye (Sage) on Jan 19, 2012 at 22:28 UTC
    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 and maybe a couple of other things.

    - tye        

      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        

Re: Enbugger on Windows
by dasgar (Priest) on Jan 20, 2012 at 05:06 UTC
    Is there an Enbugger-ppm for ActiceState somewhere or can you build it for Strawberry - and does it work with perl2exe?

    Just because you're using ActivePerl from ActiveState does not mean that you can't install modules from CPAN.

    Assuming that you're using a 32-bit version of ActivePerl on a system with access to the internet, here's what you need to do to be able to install modules directly from CPAN.

    • Use PPM to install mingw and dmake, which are available from the default ActiveState repository.
      • If you're wanting to use Strawberry Perl, it already has the components needed to install modules from CPAN.
    • If your system is behind a proxy, you'll need to add the http_proxy environment variable with the correct information to you Windows OS.
    • Now, from a command prompt, you can install modules directly from CPAN by using syntax like cpan install Enbugger

    As far as compatibility with perl2exe, I can't say since I've never used that utility before. If for some reason you do encounter issues with perl2exe, you can always install PAR::Packer and use the pp utility to bundle your code into a stand-alone exe file.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://948851]
Approved by davies
[LanX]: but the one in Metz is pretty! ;-p
[LanX]: Station Palace

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (11)
As of 2017-12-13 16:12 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (369 votes). Check out past polls.