Re: [Maypole] Wish-list

From: Simon Flack (sf at flacks.net)
Date: Sun Sep 26 2004 - 16:54:08 BST


On Sun, 26 Sep 2004 21:03:37 +0900, n.a wrote
> Here are my humble wish lists:
>
> * Good way to make 'Exported' subs.
> I tried to add a "top_five :Exported" sub to 'BeerDB::Beer'
> according to 'The Beer Database Revisited' section.
> To do this, I must select one of two tricks
> Trick 1:
> Explicitly load 'Maypole::Model::Base' to accomplish compile time
> access to attribute-handling 'MODIFY_CODE_ATTRIBUTES'
>
> Trick 2:
> Access '%remember' directly.
>
> package BeerDB::Beer;
> $Maypole::Model::Base::remember{\&top_five}='Exported';
> sub top_five { # delete ':Exported'
> ...
>
> Discussion
> First trick is not so bad, however I'm not sure this doesn't
> cause unexpected side-effect. Second trick is just ugly.
> Moreover, as manual goes, attribute features are still experimental,
> Therefore it seems not good for end user to use these for now.
>
> Possible alternative is to define 'Export' class-method in
> 'Maypole::Model::Base' and say something like
>
> package BeerDB::Beer;
> SUPER->Export(\&top_five); # I'm not sure the syntax at here
> sub top_five {
> ....

I'd rather see the Maypole/Maypole::Model API extended. Something along these
lines:

sub Maypole::is_applicable {
    # ...
    return DECLINED unless $r->model_class->is_public($r->{action});
}

The current behaviour of using :Exported attribute could be moved to Maypole::
Model::Base::is_public, and you could override that behaviour more easily in
your app.

Along similar lines, it'd be nice to be able to configure the mapping between
the URI action and the model action. For example I'd like to be able to map,
'/brewery/add' to &BeerDB::Brewery::Maypole_add rather than &BeerDB::Brewery::
add.

--simonflk

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



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