Re: [Maypole] 2.07 PR

From: Simon Flack (sf at flacks.net)
Date: Tue Jan 18 2005 - 20:16:56 GMT


Peter Speltz wrote:
> This isn't new to 2.07 however while we're on the subject . . . Line
183 in
> Maypole::Model::Base , in the is_public sub, a warning is generated
when there
> aren't any attributes for the sub in question. Its annoying when
called in a
> loop.
>
> I replace line 183:
>
> my $attrs = join " ", attributes::get($cv);
>
> with these 2 lines:
>
> my @attrs = attributes::get($cv) || ();
> my $attrs = join " ", @attrs;

Thanks, I'll apply that.

> Another thought on is_public: perhaps it should take an attribute
argument in
> case you already have the attributes. I overrode mine to use one
because i
> check for different types of attributes like so in one place:
> my @attrs = attributes::get($cv);
> my $attrs = join ' ', @attrs;
> if $class->is_public( $method, $attrs) { . . . }
> if $class->is_class($method, $attrs) {...}
> if $class->is_object($method, $attrs ) {....}

I'm not sure about that. The point of is_public() was to abstract away
the concept of attributes so you can specify define your own mechanism
for determining whether Maypole should allow a request. For example you
could have something like this:

        sub MyModel::is_public {
                my ($class, $method) = @_;
                return $class->can("MaypoleAction_$method");
        }

But that's only half implemented at the moment, the default
Model->process will still call MyModel->list() instead of
MyModel->MaypoleAction_list().

Simon

_______________________________________________
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:57 GMT