http://www.perlmonks.org?node_id=890056

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

Greetings Monks,

For last three weeks, I am struggling to re-engineer a interatctive webpage code, without right environment, not even an editor. 

The environment consist of :
Windows Server 2003 running IIS .
Uses predominently mod_perl, then JSON, JS, AJAX etc.etc.. etc..

I badly need two things :
1) How to debug? What IDE is right for this? (if I change anything in hash that is used in template, it crashes)
2) How to or How easy it is to setup a server in my local box? what debugging environment is ideal?
--------------------------------
Just incase you need more info about where I am stuck, what I was doing for last 3 weeks etc, :

Though I am not novice in PERL, all the mod_perl,IIS,JSON are new for me. All these 3 weeks of study, I understood the portion of the architecture, low level design, but could not enhance anything as user asks.

To study it, when I change member variables in $var that goes in process(template.html,$var), and try to see visit the page, IIS displays 'CGI Program misbehaved' as error. The log files have literally no information, like file name, error line nothing.. Only if I print some statements in cgi programs I am able to see something, but no information, line number where it crashes.

Replies are listed 'Best First'.
Re: ModPerl IIS
by ikegami (Patriarch) on Feb 24, 2011 at 21:19 UTC

    IIS displays 'CGI Program misbehaved' as error.

    You said you were using mod_perl, but it seems you are actually using CGI.

    A quick google search reveals that the full error message was probably

    The specified CGI program misbehaved by not returning a complete set of HTTP headers

    The error is that you didn't return a proper CGI response. You should use the CGI module and use its header method to create the proper headers.

    If you are doing that, it could be that some error (possibly a compile-time error) occurred before your call to header had a chance to execute. If so, this should be logged in your web server's error log. If not, it's a question of configuring your web server (which has nothing to do with Perl). Alternative, you may be able to redirect error messages to the screen using CGI::Carp.

    use CGI::Carp qw( fatalsToBrowser );

    PS — mod_perl is a plugin for Apache. If you're using IIS, you're not using mod_perl.

    PPS — That language is named "Perl", not "PERL".

      Thank you for help.
      You are right ikegami.. the error message is like what you said..
      
      But indeed, I see code like this :
       $cgi->session()->data()->{cw_request} = $req->toJson();
       $vars->{request} = $req;
       $template->process('business_objects.html', $vars, \$html) ;
      
      I don't know if it CGI, mod_perl. I thought both went together in this code.
      
      My apologies to monks if I wasted your time. 
      
        Things to try:

        Look for the use... lines at the top of the scripts. You might well be running Apache::Registry, which lets you run CGI programs with little or no modifications.

        Look under your Start menu and see if Apache is installed there. mod_perl doesn't run under IIS.

        Talk to whoever gave you this assignment. Someone must have written this code. Someone must know something about the configuration.

        You came here for help. Keep asking. Ignore anyone who is pointlessly hostile.

        --marmot

        I don't know if it CGI, mod_perl.

        There's not much I can do about it if you didn't believe me the first time around.

        the error message is like what you said..

        Then the solution is like what I said. I'm not sure what else you want from me. You didn't ask any new question or indicate any new problem.

Re: ModPerl IIS
by Fletch (Bishop) on Feb 24, 2011 at 21:06 UTC

    Considering mod_perl is a Perl interface to the Apache httpd API one really shouldn't be surprised that things aren't running under IIS . . .

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

      I told already, I am new to mod_perl. I saw only IIS and its configurations in the Windows 2003 server, and I wrote my question.

      I know it is full of templates. If it is pure CGI, PERL, I won't be asking doubts here.

Re: ModPerl IIS
by wfsp (Abbot) on Feb 25, 2011 at 11:12 UTC
    With regards setting up a server on a local box, Windows comes with IIS. wikipedia have a list of which versions come with which version of Windows.

    Micosoft explain how to get a "Hello World" Perl script working. I've been able to get that working (but don't have access to it at the minute). I always find it reassuring to have something that works, simple as it maybe, before launching into anything complicated.

    So, I would suggest getting "Hello World" working and then add stuff a bit at a time. Let us know how you get on.

    I would echo furry_marmot's advice: "keep asking", don't be put off.

    Good luck!