in reply to (jeffa) Re: CGI.pm error
in thread CGI.pm error

OK. I'm sorry.

Replies are listed 'Best First'.
(jeffa) 3Re: CGI.pm error
by jeffa (Bishop) on Jul 11, 2003 at 17:03 UTC
    It's ok. You don't have to be sorry, this whole business just isn't very nice to newbies, but there is a reason for it. Here is some cookie code that i wrote about a year ago. Maybe it will help you get a feel for what you need to do.
    use strict; use warnings; use CGI qw(:standard); use CGI::Cookie; my @views = qw(first second third fourth fifth sixth seventh eighth); my %cookies = CGI::Cookie->fetch(); my $x = (defined $cookies{'cookie_i'}) ? $cookies{'cookie_i'}->value() : 0 ; my $view = $views[$x++]; my $cookie = CGI::Cookie->new(-name=>'cookie_i',-value=>$x % @views); print header(-cookie=>$cookie), start_html('session'), h1($view), start_form, submit, end_form, end_html ;
    Just name it foo.cgi or something and run it from a browser that accepts cookies. Hope this helps. :)

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)
    
      I have the same problem.

      Sat Jul 12 10:38:59 2003 (eval 1): Array found where
      operator expected at (eval 1) line 1, at end of line
      Sat Jul 12 10:38:59 2003 (eval 1): (Do you need to
      predeclare Carp::longmess?) Sat Jul 12 10:38:59 2003
      (eval 1): Array found where operator expected at (eval 1)
      line 2, at end of line Sat Jul 12 10:38:59 2003
      (eval 1): (Do you need to predeclare Carp::shortmess?)
      Sat Jul 12 10:38:59 2003 (eval 1): Array found where
      operator expected at (eval 1) line 3, at end of line
      Sat Jul 12 10:38:59 2003 (eval 1): (Do you need to
      predeclare Carp::shortmess?) Sat Jul 12 10:38:59 2003
      (eval 1): Array found where operator expected at (eval 1)
      line 4, at end of line Sat Jul 12 10:38:59 2003 (eval 1)
      : (Do you need to predeclare Carp::longmess?) Undefined
      subroutine &Carp::longmess called at Carp.pm line 296.


      My system: Windows xp with sambar 5.2

      Please tell me how to work with "Set-Cookie: ", not with CGI.pm :(
      (i work with cookie some 1 month). I want to build a shopping cart
      and login-logout system with cookie. Please tell me were i find the
      complet tutorials about the "Set-Cookie: "? I see the cookie.lib
      (by Matt Wright) but i want to build my self and i want to sell my work ;) .
      Please help me.
        You want to build a shopping cart system and sell it, though you barely understand the basics? I pity your customers.
        Sorry, but i refuse to help someone write an insecure shopping cart. Why won't you use CGI.pm? You have no good reason you know. But MU on CGI.pm ... a full-blown shopping cart system (you are going to store credit card numbers?!?!) should be produced with a full-blown app server. I recommend OpenInteract. If that is too hard to work with ... then maybe you shouldn't be doing this in the first place. It's one thing to shoot your own foot off, but it's quite another to shoot everyone's foot off whose credit card number you allowed some cracker to steal.

        jeffa

        L-LL-L--L-LL-L--L-LL-L--
        -R--R-RR-R--R-RR-R--R-RR
        B--B--B--B--B--B--B--B--
        H---H---H---H---H---H---
        (the triplet paradiddle with high-hat)