[Catalyst-dev] Re: jshirley/jrockway

Matt S Trout dbix-class at trout.me.uk
Sun Jul 29 13:08:32 GMT 2007


On Sat, Jul 28, 2007 at 06:29:56PM -0500, Jonathan T. Rockway wrote:
> > Because Email::Send does not take an Array of HashRefs it just takes
> > an Array. And this is a wrapper around Email::Send and pod and code
> > says these are ->{mailer_args}
> 
> Good catch... but what you really want is:
> 
>      # mailer_args is passed directly into Email::Send
>      mailer_args:
>          Host:       smtp.example.com
>          username:   username
>          password:   password
> 
> That's both readable and flattens to:
> 
>     - Host
>     - smtp.example.com
>     - ...
> 
> V::Email needs to flatten the hashref that YAML gives it:
> 
>     my $hashref = $config->{mailer_args};
>     whatever_func(%$hashref);
> 
> But it would need to do that with your config syntax too:
>  
>     my $arrayref = $config->{mailer_args};
>     whatever_func(@$array_ref); # same as above except for pair ordering
>    
> I think the hashref-based method is much cleaner than your proposed
> solution.  Any thoughts, jshirley?

I think V::Email should flatten an arrayref -or- hashref but that the
hashref example is much clearer and more likely to be what people are likely
to use - arrayref support should be mentioned but the example need not be
headline or, indeed, necessarily present at all.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director    Want a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/             http://www.shadowcatsystems.co.uk/ 



More information about the Catalyst-dev mailing list