CGI

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

    1. Fixed two bugs that caused the -compile pragma to fail with a
       syntax error.

  Version 2.67

    1. Added XHTML support (incomplete; tags need to be lowercased).
    2. Fixed CGI/Carp when running under mod_perl. Probably broke in
       other contexts.
    3. Fixed problems when passing multiple cookies.
    4. Suppress warnings from _tableize() that were appearing when using
       -w switch with radio_group() and checkbox_group().
    5. Support for the header() -attachment argument, which can give
       pages a default file name when saving to disk.

  Version 2.66

    1. 2.65 changes in make_attributes() broke HTTP header functions
       (including redirect), so made it context sensitive.

  Version 2.65

Changes  view on Meta::CPAN

       Haworth)
    2. Fixed problem with not MSIE 3.01 for the power_mac not doing file
       uploads right.
    3. Fixed problem with file upload on IIS 4.0 when authorization in
       use.
    4. -content_type and '-content-type' can now be provided to header()
       as synonyms for -type.
    5. CGI::Carp now escapes the ampersand BEFORE escaping the > and <
       signs.
    6. Fixed "not an array reference" error when passing a hash reference
       to radio_group().
    7. Fixed non-removal of uploaded TMP files on NT platforms which
       occurs when server runs on non-C drive (thanks to Steve Kilbane
       for finding this one).

  Version 2.42

    1. Too many screams of anguish at changed behavior of url(). Is now
       back to its old behavior by default, with options to generate all
       the variants.
    2. Added regression tests. "make test" now works.

Changes  view on Meta::CPAN

   40. Takes advantage of mod_perl's register_cleanup() function to clear
       globals.
   41. <LAYER> and <ILAYER> added to :html3 functions.
   42. Fixed problems with private tempfiles and NT/IIS systems.
   43. No longer prints the DTD by default (I bet no one will complain).
   44. Allow underscores to replace internal hyphens in parameter names.
   45. CGI::Push supports heterogeneous MIME types and adjustable delays
       between pages.
   46. url_param() method added for retrieving URL parameters even when a
       fill-out form is POSTed.
   47. Got rid of warnings when radio_group() is called.
   48. Cookies now moved to their very own module.
   49. Fixed documentation bug in CGI::Fast.
   50. Added a :no_debug pragma to the import list.

  Version 2.36

    1. Expanded JavaScript functionality
    2. Preliminary support for cascading stylesheets
    3. Security fixes for file uploads:
          + Module will bail out if its temporary file already exists

Changes  view on Meta::CPAN

    8. Fixed problems with attributes in HTML shortcuts.
    9. Functions that don't actually need access to the CGI object now no
       longer generate a default one. May speed things up slightly.
   10. Aesthetic improvements in generated HTML.
   11. New examples.

  Version 2.21

    1. Added the -meta argument to start_html().
    2. Fixed hidden fields (again).
    3. Radio_group() and checkbox_group() now return an appropriate
       scalar value when called in a scalar context, rather than
       returning a numeric value!
    4. Cleaned up the formatting of form elements to avoid unesthetic
       extra spaces within the attributes.
    5. HTML elements now correctly include the closing tag when
       parameters are present but null: em('')
    6. Added password_field() to the export list.

  Version 2.20

Changes  view on Meta::CPAN

    3. Fixed bad bug in query_string() method that caused some parameters
       to be silently dropped.
    4. Robustified file upload code to handle premature termination by
       the client.
    5. Exported temporary file names on file upload.
    6. Removed spurious "uninitialized variable" warnings that appeared
       when running under 5.002.
    7. Added the Carp.pm library to the standard distribution.
    8. Fixed a number of errors in this documentation, and probably added
       a few more.
    9. Checkbox_group() and radio_group() now return the buttons as
       arrays, so that you can incorporate the individual buttons into
       specialized tables.
   10. Added the '-nolabels' option to checkbox_group() and
       radio_group(). Probably should be added to all the other
       HTML-generating routines.
   11. Added the url() method to recover the URL without the entire query
       string appended.
   12. Added request_method() to list of environment variables available.
   13. Would you believe it? Fixed hidden fields again!

  Version 2.16

    1. Fixed hidden fields yet again.
    2. Fixed subtle problems in the file upload method that caused

Changes  view on Meta::CPAN

       uninitialized variable" warnings when running with the -w switch.
    3. Added the autoEscape() method. v
    4. Added string interpolation of the CGI object.
    5. Added the ability to pass additional parameters to the <BODY> tag.
    6. Added the ability to specify the status code in the HTTP header.

  Bug fixes in version 1.55

    1. Every time self_url() was called, the parameter list would grow.
       This was a bad "feature".
    2. Documented the fact that you can pass "-" to radio_group() in
       order to prevent any button from being highlighted by default.

  Bug fixes in version 1.54

    1. The user_agent() method is now documented;
    2. A potential security hole in import() is now plugged.
    3. Changed name of import() to import_names() for compatibility with
       CGI:: modules.

  Bug fixes in version 1.53

