Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Implement index.pl?something

by Anonymous Monk
on Aug 01, 2007 at 16:32 UTC ( #630109=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

I'd like to think that this is a simple question, but I've searched many places and am having trouble. I'd like to combine HTML::Template (great tutorials on this btw!) with something like the "node" feature you have on PerlMonks - so that my index.pl looks like:

www.domainname.com/index.pl?id=number

How do I go about this? Can I do it without MySQL? Idealistically i would be able to type in a number and it would find that information from my database (text files), and display a page that combines my HTML::Template by using the ID tag to parse for the rest of variables on the same line in the text files.

Thanks soooo much!!!!

Replies are listed 'Best First'.
Re: Implement index.pl?something
by ikegami (Pope) on Aug 01, 2007 at 16:35 UTC
    Assuming index.pl is a CGI script, use CGI's param method to extract URI parameters. Then you can do whatever you want with it, including passing it as a parameter to SQL queries.
Re: Implement my own nodes
by jZed (Prior) on Aug 01, 2007 at 16:46 UTC
    There are many ways to implement this. It is usually done by having an application framework (like Catalyst or CGI::Application) to Control the flow, a database (like Pg or MySQL or SQLite) as the Model to store data and a templating system like the one you're already using to display the View. You can Control the flow yourself just by checking the querystring and using it to determine which part of the model to consult and which template to display. You can use text files as the Model though databases already cover some of the gotchas you need to watch out for. So, yes you can do it more or less as you described.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://630109]
Approved by ikegami
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2019-06-24 23:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Is there a future for codeless software?



    Results (100 votes). Check out past polls.

    Notices?