Re: Default values for undef attributes

2011-02-15 Thread WOLfgang Schricker
Octavian Rasnita schrieb: Hi, [...] package TestMod; use Moose; has foo = (is = 'ro', isa = 'Int', default = 123); __PACKAGE__-meta-make_immutable; package main; use strict; [...] #This doesn't work because foo is undefined: my $t = TestMod-new(foo = undef); print $t-foo;

Default values for undef attributes

2011-01-29 Thread Octavian Rasnita
Hi, I want to use some attributes that get a default value when they are not sent as constructor's parameters and also when they are sent as constructor parameters but with an undef value. I have gave an example below and shown that the third way of constructing the object doesn't work

Re: Default values for undef attributes

2011-01-29 Thread Mike Raynham
On 29/01/11 07:23, Octavian Rasnita wrote: Hi, I want to use some attributes that get a default value when they are not sent as constructor's parameters and also when they are sent as constructor parameters but with an undef value. I have gave an example below and shown that the third way of

Re: Default values for undef attributes

2011-01-29 Thread Hans Dieter Pearcey
On Sat, 29 Jan 2011 09:23:45 +0200, Octavian Rasnita orasn...@gmail.com wrote: I want to use some attributes that get a default value when they are not sent as constructor's parameters and also when they are sent as constructor parameters but with an undef value. Use MooseX::UndefTolerant.

Re: Default values for undef attributes

2011-01-29 Thread Mike Raynham
On 29/01/11 13:20, Hans Dieter Pearcey wrote: On Sat, 29 Jan 2011 09:23:45 +0200, Octavian Rasnitaorasn...@gmail.com wrote: I want to use some attributes that get a default value when they are not sent as constructor's parameters and also when they are sent as constructor parameters but

Re: Default values for undef attributes

2011-01-29 Thread Octavian Rasnita
From: Hans Dieter Pearcey h...@pobox.com On Sat, 29 Jan 2011 09:23:45 +0200, Octavian Rasnita orasn...@gmail.com wrote: I want to use some attributes that get a default value when they are not sent as constructor's parameters and also when they are sent as constructor parameters but with