Re: Making CGI.pm forget

Discussion in 'Perl Misc' started by Wolf Behrenhoff, Jun 19, 2012.

  1. Am 19.06.2012 17:51, schrieb Bernie Cosell:
    > One aspect of CGI.pm that I've never liked is that it tries to 'remember'
    > form variables from one page to the next --- and worse makes it hard to
    > change a value, preferring to ignore your attempts to change the value and
    > keep the old one unless you go to some bother. I *hate* this behavior and,
    > basically, always want to build my forms exactly as I want them [and,
    > indeed, generally prefer sessions to provide continuity from one form to
    > the next rather than larding up each form].


    Hm, I don't do much CGI programming (almost none at all), but the few
    times I did it I liked this behaviour... I guess most people are using
    template systems anyway and just use CGI to read in data, not to write
    pages.

    > What I did, years ago, was this:
    >
    > $cgi = new CGI ;
    > new CGI("") ; # MAke sure the default CGI object doesn't know anything
    >
    > and it seemed to work: my intent wsa to make the 'default' CGI object be
    > truly empty, but I could still get the incoming form data via
    > $cgi->{whatever}. We're running perl 5.8.8 and have $CGI::VERSION='3.15';
    >
    > I was chasing an annoying problem with a web page I'd generated and I
    > discovered the problem. The code is:
    >
    > print h1("Program access for $progdesc") ;
    > print "<form>\n" ;
    > print hidden(prog => $prog), "\n", hidden(page => 'setacl'), "\n" ;


    Considering the documentation:
    DELETING ALL PARAMETERS:
    $query->delete_all();

    This clears the CGI object completely. It might be useful to
    ensure that all the defaults are taken when you create a
    fill-out form.

    Use Delete_all() instead if you are using the function call
    interface.


    It appears that you are using the function call interface, so have you
    tried Delete_all()?

    - Wolf
    Wolf Behrenhoff, Jun 19, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Emil Kvarnhammar

    Re: Make text boxes "forget" values

    Emil Kvarnhammar, Jul 16, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    431
    Emil Kvarnhammar
    Jul 16, 2003
  2. Ames Andreas (MPA/DF)
    Replies:
    0
    Views:
    265
    Ames Andreas (MPA/DF)
    Aug 5, 2004
  3. Xho Jingleheimerschmidt

    Re: Making CGI.pm forget

    Xho Jingleheimerschmidt, Jun 20, 2012, in forum: Perl Misc
    Replies:
    0
    Views:
    516
    Xho Jingleheimerschmidt
    Jun 20, 2012
  4. J. Strübig

    Re: Making CGI.pm forget

    J. Strübig, Jun 20, 2012, in forum: Perl Misc
    Replies:
    0
    Views:
    507
    J. Strübig
    Jun 20, 2012
  5. ccc31807

    Re: Making CGI.pm forget

    ccc31807, Jul 11, 2012, in forum: Perl Misc
    Replies:
    0
    Views:
    437
    ccc31807
    Jul 11, 2012
Loading...

Share This Page