Yeah, that looks pretty good
"Alexander Blüm" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> that doesn't sound too good. sounds like loading all into memory, split
> it up into arrays and then finally printing the contents to the browser.
> bleh!
>
> how aout this:
>
> #somewhere in the code:
> &include("/includes/header.html");
> ...
> &include("/includes/footer.html");
>
> ### subroutine
> sub include{
>   my $filename = shift;
>   open(FH, "<$filename") || die "cannot open $filename: $!\n";
>   while (<FH>){
>     print $_;
>   }
>   close FH;
> }
>
>
>
> On Tue, 3 Feb 2004 19:37:54 +1100
> "Charlie somerville" <[EMAIL PROTECTED]> wrote:
>
> > just use this code:
> >
> > ===START CODE===
> > $filename="my_file"; #Set the filename
> > open(A,$filename) || die "Waaah! The open didn't work: $!"; #Open the
> > file in $filename or do what MSWindows always does
> > @a=<A>; #Put the filehandle A in the array @a;
> > print "Content-Type: text/html\nPragma: No-cache\n\n"; #Take away the
> > 'Pragma: No-cache' bit if u want the browser to cache it
> > print @a; #Spits it out
> > close A; #Close the filehandle (not always neccesary)
> > ====END CODE====
> >
> >
> > "Seldan" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > Hello.
> > >
> > > I have been writing and maintaining a web-based intranet application
> > > for some time, primarily written in PHP with the backend written in
> > > POSIX
> > shell.
> > > The pages access a postgreSQL database and I use a bit of JavaScript
> > > to
> > make
> > > things look nice.
> > >
> > > In effect, it is a typical DB driven app. to help out with system
> > > administration, etc.  Lately, I've been teaching myself Perl and
> > > have decided to convert some of this to that language to assist in
> > > learning.
> > So
> > > far, it has worked out nicely and I've begun to access modules like
> > > Write::Excel, CGI.pm, Pg.pm, etc.
> > >
> > > However, I am trying to keep this site as modular and easy to
> > > maintain as possible and cannot seem to find the right equivalent
> > > for a basic PHP"include" or "require" function.  I use several
> > > variables that stay the
> > same
> > > throughout the scripts, and would like to host them in a separate
> > > file.
> > >
> > > Sifting through ideas on this I've come across: SSI, Embperl, Mason,
> > > and possibly creating modules to handle this.  All seem like a bit
> > > of work, which isn't a problem, I just want to make sure that I'm
> > > not missing a simple, obvious way to make this happen!
> > >
> > > Any thoughts or suggestions are welcome.
> > > Thanks.
> > > Tom
> > >
> > >
> >
> >
> >
> > -- 
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > <http://learn.perl.org/> <http://learn.perl.org/first-response>
> >
> >
>
>
> cheers,
>   Alex



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to