"A Taylor" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello again,
> I have a problem with cookies; I can retreive cookies i have set, but if I
> try to retreive a cookie that hasnt yet been set i get the following
error:
>
> Can't call method "value" on an undefined value at viewcart.pl line 55.
>
> I am trying to get my cookie using: $ID = $newcook{'usrID'}->value; which
> works fine unless this cookie hasnt been set. This is all part of a
shopping
> cart and that the reason why the possibility arises that someone may veiw
> their empty cart and therefore no cookie will have been created.
>
> Anyway, my question is: how do I test to see if a coockie exists b 4 i try
> to read it ???
>

If ( UNIVERSAL::can( $newcook{'usrID'} => 'value' ) ) {
  # ...
}

Todd W.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to