Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: Will this work?

by Xilman (Hermit)
on May 21, 2010 at 06:39 UTC ( [id://841031] : note . print w/replies, xml ) Need Help??

in reply to Will this work?

Please describe the symptoms in rather more detail than "it doesn't work". Hardly anyone is going to wade through a couple of hundred lines of code otherwise.

Likewise, try to strip down the posted code to remove everything which does work and is otherwise unimportant from the point of view of problem finding. The more closely you can locate the problem, the easier it is to provide a solution.

Give us a clue where to look and there are a number of people around here who will be glad to help where they can.

Finally, get into the habit of including

use strict; use warnings;
at the head of your scripts. You will never regret their aid in displaying problems.


Replies are listed 'Best First'.
Re^2: Will this work?
by Anonymous Monk on May 21, 2010 at 07:29 UTC
    I've had a look through his code, and aside from his html templates, his code is not worth salvaging.

    No amount of describing the symptoms is going to help.

    It doesn't compile, its incomplete, there is massive scope/variable confusion, and there is hand-rolled CGI/date code that has been haunting perl since at least 1997 :)

    He does try to sanitize his inputs, but with all that scope confusion, there is no telling what directory he is trying to write to.

    I started fixing up his program, but I honestly believe he'll benefit more from studying the basics first.

      My bet is that his CGI code isn't hand rolled. It's likely to be copied and pasted. His date code might as well.
        I may have been misusing the phrase hand-rolled, I think it is copy/paste cargo-cult stuff, that should be replaced by modules, ie
        #!/usr/local/bin/perl -T -- use strict; use warnings; use CGI(); use Time::Piece qw[ localtime gmtime ]; my $cgi = CGI->new; my $subject = $cgi->escapeHTML( $cgi->param('subject') ); my $time = localtime; my $long_date = $time->strftime; my $date = $time->hms .' '. $time->mdy('/');