[tpm] dereferencing arrays

Drew Sullivan drew at ss.org
Fri Jun 27 07:33:11 PDT 2008


Since $host = shift line require a "Scalar" then you need:

$host_list = ['1.2.3.4', '2.3.4.5'];  # host_list is a ref to an array
######## NOT A LIST but a pointer to a LIST ######
now pass $host_list rather than @list.

On Fri, 2008-06-27 at 10:26 -0400, Emil Janev wrote:
> Hi Fulko,
> 
> Most probably you are thinking right but typing wrong :)
> 
> Why don't you try:
> 
> @list = ('1.2.3.4', '2.3.4.5');
> 
> instead of
> 
> @list = ['1.2.3.4', '2.3.4.5'];
> 
> Regards,
> Emil
> 
> 
> On Fri, Jun 27, 2008 at 10:19 AM, Fulko Hew <fulko.hew at gmail.com> wrote:
> > I'm brain dead today, because I can't get this to work...
> >
> > Net::SMTP...
> >
> > My problem is that Net::SMTP takes an argument for the destination
> > host to send mail to.  In some cases that destination FQDN resolves
> > into a list of actual IP addresses.  Net::SMTP isn't smart enough to
> > resolve that name and traverse that list itself.  So...  I build by own list
> > and pass it in (the docs says I can).  My trouble is that I'm not
> > doing it right.
> >
> > The routine that gets called in the end looks like this:
> >
> > my $host = shift;
> > foreach $h (@{$host}) { ... }
> >
> > So the docs say pass in a reference to an array (containing the list)
> >
> > @list = ['1.2.3.4', '2.3.4.5'];
> > Net::SMTP->new(\@list, ...);
> >
> > This causes the receiving end to think it has one entity which is the
> > reference to the array.
> >
> > What am I missing?
> >
> > TIA
> > Fulko
> >
> >
> >
> > _______________________________________________
> > toronto-pm mailing list
> > toronto-pm at pm.org
> > http://mail.pm.org/mailman/listinfo/toronto-pm
> >
> >
> 
> 
> 



More information about the toronto-pm mailing list