Solved // RE: Inflating and deflating

[prev] [thread] [next] [Date index for 2005/02/06]

From: Simon Wilcox
Subject: Solved // RE: Inflating and deflating
Date: 23:17 on 06 Feb 2005
On Sat, 5 Feb 2005 lists@xxxxxxxx.xxx wrote:

> > My problem is that I want to be able to call $object->email( $email )
> > with a plain text scalar and have it do the right thing.
>
> This can be accomplished with triggers, but it is somewhat complex and
> means forgoing the inflate/deflate mechanism. One approach:

I've found a solution using normalize_column_values() which seems quite
acceptable. I do this (somewhat longwindedly) in my code:

sub normalize_column_values {
    my ($self, $cols) = @_;
    return unless defined $cols->{ email };
    my $email = $cols->{ email };
    unless (ref( $email ) eq 'Mail::Address') {
        ($email) = Mail::Address->parse( $email );
        $cols->{ email } = $email;
    }
}

All test pass but can anyone see any reason why I might not want to do it
this way ?

Thanks to everyone for their help.

Simon.

Inflating and deflating
Simon Wilcox 19:19 on 05 Feb 2005

RE: Inflating and deflating
22:39 on 05 Feb 2005

Re: Inflating and deflating
Perrin Harkins 23:42 on 05 Feb 2005

Solved // RE: Inflating and deflating
Simon Wilcox 23:17 on 06 Feb 2005

RE: Inflating and deflating
Addison, Mark 11:07 on 08 Feb 2005

RE: Inflating and deflating
Perrin Harkins 16:21 on 08 Feb 2005

RE: Inflating and deflating
Addison, Mark 17:52 on 10 Feb 2005

RE: Inflating and deflating
Perrin Harkins 18:03 on 10 Feb 2005

RE: Inflating and deflating
Addison, Mark 12:40 on 14 Feb 2005

RE: Inflating and deflating
Perrin Harkins 20:19 on 14 Feb 2005

RE: Inflating and deflating
Addison, Mark 17:21 on 15 Feb 2005

Generated at 17:31 on 15 Feb 2005 by mariachi v0.52