Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Printing BigInts

by ahunter (Monk)
on Jul 12, 2000 at 18:56 UTC ( #22205=note: print w/ replies, xml ) Need Help??


in reply to Printing BigInts

Math::BigInt returns references to blessed scalars, and uses overload to cause it to be stringified when you refer to it in a string. You put the reference directly into the argument block used by CGI::Cookie, and CGI::Cookie doesn't know what to do with it. Simple solution: force it to be stringified:

$c = new CGI::Cookie(-name => 'NetAppliance1.0', -value => "$id", -path => '/cgi-bin/' -secure => 0 );
Data::Dumper is often your friend in these circumstances:
use Data::Dumper; print Dumper({-value => $id});
produces:
$VAR1 = { '-value' => bless(do {\(my $o= '+123456789123456789')}, 'Mat +h::BigInt') };
Which is a good indication that things are not as you thought :-)

Andrew. (You should really be using CGI.pm throughout)


Comment on Re: Printing BigInts
Select or Download Code
Replies are listed 'Best First'.
RE: Re: Printing BigInts
by Anonymous Monk on Jul 12, 2000 at 21:17 UTC
    what do you mean by CGI.pm throughout? I did this :
    use CGI qw/:standard/; use CGI::Cookie;
      I think he means: print header(-cookie => $c);
      instead of your two print lines. Let CGI.pm take care of the gory details for you!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://22205]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2015-07-31 04:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (274 votes), past polls