|
|
|
||||
|
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() |
|
|||||||
| Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
|
Thread Tools |
|
|
#1 |
|
Registered User
Join Date: Jun 2003
Posts: 51
|
Perl include HELP!
Hey,
I'm running a script that gets a header, a body, and a footer and outputs it in a html file. The header and footer is the same for all but the body changes for each. Each body is a perl search script and is different for all categories. What I need is to know the code how to call and RUN a perl script from inside the other perl script and output that in the output file. Can anyone help me out? Thanks, Jon |
|
|
|
|
|
#2 |
|
Registered User
Join Date: Sep 2004
Posts: 151
|
i have no clue
bump help this guy will ya !!!!!!!!!!!!!!!!!!!!!! |
|
|
|
|
|
#3 |
|
Confirmed User
Join Date: Nov 2003
Location: Ontario, CA
Posts: 146
|
You can do this either of two ways. First way is to make the search program a package. Or, since you're talking about the search program just being a program unto itself, assuming it outputs via PRINT commands to STDOUT, you do:
my $searchresults = `/path/to/searchprogram.pl`; print $header; print $searchresults; print $footer; Anyways, that's the idea. I'd explain the package thing, but its a bit more complicated. TDJ |
|
|
|
|
|
#4 |
|
Registered User
Join Date: Jun 2003
Posts: 51
|
tried that but all it's doing is printing the path, it doesnt actually open the file. And the main part of my problem is not the fact that the file doesnt open.
I can open the file no problem but that is whats wrong. It is only outputting the code of the cgi script into the new html page. What i need is for it to open while running the script so only the results are outputted to the final html file, not the code. Anyone have any idea? Thanks, Jon |
|
|
|
|
|
#5 |
|
Confirmed User
Join Date: Nov 2003
Location: Ontario, CA
Posts: 146
|
you're using the wrong sign. One means system execute, the other means string of characters.
You want ` not ' - there is a big distinction. Its the one with the tilde on it. Also, make sure the search script is executable: chmod +x searchscript.pl |
|
|
|
|
|
#6 |
|
Registered User
Join Date: Jun 2003
Posts: 51
|
ok got it to work, only problem now is that my counter doesnt seem to work well.
I need to have a </tr><tr> at the end of every 6 results. When I ask to print $count, all the numbers come out correctly but when i do this: if (int($thecount/6)) everything over 6 will have the </tr><tr>. Any idea on this one? Thanks, Jon |
|
|
|
|
|
#7 |
|
Registered User
Join Date: Jun 2003
Posts: 51
|
Well I was able to get it to work perfectly for one but I have 227 pages to get done. So now it looks like the script is timing out or something and its not creating anything. Heres what I have:
$body1 = `$pathof/search1.pl`; $body2 = `$pathof/search2.pl`; $body3 = `$pathof/search3.pl`; down to 227, then I have this: open(PAGE,">$pathoff/search1.html") or die "Writing Failed\n"; print PAGE "$html $body1 $htmlll\n"; close(PAGE); open(PAGE,">$pathoff/search2.html") or die "Writing Failed\n"; print PAGE "$html $body2 $htmlll\n"; close(PAGE); open(PAGE,">$pathoff/search3.html") or die "Writing Failed\n"; print PAGE "$html $body3 $htmlll\n"; close(PAGE); Any faster way of getting this done so I dont have to put them all in different scripts? Thanks, Jon By the way, $html and $htmlll are the header and footer but those work properly. |
|
|
|
|
|
#8 |
|
Confirmed User
Join Date: Nov 2003
Location: Ontario, CA
Posts: 146
|
Holy shit, you need some help with your programming I think
foreach my $num ( 1 .. 227 ) { my $bodylink = "$pathof/search$num.pl"; my $body = `$bodylink`; open(PAGE,">$pathoff/search$num.html") or die "blah"; print PAGE "$html $body $htmlll\n"; close(PAGE); } This will handle all 227 of them in just a few lines. note replace haha123 with a left curly bracket. |
|
|
|
|
|
#9 |
|
Confirmed User
Join Date: Aug 2004
Posts: 855
|
What is "Perl"?
![]() |
|
|
|