UBB.Dev
Posted By: Em8 Perl Script Help - 09/09/2000 2:32 AM
I have just learned perl and got the $ to display somthing automaticly today. I was wondering what was wrong with this script:
Code
code:
This was a test script. So can you help?

------------------

[This message has been edited by Em8 (edited September 08, 2000).]
Posted By: zanardi Re: Perl Script Help - 09/09/2000 3:31 AM
get ride of all the "my"s in front of the variables. you don't need thme. This below is an example of useing it:

=========================
&goto("Hi");

sub goto {
my $variable = shift;
print "$variable";
}
=========================

Even when you delete all the my's in front. You'll still get a white page. Try this:

==========================
use CGI qw/:standard/;

if (param('action') eq 'TopHTML') {
&TopHTML;
}
==========================

Now from your browser:
http://www.yoursite.com/cgi/yourscript.cgi?action=TopHTML

If you would rather it link to like

yourscript.cgi?action=top

change TopHTML to...

====================
if (param('action') eq 'top') {
&TopHTML;
}
====================

Hope that helps



------------------
My Freeware Board
Posted By: The Team Re: Perl Script Help - 09/09/2000 5:40 AM
Quote
quote:
No, no, no, no....

Getting rid of the my's would actually cause an error when using strict, which should always be done. Your "scope" must be specified...



------------------
I wish I were a Canuck
All they have to do is drink beer, play hockey, and say "Eh"

* No offense meant to any Canadians
Posted By: Mark Badolato Re: Perl Script Help - 09/09/2000 7:19 AM
Get rid of the my's??? Just because you don't understand something doesn't mean you should tell people not to do it. My's are a good thing. It's called proper programming.

Now to the root of the problem:

1) The heredoc is wrong:

print <:
:
HTML

That close should be TOPHTML, not HTML

2) there's no actual call in the code to sub TopHTML so the routine is never getting executed.

--mark

------------------
Posted By: Em8 Re: Perl Script Help - 09/09/2000 6:58 PM
So, like
Code
code:

I uploaded it just like that but I was wondering, the
print "Content-type: text/htmlnn";

print " &TopHTML; ";

&TopHTML;

should I remove

print "Content-type: text/htmlnn";

print " &TopHTML; ";

or should I remove

&TopHTML;

or leave it like it is? Thanks for all the help!
Posted By: The Team Re: Perl Script Help - 09/09/2000 7:21 PM
You need the content line always when you are printing to a browser. Remove the print " &TopHTML"; line...

------------------
I wish I were a Canuck
All they have to do is drink beer, play hockey, and say "Eh"

* No offense meant to any Canadians
Posted By: zanardi Re: Perl Script Help - 09/11/2000 3:37 AM
my goodness people I'm still learning perl myself so please you don't need to jump on my back you could atleast politly correct me...

------------------
My Freeware Board
Posted By: Mark Badolato Re: Perl Script Help - 09/11/2000 6:34 AM
If you're just learning yourself, then you have no right telling people to do or not do something, especially if you have no idea what it is.

Polite? Not my style. It pisses me off when wrong or bad information is passed on too people, especially when the people doing the passing are not simply misinformed, but rather have no basis for the information they provide.

--mark

------------------
Posted By: The Team Re: Perl Script Help - 09/12/2000 12:05 AM
If you teach someone the wrong way to to do something, than it's no good....

------------------
Da Wannabe Cannuck

Andy Tomaka
YaBB Developement Team
[email protected]
http://www.yabb.org
Posted By: Em8 Re: Perl Script Help - 09/24/2000 9:48 PM
Quote
quote:
Ya. I mean he tried to help.



------------------
© UBB.Developers