> Programming Perl (aka the camel book) > also check out: http://directory.google.com/Top/Computers/Programming/Languages/Perl/Documentation/Tutorials/ if you just want a simple example to play around with, try: #!/usr/bin/perl -w use Strict; # or is it 'use strict;'? # Prototypes: sub get_table($); # ASSERTIONS: # 1. The first argument is the html template file to use $f_template = $ARGV[0] || die "Arg 0 was not supplied\n"; if(! -f $f_template) {die "$f_template is not a file\n"} # 2. The second argument is the (tab-delimited text) data file for the table to insert $f_data = $ARGV[1] || die "Arg 1 was not supplied\n"; if(! -f $f_data) {die "$f_data is not a file\n"} # 3. The insertion point for the table is denoted by: <!-- generated table --> $table_tag = '<!-- generated table -->'; # Open the template and pipe it to stdout, # inserting the table at the appropriate location open(FHTML, $f_template) || die "Could not open $f_template\n"; while($line = <FHTML>) { if($line =~ m/$table_tag/) { $line .= get_table($f_data); } print $line; } close FHTML; exit; # Assemble a (very) basic HTML table # from a tab-delimited text file sub get_table($) { my $df = $_[0]; my $ret = "<TABLE>\n"; open(FDATA, $df) || die "Could not open $df\n"; while(<FDATA>) { chomp(); $ret .= " <TR>\n"; foreach(split()) {$ret .= " <TD>".$_."<\/TD>\n";} $ret .= " <\/TR>\n"; } $ret .= "<\/TABLE>\n"; close FDATA; return $ret; } > ---------- > From: Florin Iucha[SMTP:florin at iucha.net] > Reply To: tclug-list at mn-linux.org > Sent: Friday, July 13, 2001 12:32 PM > To: tclug-list at mn-linux.org > Subject: Re: [TCLUG] generating static web page (php?) > > On Fri, Jul 13, 2001 at 11:55:37AM -0500, Ben Luey wrote: > > I found on the phpbuilder site and howto generate static web apges -- > > basically point lynx (or wget) at the site and cat the output to a file. > > Really simple, just need to learn php (any good book recommendations?) > > > > Sounds like it a perl vs php question. > > The perl version is almost as complex except that you don't need lynx and the > web server. > > Look into Text::Template module. > > If you have a reasonably recent Linux/*BSD distribution you should be > able to get it like this: > > perl -MCPAN -e shell > <you might be asked a couple of questions here, read the help > text and do educated guesses> > <you will get to a "cpan>" prompt> > install Text::Template > <perl will rumble ...> > <back to the "cpan>" prompt> > exit > > <now, back in shell> > perldoc Text::Template > > As for generic Perl stuff, get "Programming Perl" 3rd edition or the "Perl > CD Bookshelf". From Bookpool (disclaimer: I am in no way affiliated with them, > just a very happy customer since '99 - they have some of the best prices on > O'Reilly and AddisonWesley - no Manning though) > > florin > > -- > > "you have moved your mouse, please reboot to make this change take effect" > > 41A9 2BDE 8E11 F1C5 87A6 03EE 34B3 E075 3B90 DFE4 > _______________________________________________ > tclug-list mailing list > tclug-list at mn-linux.org > https://mailman.mn-linux.org/mailman/listinfo/tclug-list >