[Catalyst-dev] RfC: CatalystX-Imports

Robert 'phaylon' Sedlacek rs at 474.at
Mon Jan 22 23:30:12 GMT 2007


Good evening,

I just imported CatalystX-Imports into Catalyst trunk. This package
provides some functions to import and facilities to write own library
functions. This module was partly inspired by mst (what isn't these
days?) and a variant of it made some of my recent apps much more
readable and less verbose.

To give an example, here is the synopsis of the module:

  package MyApp::Controller::Foo;
  use warnings;
  use strict;

  use base 'Catalyst::Controller';

  use CatalystX::Imports qw(action uri_for res);

  sub index: Private {
      res->redirect( uri_for(action('list')) );
  }

  sub list: Local {
      stash( rs => model('DB::Foo')->search_rs );
  }

  1;

The currently available functions are: action, model, uri_for, req, res,
has_param, param, stash, log_debug, log_warn, log_error and path_to.
Once the library API is stable enough, I'd also like to make more
specific packages a la CatalystX::Imports::DBIC providing

  DBIC('Foo')->search(...);
  ...
  transaction {
      # ...
  };

and similar. I'd be very much interested in comments. POD and a basic
set of tests are there.

Thanks,
phaylon



More information about the Catalyst-dev mailing list