develooper Front page | perl.beginners | Postings from February 2002

Anonymous hash question

Thread Next
From:
Nikola Janceski
Date:
February 12, 2002 13:00
Subject:
Anonymous hash question
Message ID:
1449413DA482D311B67000508B5A12F50592DD33@nyexchange01.summithq.com
I am using a module function (method) that requires an anonymous hash as the
first parameter.

ie. $sender->OpenMultipart({from => $FORM{'from'}, to => $FORM{'to'}, cc =>
$FORM{'cc'},
                       subject => $FORM{'subject'} } ) || die
"$Mail::Sender::Error\n";

but sometimes $FORM{'cc'} contains nothing and the module complains about
it.

I want to be able to pass the method an anonymous hash.. can someone correct
this:
note: I have already done checking on the contents of $FORM so the values
are real (true values) or "" (false);


my %TEMP;
foreach $key ( qw( from to cc subject ) ){
	$TEMP{$key} = $FORM{$key} if $FORM{$key}
	}

$sender->OpenMultipart( { %TEMP } ) || die "$Mail::Sender::Error\n";


Nikola Janceski
Summit Systems, Inc.
212-896-3400

Prosperity doth best discover vice, but adversity doth best discover virtue.
-- Francis Bacon


----------------------------------------------------------------------------
--------------------
The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About