> templating system to be called as an exec cgi on a Unix server. My concern
> is, am I creating too much overhead, in  that the perl interpreter with
> load every time a page loads? Is this the smartest approach under these
> circumstances or am I missing something obvious (no suprise) that would
> accomplish this better?

In your case, it might be better to load Perl handle ever page and use
require() as a sort of SSI:

---
use strict;

print "Content-type: text/html\n\n";

 require 'header.inc';

 # perl code here

 require 'footer.inc';
---

Not only can header.inc and footer.inc easily be changed, but they can
also contain Perl code.

> Am I making things more complicated than they need to be here? Am I making

It might work for you, but do you think another person working on this
project would be willing to adhere so strictly to  your naming coding
and naming conventions? 

> Feedback, thoughts, suggestions for improvement much appreciated.

I think we are thinking along the same lines as far as using require()
as a ways to include shared code across all the pages.

> $root = "/home/gary/public_html";
> $footer = "footer.txt";
> 
> use File::Basename;
> my $os_string = "MSDOS";
> ($name,$path,$suffix) = fileparse($uri,@suffixlist);
> fileparse_set_fstype($os_string);
> $basename = basename($uri,@suffixlist);
> $dirname = dirname($uri);
> @parts = split('\/',$dirname);
> 
> # "$#" is index of last element of list
> $directory = "$parts[$#parts]";
> $fullpath = "$frontpath" . "$directory";

What exactly are you trying to get out of $uri? I bet you could shorten
that code down to just three or four lines.

> print<<"eof";

Here-documents default with interpolation so the double quotes aren't
necessary:

 print <<EOF;

> open(HEADER, "$root\/$directory\/header.txt");
> @array = <HEADER>;
> foreach $line (@array)
> {
> ($url,$title)=split('\|',$line);
> chomp($title);
> chomp($url);
> if ($url =~ /$name/i) { print "" } else { print "<a 
>href=\"$url\">$title</a>\&nbsp\;\&nbsp\;"; }
> }

 open(HEADER, "$root/$directory/header.txt") or warn("Error: $!");

 while ( <HEADER> ) {
  chomp;
  my($url,$title) = split /\|/;
  print qq|<a href="$url">$title</a>&nbsp;&nbsp;| unless $url =~
/$name/i;
 }

>      @array = <BODY>;
>      print @array;

print <BODY>;
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to