On Thu, Nov 26, 2009 at 10:46 AM, Ovid publiustemp-catal...@yahoo.com wrote:
I have two attributes, 'xml' and 'xml_file' for an object. One or the other
must be supplied, but not both.
Must I validated this in BUILD or is there another way of doing this?
Well, I would use a trigger and
Nope, BUILD is where you want to do this.
Would make a nice MooseX:: though :)
- Stevan
On Nov 26, 2009, at 11:46 AM, Ovid wrote:
I have two attributes, 'xml' and 'xml_file' for an object. One or
the other must be supplied, but not both.
Must I validated this in BUILD or is there another
Yes - I often need user, pass and dsn strings for a DBI connection or a DBI::db
object. What would be the best pattern to deal with such cases if one were to
generalise it?
On 27/11/2009, at 06:05 AM, Stevan Little wrote:
Nope, BUILD is where you want to do this.
Would make a nice MooseX::
Dan Horne wrote:
Yes - I often need user, pass and dsn strings for a DBI connection or a DBI::db
object. What would be the best pattern to deal with such cases if one were to
generalise it?
I often take care of this using type coercion:
package Object;
use Moose;
use
Dan Horne wrote:
Yes - I often need user, pass and dsn strings for a DBI connection or a
DBI::db object. What would be the best pattern to deal with such cases if one
were to generalise it?
If you want to generalize the connection info for a database, the best way to do
it is just use a
Jeffrey++
Ah yes, I always forget about the coercion too. I do this sometimes as
well, the only issue being that you sometimes want to still have
access to the original information, etc. Which in some cases you can
just do via delegation on the constructed object.
- Stevan
On Nov 26,