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

Hello Monks!

I'm about to start my college project. It will be some sort of Intranet/B2B application. On one side you have company that can add products, check orders, manage dealers ...etc. and on other side you have the dealers.

The method that I'm using at this point (for existing applications) - is to have an base class which is inherited by all modules that contain Runmodes (CGI::Application term). Among things like setting up a DB connection and configuring some of the plug ins (sessions, templates path ...) in cgiapp_prerun (method which is called after all configuration but before the specific runmode is executed) I call a method named authorize.

# Inside base module sub cgiapp_prerun { my ($self, $run_mode) = @_; unless( $self->authorize() ){ # Error $self->prerun_mode('UNAUTHORIZED'); } } sub authorize { my $self = shift; return $self->session->param('logged-in'); }
Each of modules that inherits from this one can override the authorize method in case additional checks are to be made (say if user has admin rights). Obviously methods are grouped in modules by logical relationship and they basically make one object/class on it's own.

How does this looks to you folks? What methods are you using?

I will also need to implement a bit more complicated checking as b2b application will be just part of the intranet application (kind of module/plug-in for it). So some grouping of users will need to take place, as I imagine not everyone will be able to admin everything (some admins will be admins for entire intranet, some for b2b and some for some other module).

As I haven't yet worked on projects of this size, I would appreciate any recommendations or help of any kind.


Have you tried freelancing? Check out Scriptlance - I work there.