in reply to What is this Moose mojo?

When you write
has fif => ( is => 'rw' );
Moose creates: When you write
has fif => ( is => 'rw', reader => '_fif' );
,Moose creates:When you subsequently write
sub fif { ...... }
you are creating another method, that has nothing to do with the others. But, as convention in perl is that _methods beginning with an underscore are private, people will call the $self->fif method to read the attribute so they won't see the value unless the password thing is true. Silly, not great security, but that is that.
[]s, HTH, Massa (κς,πμ,πλ)

Replies are listed 'Best First'.
Re^2: What is this Moose mojo?
by zwon (Abbot) on Feb 05, 2009 at 00:13 UTC

    If so, does it work at all?

    use strict; use warnings; { package TTT; use Moose; has fif => ( is => 'rw', reader => '_fif' ); sub fif { my $self = shift; 33; } } my $m = TTT->new(); $m->fif(42); print $m->fif, "\n"; 1; __END__ 42

    Update: but s/reader/accessor/ and it would work.

Re^2: What is this Moose mojo?
by zby (Vicar) on Feb 05, 2009 at 09:40 UTC
    Nice explanation. Just one addition - the goal of this is that the field is not re-filled in a form that is re-displayed - that is: the user fills up a form and submits it, there is an error in his input - so the form is redisplayed with the values filled in by the user (plus the mark for the error), but the usual approach is that the password fields are not re-filled. I don't know if that is silly security - but it is rather standard procedure.