Re: MooseX::Setter, request for feedback before pushing to CPAN.
[email protected] (Eric Wilhelm)
| Newsgroups | perl.moose |
|---|---|
| Message-ID | <[email protected]> |
# from benh
# on Thursday 31 July 2008 19:38:
>So I'm looking for some
>feedback before I toss it up on CPAN.
s/cluck/croak/
That would seem more analogous to the "Can't locate method ..." error
which would typically get thrown when trying to call a mutator for a
non-existent attribute.
# from Paul Fenwick
# on Thursday 31 July 2008 23:25:
>Just to ensure my understanding is correct, this is a module which
> allows a class to return the object after a write accessor is called,
> rather than the previous (or current) value?
It would seem so. Now I'm wondering if I should pester Ben with the
issue of more generic chaining.
$obj->call(method1 => [@args1], method2 => [@args2])->method3;
sub call {
my $self = shift;
my @list = @_;
while(defined(my $method) = shift(@list)) {
my $args = shift(@list);
$self->$method(ref($args) ? @$args : $args);
}
return($self);
}
But now I'm just being silly. Everyone knows that should just be an
AUTOLOAD with a 'call_' prefix on every method.
$self->call_method1(@args1)->call_method2(@args2)->method3;
--Eric
--
The only thing that could save UNIX at this late date would be a new $30
shareware version that runs on an unexpanded Commodore 64.
--Don Lancaster (1991)
---------------------------------------------------
http://scratchcomputing.com
---------------------------------------------------