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

I have over 25 years of experience in IT but am new to the world of PERL. I have been asked to fix some bugs on a Web system which is a mixture of numerous languages and components (PERL, PHP, HTML, Java script, MYSQL). I have traced the source of some of these bugs to a particular PERL module, but whenever I change the module it falls over with an internal server error. It doesn't appear to matter what I change - code, comments, contents of text fields - it still falls over. I restored an old version of the program an this ran fine. I made a small change to a comment in this module and it too fell over. It's almost as if there's some kind of self referencing module audit going on, but can find no trace of such a thing (or how it would actually work anyway is a point of conjecture!). I have made changes to other PERL modules in the suite and have had no such problem. Any ideas on what might be going on?

Replies are listed 'Best First'.
Re: PERL Changes
by NetWallah (Canon) on Apr 25, 2010 at 16:20 UTC
    Moritz's fine suggestion is the correct starting point for diagnosis, but I just wanted to suggest that this sounds like a file security problem.

    When you modify and save a file, it likely changes the security attributes - owner, and permissions.

    "Restoring" the file presumably keeps these attributes intact.

    Suggestion: check these attributes ("ls -l" in linux, combination of "dir" and "cacls" or exploder GUI in windows) before and after your modifications.

         Syntactic sugar causes cancer of the semicolon.        --Alan Perlis

Re: PERL Changes
by moritz (Cardinal) on Apr 25, 2010 at 16:05 UTC

    There is Perl, which is the language, and perl, which is the interpreter/compiler. PERL doesn't exist (except as Inline::PERL).

    but whenever I change the module it falls over with an internal server error.

    That is the correct time to look into the error log file of the web server, to find out why it responds with an internal error.

    Perl 6 - links to (nearly) everything that is Perl 6.
Re: PERL Changes
by sierpinski (Chaplain) on Apr 25, 2010 at 18:44 UTC
    Whenever I am troubleshooting a web problem, I keep a separate terminal window open and 'tail -f error.log' for the apache error log. It usually makes quick work of tracking down where a problem lies, especially since most browsers aren't giving useful error messages directly to the browser.

    Also, it's a great help if you post some code (using the <code> tag) so we can better assist in finding the problem. If the code isn't too long, I'd recommend posting the entire thing, so someone can just copy/paste the entire script into their own system and try to run it (obviously having uncommon dependencies may hinder this) but it's good to get an overall idea of what you're trying to do, and what is actually happening.
Re: PERL Changes
by toolic (Bishop) on Apr 25, 2010 at 17:04 UTC
Re: PERL Changes
by amedico (Sexton) on Apr 26, 2010 at 04:54 UTC
    Are you by any chance using a Windows text editor on a file from a *nix system? Unexpected Windows-style line separators (particularly on the #! line of a CGI script) could be one potential cause.
Re: PERL Changes
by cdarke (Prior) on Apr 26, 2010 at 08:07 UTC
    If all else fails, have you tried calling the module from a script on the command-line? You don't need to do much from that script, since it sounds like it is failing to compile (if changing a comment has the effect you say). Just do a use or even just load it using the -M command-line option.