"Joshua Scott" <[EMAIL PROTECTED]> wrote in message
5D23931127B7EB409640001B7E8A6E32014A2AFA@PASNT32">news:5D23931127B7EB409640001B7E8A6E32014A2AFA@PASNT32...
> I've created a group of Perl subroutines to handle the creation and layout
> of my web pages. These subs are used when browsing to my website.
> Basically all they do when invoked is print a bunch of HTML. I've now run
> into the scenario where I'd like to use these same subs to print static
web
> pages where the output doesn't go to the web browser, but instead goes to
a
> file. How could I go about doing that?
>
> Here's an example of what my subs look like:
>
> Sub opentbl {
> Print "<table>";
> Print "<tr>";
> Print "<td></td>";
> Print "</tr>";
> Print "</table>";
> };
>
> I call the sub from webpages the standard way.
>
> I sure hope I explained this clearly. I'm still getting used to Perl.
> Thank you for any help you can provide!
>
> Joshua Scott
>
>
Not sure from the web but I do this:
sub web_file {
open(WEB_FILE, ">>filename.txt") || die "Unable to open $!";
print WEB_FILE "<table>";
print WEB_FILE "<tr>";
print WEB_FILE "<td></td>";
print WEB_FILE "</tr>";
print WEB_FILE "</table>";
close( WEB_FILE);
}
You may be better served putting the text file in a variable like:
my $web_file = "path/to/file/filename.txt";
This is off the cuff. I know the sub works from the prompt since I use
it onWindows to create batch files on the fly.
Hope this helps...or at least gives you an idea.
Bob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]