On Thursday 01 April 2004 04:06 pm, nobu.nokada / softhome.net wrote:
> Hi,
>
> At Fri, 2 Apr 2004 03:03:58 +0900,
>
> Austin Ziegler wrote in [ruby-core:02733]:
> > >> Net::POP3.start(address, port, account, password, isapop = false) {
> > >>
> > >> |pop| ... }
> > >>
> > >> Net::POP3.start_with_ssl(address, port, account, password, certs,
> > >> verify, isapop = false) { |pop| ... }
> > >
> > > That might work.
> > > What about the case where I want a client that can do either POP or POP
> > > over SSL depending on a users input?  In the first case I just set
> > > usessl = true and pass that to #start.  In this case I have to call a
> > > whole separate method.  This seems less elegant to me.
> >
> > Perhaps a third method could be provided that could serve this dual-duty.
>
> What about:
>
>   Net::POP3.witH_ssl(certs, verify).start(address, port, account, password)
> do |pop| ...
>   end
>
> In the case you mentioned:
>
>   pop = Net::POP3.APOP($is_apop)
>   pop = pop.witH_ssl(certs, verify) if $use_ssl
>   pop.start(address, port, account, password) do |pop|
>     ...
>   end

I like this solution best, but that's still a few more lines than the way it 
is now.  I don't see why adding a few more arguments to the method is such a 
big deal.  It is totally backward compatible and in the normal non-SSL case 
users won't even know they are there.

> > Alternatively:
> >
> > Net::POP3.start(address, port, account, password, isapop = false) { |pop|
> >   pop.use_ssl(certs, verify)
> >   ...
> > }
>
> It's too late.

-- 
Daniel Hobe <daniel / nightrunner.com>
http://www.nightrunner.com