There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
acer audio black screen boot bsod computer connection crash css dell display driver drivers email error ethernet excel explorer firefox firefox 3 game hard drive internet internet explorer itunes laptop lcd linux malware network networking nvidia outlook outlook 2003 outlook express partition printer problem router slow software sound trojan usb video virus vista windows windows xp wireless
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
Perl Help needed


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
jdriver's Avatar
Junior Member with 2 posts.
 
Join Date: Dec 2003
22-Dec-2003, 08:54 PM #1
Question Perl Help needed
Hello everyone,

I'm in a bit of a bind, I need to create a couple 1000 HTML pages in a short amount of time. The information, with the exception of about 10 items, are static. I tried my hand at a Perl script that would query me for the 10 items and then create the HTML file, but that blew up in my face. Does anyone know of a Perl script or program out there that would meet my needs?


Thanks in advance!


Jeremy D
Shadow2531's Avatar
Distinguished Member with 2,629 posts.
 
Join Date: Apr 2001
22-Dec-2003, 10:31 PM #2
I made a c++ console app recently that asks for your username, your password and outputs an html file with a hidden form, with the entered username and passwords as the values for the input textboxes.

The file gets saved as username's_email.html

It could be modified to ask 10 things each time and be modified to ouptut different html and different file names.

I will attempt to make the program in perl, but if you are interested in an example of c++ code that would do that, I can post it.
__________________
10 ? "a line as the unending horizon"
20 ? "a curve as the rolling hillside"
30 ? "a point as a distant bird"
40 ? "a ray as the rising sun"
run
Shadow2531's Avatar
Distinguished Member with 2,629 posts.
 
Join Date: Apr 2001
23-Dec-2003, 12:16 AM #3
O.K. here's an example that should help. You can adapt it to your needs. When asked to quit, if you just press enter, it will loop and ask for new entries. If you enter anything else for quit, the program will end. The name of the file that is generated is determined by the username.

Code:
#!usr/bin/perl
generate();
sub generate()
{
system("cls");
print "Enter Username: ";
$username = <STDIN>;
print "Enter Password: ";
$password = <STDIN>;
print"\n";
chomp($username);
chomp($password);
open (HTML,">$username.html");
print HTML '<input type="text" name="username" value="'.$username.'">'."\n";
print HTML '<input type="text" name="password" value="'.$password.'">'."\n";
system("cls");
print "Quit? ";
$quit = <STDIN>;
chomp($quit);
if ($quit eq "")
{
generate();
}
}
All you would have to do is setup your 10 different inputs and print the static code and dynamic code together to the file.

I suppose it would be better to have each set of the 10 entries in a database and then use perl or another scripting lanquage to grab the entries and generate all the html files. That way if you had to regenerate, you wouldn't have to type everything in again. Plus you use scripting to modify the database and regenerate with the new changes.

For the perl/database method, someone else should jump in, as I would not be much help there.
__________________
10 ? "a line as the unending horizon"
20 ? "a curve as the rolling hillside"
30 ? "a point as a distant bird"
40 ? "a ray as the rising sun"
run

Last edited by Shadow2531 : 23-Dec-2003 12:22 AM.
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 11:42 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.