[Catalyst-dev] Re: jshirley/jrockway
    Jonathan T. Rockway 
    jon at jrock.us
       
    Sun Jul 29 00:29:56 GMT 2007
    
    
  
> > > Earlier, Evan Carroll patched:
> > > @@ -35,9 +35,12 @@ In your app configuration (example in L<YAML>):
> > >              method:     SMTP
> > >              # mailer_args is passed directly into Email::Send
> > >              mailer_args:
> > > -                - Host:       smtp.example.com
> > > -                - username:   username
> > > -                - password:   password
> > > +                - Host
> > > +                - smtp.example.com
> > > +                - username
> > > +                - mySMPTUsername
> > > +                - password
> > > +                - mySMTPPassword
> > jrockway responded:
> >
> > Why are you doing this?
>
> 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?
Regards,
Jonathan Rockway
    
    
More information about the Catalyst-dev
mailing list