That's a good idea. I would recommend you put the code in a real module (see perlmod) instead of a .pl file.
If you're willing to refactor your code, you could also take a look at CGI::Application::Session, which combines CGI::Session and CGI::Application. It makes sessions even easier to use and provides hooks for authentication etc.
| [reply] |
That would be a brilliant idea. As you get farther along and into bigger projects, you'll find organization and classification are CRITICAL to your code's success.
It's pretty much standard to put frequently used functions in a library and call them as needed.
| [reply] |
Itīs a good pratice, but if you have a big site, use of CGI to autenticate all page views can are a bad idea. CGI have costs with load, parse, compile and run.
Eval use of <a href="http://perl.apache.org>modperl to do it. See a good book Writing Apache Modules with Perl and C (See the code samples).
On modperl environment you have Apache::Session like CGI::Session...
Compare features (and dates):
- Apache::Session
- CGI::Session
| [reply] |