Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^7: Tim O'Reilly on Perl

by holli (Abbot)
on Jul 17, 2005 at 18:41 UTC ( [id://475603]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re^6: Tim O'Reilly on Perl
in thread Tim O'Reilly on Perl

Yeah. The problem with them is one can't check the value before it is set. I would like to have something like
sub foo : get { my $self = shift; return $self->{_foo}; } sub foo : set { my $self = shift; my $value = shift; die "foo is a integer field!\n" unless $value =~ /[+-]?[0-9]+/; $self->{_foo} = $value; }


holli, /regexed monk/

Replies are listed 'Best First'.
Re^8: Tim O'Reilly on Perl
by Zaxo (Archbishop) on Jul 17, 2005 at 19:12 UTC
    The problem with them is one can't check the value before it is set.

    Oh, but you can. I addressed that in To Validate Data In Lvalue Subs. The Constrained package from that node turned out to have lots of other uses, too. It's now called Tie::Constrained on CPAN.

    After Compline,
    Zaxo

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://475603]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.