Re: [Maypole-dev] Maypole::Model::CDBI dependencies

From: Simon Flack (sf at flacks.net)
Date: Fri Jan 28 2005 - 14:13:44 GMT


Dave Howorth wrote:
> I see from the roadmap that M-M-CDBI is going to get its inheritance
> improved (it's a great concept to think about if you could upgrade your
> real-life parents like this :)
>
> I'd like to suggest that something else be wrapped in with this.
> Actually, I suspect it already is but I just want to be sure. At present
> M-M-CDBI starts like this:
>
> package Maypole::Model::CDBI;
> use base qw(Maypole::Model::Base Class::DBI);
> use Class::DBI::AsForm;
> use Class::DBI::FromCGI;
> use Class::DBI::Loader;
> use Class::DBI::AbstractSearch;
> use Class::DBI::Plugin::RetrieveAll;
> use Class::DBI::Pager;
>
> use Lingua::EN::Inflect::Number qw(to_PL);
> use CGI::Untaint;
> use strict;
>
> Looking at that list:
>
> - I use a heavily-patched version of AsForm, which I'd rather rename
> something else to avoid mistakes, then I wouldn't want to use AsForm.
>
> - I've just written a do_edit action that uses Data::FormValidator, so I
> won't use FromCGI.
>
> - I don't use C-DBI-Loader at present, so I'd rather not have to load that.

Maypole::Model::CDBI::Plain should do that, but because it inherits from
M::M::CDBI, you still end up loading CDBI::Loader.

> - Because I'm planning to use D-FV, I don't need to use CGI::Untaint.
>
> - also, I don't understand 'use Lingua::EN::Inflect::Number qw(to_PL);'
> It doesn't seem to be used anywhere? [If it was, I almost certainly
> wouldn't be using that code since I've overridden everywhere that
> Maypole generates text for display.]

I don't know why that's there. In the past, I assumed it was something
to do with UNIVERSAL::moniker (plural_moniker), but that loads
Lingua::EN::Inflect::Number itself. It should be safe to remove that.

> So I'd like some way to not have to load all these modules. Even
> something as simple as putting all the use statements in a method so it
> could be overridden would be adequate.

I need to think about this some more, but we could start with a
M::M::CDBI::Minimal and build the loader/plain modules on top of that.
I'd also like to take a look at Data::FormValidator as a possible future
replacement for CGI::Untaint.

Simon

_______________________________________________
maypole-dev mailing list
maypole-dev at lists.netthink.co.uk
http://lists.netthink.co.uk/listinfo/maypole-dev



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:57 GMT