in reply to CGI and optgroup menus has error

CGI.pm does not export the optgroup() sub unless you ask for it e.g. by
use CGI qw/:standard/;
so you must invoke optgroup() as a method i.e.
$query->optgroup(...)
just as you have done with popup_menu().

Replies are listed 'Best First'.
Re^2: CGI and optgroup menus has error
by davidrw (Prior) on May 14, 2005 at 15:23 UTC
    Even with both of those tweaks, the "Undefined subroutine CGI::optgroup" error still occurs ... Looking in CGI.pm, there is no optgroup() sub defined .. is it supposed to be available via AUTOLOAD?

    Update: It seems to work for OP now, but I still get his original error:
    use strict; use warnings; use CGI qw/:standard/; my $q = new CGI; $q->optgroup(); __END__ Undefined subroutine CGI::optgroup at /tmp/c line 6
    Update: Yup, it's cause i was working of an old (2.752) version.
      What version of CGI are you using? Versions before 2.86 (11 Sep 2002) don't have optgroup().
Re^2: CGI and optgroup menus has error
by bradcathey (Prior) on May 14, 2005 at 15:25 UTC

    Thanks Arunbear. I must have been typing my Update when you were replying. It was good to have confirmation of my findings.


    —Brad
    "The important work of moving the world forward does not wait to be done by perfect men." George Eliot