lib/CGI.pm  view on Meta::CPAN

		div table caption th td TR Tr sup Sub strike applet Param nobr
		embed basefont style span layer ilayer font frameset frame script small big Area Map
	/ ],
	':html4' => [ qw/
		abbr acronym bdo col colgroup del fieldset iframe
		ins label legend noframes noscript object optgroup Q
		thead tbody tfoot
	/ ],
	':form'     => [ qw/
		textfield textarea filefield password_field hidden checkbox checkbox_group
		submit reset defaults radio_group popup_menu button autoEscape
		scrolling_list image_button start_form end_form
		start_multipart_form end_multipart_form isindex tmpFileName uploadInfo URL_ENCODED MULTIPART
	/ ],
	':cgi' => [ qw/
		param multi_param upload path_info path_translated request_uri url self_url script_name
		cookie Dump raw_cookie request_method query_string Accept user_agent remote_host content_type
		remote_addr referer server_name server_software server_port server_protocol virtual_port
		virtual_host remote_ident auth_type http append save_parameters restore_parameters param_fetch
		remote_user user_name header redirect import_names put Delete Delete_all url_param cgi_error env_query_string
	/ ],

lib/CGI.pm  view on Meta::CPAN

	for ($column=0;$column<$columns;$column++) {
	    $result .= "<td>" . $elements[$column*$rows + $row] . "</td>"
		if defined($elements[$column*$rows + $row]);
	}
	$result .= "</tr>";
    }
    $result .= "</table>";
    return $result;
}

#### Method: radio_group
# Create a list of logically-linked radio buttons.
# Parameters:
#   $name -> Common name for all the buttons.
#   $values -> A pointer to a regular array containing the
#             values for each button in the group.
#   $default -> (optional) Value of the button to turn on by default.  Pass '-'
#               to turn _nothing_ on.
#   $linebreak -> (optional) Set to true to place linebreaks
#             between the buttons.
#   $labels -> (optional)
#             A pointer to a hash of labels to print next to each checkbox
#             in the form $label{'value'}="Long explanatory label".
#             Otherwise the provided values are used as the labels.
# Returns:
#   An ARRAY containing a series of <input type="radio"> fields
####
sub radio_group {
    my($self,@p) = self_or_default(@_);
   $self->_box_group('radio',@p);
}

#### Method: checkbox_group
# Create a list of logically-linked checkboxes.
# Parameters:
#   $name -> Common name for all the check boxes
#   $values -> A pointer to a regular array containing the
#             values for each checkbox in the group.

lib/CGI/HTML/Functions.pod  view on Meta::CPAN

used.

=back

The value of the checkbox can be retrieved using:

    $turned_on = param('checkbox_name');

=head2 Creating a radio button group

   print radio_group(-name=>'group_name',
			     -values=>['eenie','meenie','minie'],
			     -default=>'meenie',
			     -linebreak=>'true',
           -labels=>\%labels,
           -attributes=>\%attributes);

	-or-

   print radio_group('group_name',['eenie','meenie','minie'],
            'meenie','true',\%labels,\%attributes);


   HTML3-COMPATIBLE BROWSERS ONLY:

   print radio_group(-name=>'group_name',
			     -values=>['eenie','meenie','minie','moe'],
			     -rows=2,-columns=>2);

radio_group() creates a set of logically-related radio buttons
(turning one member of the group on turns the others off)

B<Parameters:>

=over 4

=item 1.

The first argument is the name of the group and is required (-name).

lib/CGI/HTML/Functions.pod  view on Meta::CPAN

=item 5.

The optional fifth parameter (-labels) is a pointer to an associative
array relating the radio button values to user-visible labels to be
used in the display.  If not provided, the values themselves are
displayed.

=back

All modern browsers can take advantage of the optional parameters
B<-rows>, and B<-columns>.  These parameters cause radio_group() to
return an HTML3 compatible table containing the radio group formatted
with the specified number of rows and columns.  You can provide just
the -columns parameter if you wish; radio_group will calculate the
correct number of rows for you.

To include row and column headings in the returned table, you
can use the B<-rowheaders> and B<-colheaders> parameters.  Both
of these accept a pointer to an array of headings to use.
The headings are just decorative.  They don't reorganize the
interpretation of the radio buttons -- they're still a single named
unit.

The optional B<-tabindex> argument can be used to control the order in which

lib/CGI/HTML/Functions.pod  view on Meta::CPAN

value.

The optional B<-labelattributes> argument will contain attributes
attached to the <label> element that surrounds each button.

When the form is processed, the selected radio button can
be retrieved using:

      $which_radio_button = param('group_name');

