Grokbase
x

Ricardo SIGNES (perl...@rjbs.manxome.org)

Profile | Posts (1)

User Information

Display Name:Ricardo SIGNES
Partial Email Address:perl...@rjbs.manxome.org
Posts:
1 total
1 in Moose

5 Most Recent

1) Ricardo SIGNES feedback on MooseX::Worm
| +1 vote
I am likely to release this code tomorrow: http://github.com/rjbs/moosex-worm It seems pretty...
Moose
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
I am likely to release this code tomorrow:

http://github.com/rjbs/moosex-worm

It seems pretty reasonable to me, but if I'm doing something totally wrong, I'd
love to find out now rather than later.

--
rjbs
2) Ricardo SIGNES Re: Attribute initializers - incorrect documentation
| +1 vote
FWIW, I am. It is insufficiently straightforward, right now, to do what they do without using them....
Moose
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
* Hans Dieter Pearcey <hdp@pobox.com> [2010-02-04T14:58:50]
> Triggers fire every time you set the value, including when it has a value
> already.  Initializers don't.
>
> I think that's it.
>
> They were rjbs's baby originally, but I don't think he's actually using them.

FWIW, I am.  It is insufficiently straightforward, right now, to do what they
do without using them.  I am happy to fix up code to use a sane alternative.

--
rjbs
3) Ricardo SIGNES Re: initializer
| +1 vote
Say you have an attribute like this: has attr => ( is => 'rw', required => 1, default => 10,...
Moose
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
* Sean Allen <sean@monkeysnatchbanana.com> [2009-01-23T16:20:51]
> I'm reading the docs for initializer and am totally lost as to what it
> does, can someone explain?
>
> I keep reading the words but put together, just not getting it.

Say you have an attribute like this:

  has attr => (
    is       => 'rw',
    required => 1,
    default  => 10,
    trigger  => sub { ... },
  );

When the attribute is changed, the trigger is called.  That does not happen,
though, when the object is created, even though the attribute is set then --
from "no attribute exists because the object is not initialized" to 10.

To have code run when the attribute is *initialized* (set during instance
initialization) you make an initialized.

The test code in Class-MOP might be demonstrative:

http://cpansearch.perl.org/src/DROLSKY/Class-MOP-0.76/t/024_attribute_initializer.t

--
rjbs
4) Ricardo SIGNES Re: dear lazyweb: hashref instead of objects
| +1 vote
Hm. What I really want is Role->meta->all_classes_composing, but that's not the worst thing ever....
Moose
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
* Yuval Kogman <nothingmuch@woobling.org> [2008-02-08T20:44:30]
> foreach my $class ( Class::Base->meta->subclasses ) {
> coerce $class from 'HashRef' => via { $class->new($_) };
>  }

Hm. What I really want is Role->meta->all_classes_composing, but that's not
the worst thing ever.  I'd rather have it work magically, but I can deal with
three lines for the sake of great justice!

--
rjbs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)

iEYEARECAAYFAketC2MACgkQHu6P14fNXHMuEwCfRxw/rd68iUcVbd0Q4Cv/rmWW
rXIAoJgN8mONAzQgCfBdLEHjU8Y+4i1w
=HhEJ
-----END PGP SIGNATURE-----
5) Ricardo SIGNES Re: dear lazyweb: method-enriched ArrayRef, etc
| +1 vote
As we discussed on IRC, this isn't quite it. We only want to affect the attribute's (read) value,...
Moose
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
* Yuval Kogman <nothingmuch@woobling.org> [2008-02-08T20:44:54]
> Moose::Autobox

As we discussed on IRC, this isn't quite it.  We only want to affect the
attribute's (read) value, and nothing else in scope.

--
rjbs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)

iEYEARECAAYFAketCoMACgkQHu6P14fNXHPvCwCeIuoGaT0sY5UjAVeOkPABkjle
aQIAnRb8qpbkIoUdNt2wqo2VrgpK7Cuv
=gSBE
-----END PGP SIGNATURE-----

spacer
Profile | Posts (1)
Home > People > Ricardo SIGNES