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

So, I finally broke down and upgraded from Win98 to WinXP.

I'm running Perl 5.6.1 because there isn't a lot of support yet for Perl 5.8 via PPM.

I've got Tk v800.023 and Devel::ptkdb 1.1074.

I'm running Apache 2.0.43. I'm using a default configuration for this.

I have a CGI script that looks like this:

#!perl -d:ptkdb

use strict;
use CGI;

my $q = new CGI;
print $q->header();
print $q->start_html();
print $q->h1("Hello, World!");
print $q->end_html();
If I take away the -d option, it works fine, I get "Hello, World!" in my browser.

If I leave in the -d option, IE spins forever, Task Manager indicates that there is a perl.exe process running, but the debugger window never actually becomes visible. If I kill perl.exe, IE immediately returns a server error.

This used to work right out-of-the-box. I've used Apache/Perl/Tk/Devel::ptkdb on Win98 just like this and it worked fine.

So... since I'm new to WinXP, can anyone out there please tell me what I'm doing wrong, and how to do it correctly?

Thanks,
-Dave
  • Comment on Devel::ptkdb, CGI script, Apache, WinXP -- why won't it work?

Replies are listed 'Best First'.
Re: Devel::ptkdb, CGI script, Apache, WinXP -- why won't it work?
by dpmott (Scribe) on Nov 18, 2002 at 21:20 UTC
    Okay, this is my bad, I apologize for bringing a WinXP problem to the Perl forum. It's clear to me now that this has nothing to do with Perl.

    While I do not yet have the solution, it would appear to be a permission/privilege issue. If I run Apache from the command line (i.e. not as a service), then everything is happy (debugger comes up, etc.).

    When I run it as a service, WinXP will not allow the service to open up a window such that I can interact with it.

    I opened up the Start->Administative Tools->Services utility, opened Properties on the Apache2 service, clicked on the "Log On" tab, and clicked on the "Allow service to interact with desktop". After rebooting, this worked okay for me. Perhaps just logging out and logging back in would work okay, too. Simply stopping/restarting the service did not seem to work.

    Thanks for all of the help, hopefully this is at least a little helpful for anyone else running Perl on XP on a corporate network...

    -Dave
Re: Devel::ptkdb, CGI script, Apache, WinXP -- why won't it work?
by atcroft (Abbot) on Nov 18, 2002 at 20:32 UTC

    While I have not used this on XP, when I use ptkdb from Linux, or even from Win98 or Win2K when I was using them, I would not put the '-d:ptkdb' in the shebang line, but instead would launch the program from a command-line using the option, such as: perl -d:ptkdb testscript.cgi

    I was not aware that it could be used in the way you are attempting. Might try it that way and see if it helps any.

    Update: I went and looked at the documentation for Devel::ptkdb, and it had a BEGIN block that needed to be added when debugging CGIs. That may also be part of the issue. (The BEGIN block can be found in the documentation at the link for the module-I did not include it herein because I felt that documentation would be more current, and to prevent the possibility I might miscopy the information.)

    Update: Might suggest setting the DISPLAY to ':0.0' and see if that makes a difference. I recall using Tk on Win* before, and it did not need an X session, but I can't recall if at the time I had to set the value for DISPLAY or not when I was working with that.

    Update: I am glad you were able to find a solution to your issue. There is nothing bad in asking a question in good faith, for even answers in the negative at least prune away paths that do not have to be explored further, making reaching the solution that much quicker. As an instructor of mine was once fond of repeating, the only stupid question is the one everyone wants to know but is afraid to ask, which comes up later to bite you....

      The example is overly simplified because it is stripped down from a bigger script (to demonstrate my problem).

      I will eventually be using ptkdb to figure out why the CGI::upload() method ($q->upload("filename")) doesn't seem to return a valid filehandle on WinXP (although the filename, when used as <$filename>, seems to work okay). Hmmm... maybe I should post that as a second question...

      Setting up the CGI environment by hand at the command line to simulate a file upload is a task that I'm not at all interested in attempting ;)

      Thanks, -Dave
      Yes, the BEGIN {} block is used on systems with X-Windows to forward the display to a remote computer. Unless WinXP has adopted an X-Windows environment (hey, I'm a novice on XP, it's possible), I don't think that this applies to me.

      Even so, I gave it a try with my best guess at a local display address ( $ENV{'DISPLAY'} = 'XXX.XX.X.XX:0.0';), but it still didn't work.

      I have recently used this technique to debug scripts on a Linux box via Exceed on a WinXP box, so it's good advice, just not (directly?) applicable to me.

      Thanks,
      -Dave