HTML isn't all that mysterious, it's just plain text laced with tags that are also based on plain text. For example, <a href = "somelink"> text </a> is all based on simple text. For a script to output HTML, it just needs to print. If you want to output the above HTML, you would do this:
print '<a href = "somelink"> text </a>', "\n";
If you're parsing CGI input (GET and POST data), that's often done using CGI. The same module also provides helper functions for generating HTML code, though for lightweight solutions I prefer just printing it, and for heavy-weight solutions, a templating system is probably better. Tools like HTML::Mason allow you to easily separate the content and HTML from the script's code, which usually improves maintainability and reduces development time for more complex dynamic websites.
As for querying from a database, the Perlish way is to use the DBI module, along with the appropriate DBD (database driver) module. To be more specific, we would need to know what database you're querying and what you wish to query from the DB.
Logins can be handled a number of ways. There's simple .htaccess provided by the webserver, and more elaborate schemes as well. It's all dependant on what you want and need. Session management is often handled by CGI::Session and its companion modules.
Another approach to CGI programming is through CGI::Application. This module is intended to be subclassed, as the building blocks to your own object-oriented CGI application.
Pagination is simply a matter of keeping track of how much content you plan to output, and deciding how much of that content you wish to put on a given page. There's not much to say there. If you've got content of 10000 characters, maybe you would want to divide the content into pages of 2000 characters instead. If that's a challenge, you've got some reading to do before you should even be considering handling things like website logins and database queries. Learning Perl, published by O'Reilly & Associates (the Llama book) is a great place to start for learning about Perl.
For CGI strategies and discussion, I happen to like the Mouse book, CGI Programming with Perl, Second Edition, also published by O'Reilly & Associates. If dealing with CGI is kind of new to you, the book will really be helpful. Not that CGI is terribly complex, but until you've gotten the big picture, it's easy to stab away in the dark never quite hitting the mark.
I hope this helps to point you in the right direction.
Dave
In reply to Re: how to generate html with perl and design pagination without query database
by davido
in thread how to generate html with perl and design pagination without query database
by weihe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |