develooper Front page | perl.module-authors | Postings from October 2005

Another naming question, this time session-related

Thread Next
Dave Rolsky
October 6, 2005 13:01
Another naming question, this time session-related
Message ID:
So it looks like Rose::URI does what I want (name notwithstanding ;) so I 
probably won't release my URI code (though I could if people are desperate 
to see it).

Next up on the agenda in breaking MasonX::WebApp into tiny pieces ...

It provides a simple API for storing messages (errors and non-errors) and 
query/form data in the session (basically to help repopulate a form after 
a redirect on an error).

It uses Apache::Session::Wrapper to create the session and then has a very 
simple API like this:

   add_error( ... )
   # if given an exception object tries to get some useful info out of it,
   # but can just take a string or hashref or whatever.

   add_message( ... )
   # save a non-error message like "you are logged in"

   save_form_data( \%hash )
   # socks away that form data for you

   # return stuff

   # remove all errors, messages, and form data from the session

   # get the underlying session hash

I'll probably also have:

   # return stuff and delete it from the session

So the question is what to call this?  I think it's pretty useful as it 
encapsulates a very common use of sessions with a slightly higher level 

It's also worth noting that it is not actually web application specific 
since Apache::Session (and Apache::Session::Wrapper) despite the name are 
not mod_perl only.

So I was thinking of a name like Session::MessagesAndFormData but that's 
got two strikes.  One, it's a new top-level namespace (there is, but it's not really maintained nor does anyone use it, I'd 
guess) and two, the second part is goofily verbose.


Your guide to all that's veg.       My book blog

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About