7;rw', coerce => 1);
>
>
> package main;
>
> my $o = PuppyFarm->new();
> my $dog = $o->dog("Spot");
> say ref $dog;
> say $dog->dump;
>
>
> The value stored isn't always the value submitted.
>
--
benh~
http://three.sentenc.es/
dependencies?
>
> Many thanks,
>
>Paul
>
> [1] Since I'm writing short talks for mixed audiences, I can't show anything
> too scary. Sure, I'm willing to dig around in the guts of all sorts of
> things, but I'm trying to dispel the myth that as a regular Perl programmer
> you should have to.
>
> --
> Paul Fenwick | http://perltraining.com.au/
> Director of Training | Ph: +61 3 9354 6001
> Perl Training Australia| Fax: +61 3 9354 2681
>
>
--
benh~
http://three.sentenc.es/
yup, that was it. Thanks Stevan.
On Sun, Aug 24, 2008 at 7:10 PM, Stevan Little
<[EMAIL PROTECTED]> wrote:
> Benh,
>
> On Aug 24, 2008, at 6:59 PM, benh wrote:
>>
>> ok this is an overly simplistic example of what I'm trying to do but
>> in the end I wa
,qw{cat dog}),
{ nums => [1,2,3],
strs => [qw{cat dog}],
},
);
foreach my $in ( [1,2,3], [qw{cat dog}], [qw{1 2 3 cat dog}] ) {
ok( my $t = My::Test->new( data => [1,2,3] ) );
}
# THIS TEST FAILS!
lives_ok { My::Test->new }, q{~shouldn't~ this pass?};
--
benh~
http://three.sentenc.es/
mst, I agree completely, I'll change things up to reflect your code.
Thanks again for the insight.
On Sat, Aug 2, 2008 at 1:23 PM, Matt S Trout <[EMAIL PROTECTED]> wrote:
> On Thu, Jul 31, 2008 at 07:38:31PM -0700, benh wrote:
>> So this was born from a conversation on IRC the
<[EMAIL PROTECTED]> wrote:
> G'day Ben,
>
> benh wrote:
>>
>> So this was born from a conversation on IRC the other day about why
>> setting an attribute returns the value that you just set to. I've been
>> running with a "built in the wrong plac
g $self->meta->{'%!methods'} vs {'%!attributes} ?
On Fri, Aug 1, 2008 at 1:35 PM, Eric Wilhelm <[EMAIL PROTECTED]> wrote:
> # from benh
> # on Thursday 31 July 2008 19:38:
>
>>So I'm looking for some
>>feedback before I toss it up on CPAN.
>
edback before I toss it up on CPAN.
Tests do a better job explaining:
http://www.develonizer.com/svn/MooseX-Setter/trunk/t/00-works.t
Code is here:
http://www.develonizer.com/svn/MooseX-Setter/trunk/
--
benh~
or to call extra methods.
> > > > >
> > > > > We could have an "around" trigger which *does* wrap the assignment.
> > > > >
> > > > >
> > > > > > - what happens if an exception is thrown inside the "before", do
> we catch
> > > > > > it?
> > > > > >
> > > > >
> > > > > No. Exceptions are generally outside of the scope of Moose. We only
> > > > > throw them. :)
> > > > >
> > > > > Besides, before could be used mostly for exceptions, to do
> multi-value
> > > > > validation.
> > > > >
> > > > >
> > > > > > - how would you/should you be able to -- indicate failure or some
> kind in
> > > > > > before?
> > > > > >
> > > > >
> > > > > Throw an error. This is what we do and expect practically everywhere
> > > > > else, right?
> > > > >
> > > >
> > > > I second continuing the method modifier theme into triggers here.
> > > > Sartak hits the nail on the head, before/after/around are nicely
> > > > extended into this realm too. Keeping the theme means less confusion
> > > > when it comes time to document/explain this to people who are ...
> shall
> > > > we be kind and say intermediate moose users ... cause this is getting
> > > > well into the advanced realm.
> > > >
> > > > Well volunteered Sartak!
> > > >
> > > > -Chris
> > > >
> > >
> >
> >
> >
> >
>
>
--
benh~
a dedicated BUILD method, such as:
> >
> > use Moose;
> > use Carp;
> >
> > has 'min' => (is => 'rw', isa => 'Int');
> > has 'max' => (is => 'rw', isa => 'Int');
> >
> > sub BUILD {
> >my ($self, $params) = @_;
> >
> >my ($max, $min) = ($self->max(), $self->min());
> >croak "max < min" if defined $max && defined $min && $max < $min;
> > }
> > --
> > Guillaume Rousse
> > Moyens Informatiques - INRIA Futurs
> > Tel: 01 69 35 69 62
> >
>
>
>
>
--
benh~
usr/bin/perl
use strict;
use warnings;
use Test::More qw{no_plan};
use My::A;
my $a = My::A->new;
is( $a->b->hello, 'world'); #PASS
is( $a->b->a->kitten, 'cute'); #PASS
On 7/2/08, benh <[EMAIL PROTECTED]> wrote:
> I'm with Chris, this is more of
... which
> you'd have to do in any perl code because you've hardcoded the
> classname in the method. This isn't a Moose problem, this is a crappy
> design decision problem.
>
> If you want to be able to subclass Module::B ... then create_b either
> needs to make the classname for B configurable (via a parameter to the
> method, or an attribute in A or something...) or you need to override
> it in your subclass of A to call the class you need ... (or you
> override it with something configurable).
>
>
> -Chris
>
--
benh~
a test to illustrate the point. Sadly all the tests
pass (throws_ok) ?
http://develonizer.com/svn/misc/role_use.t
--
benh~
can't be, then I could imagine myself very soon wanting to start
>> using
>> a lot more factory objects, which would be annoying.
>
>
> My personal feeling is that class level data and methods are bad, and that
> they should generally be avoided in a design. Quite often a Singleton or
> even just a regular old instance will be enough to replace that need. Of
> course, this is *my* approach and TIMTOWTDI so feel free to ignore.
>
> As for the "can this be done", yes it can, but currently we do not have an
> easy way to hook into role composition to add features like this into roles.
> This feature is on the TODO list (nothingmuch wanted it recently for
> something), so we could use this as the impetus to get this started
> (although tuits are somewhat in short supply for nothingmuch and I because
> of $work).
>
> - Stevan
>
>
>
>
>
>
--
benh~
he cookbook seems to be a favorite for learning Moose (or so I have been
> told). Currently I have done a feature-freeze on Moose until the docs catch
> up and are improved (want a commit bit?) so hopefully we will have a better
> set of docs soon and more Cookbook Recipes as well.
>
> - Stevan
>
> >
> >
>
>
--
benh~
m looking over some
> presentations from http://www.iinteractive.com/moose/ at the moment to
> get a feel for the "framework".
>
> Robert
>
>
--
benh~
16 matches
Mail list logo