Re: General Perl/Web questions





Steve Gross wrote:
I've just finished developing a small web site that uses Perl, CGI, DBI
and HTML-Template. Typically, an HTML page calls a Perl script that does a
database fetch, parses the data and then puts it on another web page using a
template.
I've noticed that most of my web pages look the same:
Get Passed Parameters
Open Database
Build SQL Query
Execute SQL Query
Close Database
Parse Data
Open Template
Pass Data to Template
I repeat this pretty much for each HTML/Perl script.
What I was wondering is can I somehow modularize a segment and then call it
from each script? That way I would only need to write and debug it once.
Something like subroutines but on a more global level.

Sure just use Modules, OO or function based will do depending on the task.

perldoc perlmod
.



Relevant Pages

  • Re: performance efficient "tail"
    ... > I'm trying to write a script which parses the end of a 1GB log which is ... > located on a remote server. ... I don't mind first saving the "tail"ed text ...
    (perl.beginners)
  • Re: Scriptable defense question
    ... ...I am thinking of a script that parses a log, ... Is there a tool that would allow for a tcp reset, or connection drop, or possible bar future sessions from that IP? ... I am thinking of a script that parses a log, looks for repeated attempts from the same IP, and then calls a tool that drops the connection. ...
    (Pen-Test)
  • performance efficient "tail"
    ... I'm trying to write a script which parses the end of a 1GB log which is ... located on a remote server. ... I don't mind first saving the "tail"ed text ...
    (perl.beginners)
  • General Perl/Web questions
    ... an HTML page calls a Perl script that does a ... Execute SQL Query ... Pass Data to Template ... I repeat this pretty much for each HTML/Perl script. ...
    (perl.beginners)
  • Re: script suddenly broken (/bin/sh, fink, Mac OSX)
    ... klaus-peter gores wrote: ... The tcsh upgrade has nothing to do with the invalid number. ... Your script will work again in October. ... Your problem is due to how printfparses the arguments. ...
    (comp.unix.shell)