in reply to Code Design Issues
1)
CGI::Application::Session is using CGI::Session, but how do I call functions from CGI::Session? for example
the name() function?
I've tried to following code but it gives me an error
use CGI::Application::Session; CGI::Session->name("sid"); # init session object my $session = $self->session; # if user doesn't accept cookies if ($q->cookie('sid') ne $self->session->id()) { # get sessionid for querystring $self->param('start')->param(sid => "&sid=".$self->session->id()); }
the code below works but it does not change the CGISESSID variable name
use CGI::Application::Session; # init session object my $session = $self->session; # if user doesn't accept cookies if ($q->cookie('CGISESSID') ne $self->session->id()) { # get sessionid for querystring $self->param('start')->param(CGISESSID => "&CGISESSID=".$self->sessi +on->id()); }
by the way, maybe anyone have a better way of appending the sessionid to the querystring if the user doesn't accept cookies?
2)
As long as I can call the functions from the original module I can't see any direct drawbacks in
using plugins to the original modules. On the contrary, maybe it's better to hide away the basic
functionality as much as possible.
3)
My plan before asking this question was to:
Use a database for my product, order and customer data etc.
Use sessions to store the productID, name and price (price will be doublechecked towards the products table at checkout)
1) I wanted to use sessions instead of the database to minimize unneccesary database calls, is this really an issue?
2) I don't want a growing shoppingcart table, Tanktalus had a good point considering if this data could be of any intrest?
perrin had some excellent points which are pretty hard to neglect.
4)
As I guessed. Thanks bradcathey
5)
I guess I will get rid of that Mysql module that was introduced to me at my first job.
I must have overlooked this sentence at the top of its documentation:
"You are strongly encouraged to implement new code with DBI directly."
6)
Good tips on templating.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Code Design Issues
by dragonchild (Archbishop) on Feb 07, 2005 at 13:49 UTC | |
by boboson (Monk) on Feb 07, 2005 at 14:40 UTC | |
by dragonchild (Archbishop) on Feb 07, 2005 at 15:03 UTC | |
by boboson (Monk) on Feb 07, 2005 at 15:15 UTC |