i wrote a rather shabby public links page a while ago which stayed on my win2k box for a while working perfectly, then when decided to upload it to a server it stops on the following line:

my (%params) = $query->Vars;

with no errors or anything. it just stops any ideas why, oh monks of great wisdom?

here's the full code
#!/usr/local/bin/perl -w print "Content-type: text/html\n\n"; my $filename = "/home/user/cgi-bin/database.txt"; use CGI; #use strict; my ($query) = new CGI; my $cgi_path = $query->script_name; $cgi_path =~ s/(^.*\\)//; my (%params) = $query->Vars; my ($command) = $params{'command'}; touch() if ($command eq "touch"); addlink() if ($command eq "add"); unless (open FILE, $filename) { nofile(); } my @slurp = <FILE>; close (FILE); print<<END; <html> <head> <title>Links</title> </head> <body> <H1>Links Page</H1><hr><p> <form method=POST action="$cgi_path"> Sorry, adding links is not working at the moment. Can anyone tell me w +hy \%params = \$query->Vars; causes the script to stop?<br> <table> <tr><h3>Add Link</h3></tr><br> <input type="hidden" name="command" value="add"> <tr><td>Name</td><td><input type="text" name="name" size="40"></td></t +r> <tr><td>Url</td><td><input type="text" name="url" size="40"></td></tr> <tr><td></td><td><input type="submit" value="Submit"></td></tr> </table> </form> <hr> END my $flag=0; my ($label, $i, @group, $line, $labeltmp); foreach $line (@slurp) { if ($line =~ m/(\#label)(\s+)(.*)/g) { $labeltmp=$3; if ($flag == 1) { print "<h2>".$label."</h2><p>\n<ul>\n"; @group = sort (@group); foreach (@group) { if (m/(.+)(\s+)(\S+$)/g) { print "<li><a href=\"$3\">$1</a><br>\n"; } } print "</ul><hr>"; undef(@group); } $i=0; $label=$labeltmp; $flag=1; } else { $i++; $group[$i]=$line; } } print "<h2>".$label."</h2><p>\n<ul>\n"; @group = sort (@group); foreach (@group) { if (m/(.+)(\s+)(\S+$)/g){ print "<li><a href=\"$3\">$1</a><br>\n"; } } print "</ul><hr>"; print<<END; </body> </html> END exit; sub nofile { print<<END; <html><head><title>Fatal Error!</title></head><body> Can't read \'$filename\'<br> <a href="$cgi_path?command=touch">Click here to create it</a> </body></html> END exit(0); } sub touch { unless (open FILE, ">$filename") { errorpage("Help! Can't touch file") +; } print FILE "#label Computers\n"; print FILE "site url\n"; close (FILE); } sub addlink { unless (open FILE, ">>$filename") { errorpage("Help! Can't open databa +se for appending"); } errorpage("You must fill in both fields!") if (($params{'name'} eq "") + || ($params{'url'} eq "")); print FILE $params{'name'}." ".$params{'url'}."\n"; close (FILE); print<<END; <a href="$cgi_path">Return</a> END exit; } sub errorpage { print "<html><head><title>Fatal Error!</title></head><body>\n"; print @_; print "</body></html>"; exit(0); }

In reply to a quick stab at a public links page by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.