Closed Thread Icon

Topic awaiting preservation: The Amazing Crashing 8 line program! (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12288" title="Pages that link to Topic awaiting preservation: The Amazing Crashing 8 line program! (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: The Amazing Crashing 8 line program! <span class="small">(Page 1 of 1)</span>\

 
Petskull
Maniac (V) Mad Scientist

From: 127 Halcyon Road, Marenia, Atlantis
Insane since: Aug 2000

posted posted 06-26-2002 16:40

Only I can crash a perl script in only 8 lines... anybody know why?

code:
#!/usr/bin/perl

use CGI;
my $mystuff = new CGI;

########-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= The CGI Input
# Picking up the inputs #
# To place the input value in a variable, type the following: #
# my $nameOfVariable = $mystuff->param('nameOfInputField'); #
################################################################
my $name = $mystuff->param('alias');
my $email = $mystuff->param('email');
my $message = $mystuff->param('messagetext');
#########-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= The Global Variables

########-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= The Program

print "Content-type: text/plain\n\n";
print "Value of name: $name<br>";
print "Value of terrorist: $message<br>";

########-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= The Stored Data
# None- now....
########-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= The Subroutines
# None- now....




Code - CGI - links - DHTML - Javascript - Perl - programming - Magic - http://www.twistedport.com
ICQ: 67751342

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 06-26-2002 17:30

Well, for one thing, change that text/plain to text/html if you want your <br>s to work. But I don't know what the error is. Don't you have access to the error logs?

Petskull
Maniac (V) Mad Scientist

From: 127 Halcyon Road, Marenia, Atlantis
Insane since: Aug 2000

posted posted 06-26-2002 17:34

sorry.... I shoulda led with that..... I was just really pissed..

"Premature end of script headers:"


Code - CGI - links - DHTML - Javascript - Perl - programming - Magic - http://www.twistedport.com
ICQ: 67751342

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 06-26-2002 18:44

tis probaby the text/html thing.

When in doubt the CGI module will auto generate your headers

in your case
print $mystuff->header();

should do it you can also change this by passing it params but the default it text/html



.:[ Never resist a perfect moment ]:.

Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 06-26-2002 19:53

Actually, we fixed this. Turns out to be a combo path/rights issue.
The server likes to see
#!/usr/bin/perl -w
as the path (instead of #!/usr/bin/perl). Once we changed this and CHMODed to 755 (instead of 777), it ran fine.

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 06-26-2002 20:17

what you need the -w switch?
That's just for verbose debugging I wouldn't think it mattered.



.:[ Never resist a perfect moment ]:.

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 06-26-2002 22:54

As Bitdamaged said above, '-w' command-line switch should be optional. The real problem was with file permission, CGI scripts must be CHMODed 755 or they won't work...


Petskull
Maniac (V) Mad Scientist

From: 127 Halcyon Road, Marenia, Atlantis
Insane since: Aug 2000

posted posted 06-27-2002 09:54

wow... learned a bunch of new things debugging this...

btw, thanks Pugz...

now it's tossing a "Can't locate object method "new" via package "CGI" at guestbook.cgi line 8. "

on this line:

code:
use CGI::Carp qw(fatalsToBrowser);
[b]my $mystuff = new CGI;[/b]

my $name = $mystuff->param('alias');
my $email = $mystuff->param('email');
my $message = $mystuff->param('messagetext');



I've always been taught (by....um.... myself....) that that was the proper way to use the CGI module.... isn't it?


Code - CGI - links - DHTML - Javascript - Perl - programming - Magic - http://www.twistedport.com
ICQ: 67751342

Petskull
Maniac (V) Mad Scientist

From: 127 Halcyon Road, Marenia, Atlantis
Insane since: Aug 2000

posted posted 06-27-2002 12:48

ok, by adding this line:
"use CGI qw(:standard);"
everything falls into place..

yay! thanks, ya'll....

but now, even though the output to the browser is actually working, it still doesn't write to the file....

*yoda* still long, the path is...



Code - CGI - links - DHTML - Javascript - Perl - programming - Magic - http://www.twistedport.com
ICQ: 67751342

Piper
Paranoid (IV) Inmate

From: California
Insane since: Jun 2000

posted posted 06-27-2002 15:15

Hi Petskull,

If you're using the OO interface for the CGI module you don't really need to import the methods. You can change use CGI qw(:standard); to use CGI; and it will do all the importing for you as it's needed. I agree that the -w switch is optional but I recommend that you always use it and also use strict; in your scripts. That really catches a lot of small problems/errors that might slip by. Eventually it cuts down on your debug time too

quote:
but now, even though the output to the browser is actually working, it still doesn't write to the file....



Want to show the rest of the code so I can peek at it?


Regards,
Charlie

Petskull
Maniac (V) Mad Scientist

From: 127 Halcyon Road, Marenia, Atlantis
Insane since: Aug 2000

posted posted 06-27-2002 22:36

*sorry, I'll answer you later- but right now I'm really fucking stressed (family stuff)*

what the fuck is 'concatenation'?

Use of uninitialized value in concatenation (.) or string at guestbook.cgi line 35.


Code - CGI - links - DHTML - Javascript - Perl - programming - Magic - http://www.twistedport.com
ICQ: 67751342

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 06-27-2002 23:02

Concatenation is merging two strings into one.

for example:
"hello" + " " + "there" => "hello there"

Only in Perl, this is done with the . operator, for example:

"hello" . " " . "there" => "hello there"

« BackwardsOnwards »

Show Forum Drop Down Menu