The value returned by radio_group() is actually an array of button
elements.  You can capture them and use them within tables, lists,
or in other creative ways:

    @h = radio_group(-name=>'group_name',-values=>\@values);
    &use_in_creative_way(@h);

=head2 Creating a submit button 

   print submit(-name=>'button_name',
			-value=>'value');

	-or-

   print submit('button_name','value');

t/autoescape.t  view on Meta::CPAN

#!perl

use strict;
use warnings;

use Test::More tests => 18;

use CGI qw/ autoEscape escapeHTML button textfield password_field textarea popup_menu scrolling_list checkbox_group optgroup checkbox radio_group submit image_button button /;

is (button(-name => 'test<'), '<input type="button"  name="test&lt;" value="test&lt;" />', "autoEscape defaults to On");

my $before = escapeHTML("test<");
autoEscape(undef);
my $after = escapeHTML("test<");


is($before, "test&lt;", "reality check escapeHTML");

t/autoescape.t  view on Meta::CPAN

changed")',
-checked=>1,
-value=>'ON',
-label=>'CLICK ME'
),
qq{<label><input type="checkbox" name="checkbox_name" value="ON" checked="checked" onchange="alert("===> single checkbox
changed")" onclick="alert("===> single checkbox")" />CLICK ME</label>},
'autoescape javascript turns off for checkbox'
);

is(radio_group(
{
name=>'group_name',
onclick => 'alert("===> radio group")',
values=>['eenie','meenie','minie','moe'],
rows=>2,
columns=>2,
}
),
qq{<table><tr><td><label><input type="radio" name="group_name" value="eenie" checked="checked" onclick="alert("===> radio group")" />eenie</label></td><td><label><input type="radio" name="group_name" value="minie" onclick="alert("===> radio group")" ...
'autoescape javascript turns off for radio group'

t/form.t  view on Meta::CPAN

	    -override => 1),
   qq(<label><input type="checkbox" name="weather" value="nice" tabindex="9" checked="checked" />forecast</label>),
   "checkbox()");

is(checkbox(-name  => 'weather',
	    -value => 'dull',
	    -label => 'forecast'),
   qq(<label><input type="checkbox" name="weather" value="dull" tabindex="10" checked="checked" />forecast</label>),
   "checkbox()");

is(radio_group(-name => 'game'),
   qq(<label><input type="radio" name="game" value="chess" checked="checked" tabindex="11" />chess</label> <label><input type="radio" name="game" value="checkers" tabindex="12" />checkers</label>),
   'radio_group()');

is(radio_group(-name   => 'game',
	       -labels => {'chess' => 'ping pong'}),
   qq(<label><input type="radio" name="game" value="chess" checked="checked" tabindex="13" />ping pong</label> <label><input type="radio" name="game" value="checkers" tabindex="14" />checkers</label>),
   'radio_group()');

is(checkbox_group(-name   => 'game',
		  -Values => [qw/checkers chess cribbage/]),
   qq(<label><input type="checkbox" name="game" value="checkers" checked="checked" tabindex="15" />checkers</label> <label><input type="checkbox" name="game" value="chess" checked="checked" tabindex="16" />chess</label> <label><input type="checkbox" ...
   'checkbox_group()');

is(checkbox_group(-name       => 'game',
		  '-values'   => [qw/checkers chess cribbage/],
		  '-defaults' => ['cribbage'],
		  -override=>1),

t/no_tabindex.t  view on Meta::CPAN

	    -override => 1),
   qq(<label><input type="checkbox" name="weather" value="nice" checked="checked" />forecast</label>),
   "checkbox()");

is(checkbox(-name  => 'weather',
	    -value => 'dull',
	    -label => 'forecast'),
   qq(<label><input type="checkbox" name="weather" value="dull" checked="checked" />forecast</label>),
   "checkbox()");

is(radio_group(-name => 'game'),
   qq(<label><input type="radio" name="game" value="chess" checked="checked" />chess</label> <label><input type="radio" name="game" value="checkers" />checkers</label>),
   'radio_group()');

is(radio_group(-name   => 'game',
	       -labels => {'chess' => 'ping pong'}),
   qq(<label><input type="radio" name="game" value="chess" checked="checked" />ping pong</label> <label><input type="radio" name="game" value="checkers" />checkers</label>),
   'radio_group()');

is(checkbox_group(-name   => 'game',
		  -Values => [qw/checkers chess cribbage/]),
   qq(<label><input type="checkbox" name="game" value="checkers" checked="checked" />checkers</label> <label><input type="checkbox" name="game" value="chess" checked="checked" />chess</label> <label><input type="checkbox" name="game" value="cribbage"...
   'checkbox_group()');

is(checkbox_group(-name       => 'game',
		  '-values'   => [qw/checkers chess cribbage/],
		  '-defaults' => ['cribbage'],
		  -override=>1),



( run in 0.534 second using v1.01-cache-2.11-cpan-d7f47b0818f )