[Maypole] 2.07 PR

Simon Flack sf@flacks.net
Tue, 18 Jan 2005 20:16:56 +0000


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