CGI-Ex

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

    ->make_form

      Takes a hash and returns a query_string. A second optional argument
      may contain an arrayref of keys to use from the hash in building the
      query_string. First argument is undef, it will use the form stored in
      itself as the hash.

    ->content_type

      Can be called multiple times during the same session. Will only print
      content-type once. (Useful if you don't know if something else
      already printed content-type). Calling this sends the Content-type
      header. Trying to print ->content_type is an error. For clarity, the
      method ->print_content_type is available.

          $cgix->print_content_type;
      
          # OR
          $cgix->print_content_type('text/html');
      
          # OR
          $cgix->print_content_type('text/html', 'utf-8');

    ->set_cookie

      Arguments are the same as those to CGI->new->cookie({}). Uses CGI's
      cookie method to create a cookie, but then, depending on if content
      has already been sent to the browser will either print a Set-cookie
      header, or will add a <meta http-equiv='set-cookie'> tag (this is
      supported on most major browsers). This is useful if you don't know
      if something else already printed content-type.

    ->location_bounce

      Depending on if content has already been sent to the browser will
      either print a Location header, or will add a <meta
      http-equiv='refresh'> tag (this is supported on all major browsers).
      This is useful if you don't know if something else already printed
      content-type. Takes single argument of a url.

    ->last_modified

      Depending on if content has already been sent to the browser will
      either print a Last-Modified header, or will add a <meta
      http-equiv='Last-Modified'> tag (this is supported on most major
      browsers). This is useful if you don't know if something else already
      printed content-type. Takes an argument of either a time (may be a
      CGI -expires style time) or a filename.

    ->expires

      Depending on if content has already been sent to the browser will
      either print a Expires header, or will add a <meta
      http-equiv='Expires'> tag (this is supported on most major browsers).
      This is useful if you don't know if something else already printed
      content-type. Takes an argument of a time (may be a CGI -expires
      style time).

    ->send_status

      Send a custom status. Works in both CGI and mod_perl. Arguments are a
      status code and the content (optional).

    ->send_header

      Send a http header. Works in both CGI and mod_perl. Arguments are a

lib/CGI/Ex.pm  view on Meta::CPAN

=item C<-E<gt>make_form>

Takes a hash and returns a query_string.  A second optional argument
may contain an arrayref of keys to use from the hash in building the
query_string.  First argument is undef, it will use the form stored
in itself as the hash.

=item C<-E<gt>content_type>

Can be called multiple times during the same session.  Will only
print content-type once.  (Useful if you don't know if something
else already printed content-type).  Calling this sends the Content-type
header.  Trying to print -E<gt>content_type is an error.  For clarity,
the method -E<gt>print_content_type is available.

    $cgix->print_content_type;

    # OR
    $cgix->print_content_type('text/html');

    # OR
    $cgix->print_content_type('text/html', 'utf-8');

=item C<-E<gt>set_cookie>

Arguments are the same as those to CGI->new->cookie({}).
Uses CGI's cookie method to create a cookie, but then, depending on
if content has already been sent to the browser will either print
a Set-cookie header, or will add a <meta http-equiv='set-cookie'>
tag (this is supported on most major browsers).  This is useful if
you don't know if something else already printed content-type.

=item C<-E<gt>location_bounce>

Depending on if content has already been sent to the browser will either print
a Location header, or will add a <meta http-equiv='refresh'>
tag (this is supported on all major browsers).  This is useful if
you don't know if something else already printed content-type.  Takes
single argument of a url.

=item C<-E<gt>last_modified>

Depending on if content has already been sent to the browser will either print
a Last-Modified header, or will add a <meta http-equiv='Last-Modified'>
tag (this is supported on most major browsers).  This is useful if
you don't know if something else already printed content-type.  Takes an
argument of either a time (may be a CGI -expires style time) or a filename.

=item C<-E<gt>expires>

Depending on if content has already been sent to the browser will either print
a Expires header, or will add a <meta http-equiv='Expires'>
tag (this is supported on most major browsers).  This is useful if
you don't know if something else already printed content-type.  Takes an
argument of a time (may be a CGI -expires style time).

=item C<-E<gt>send_status>

Send a custom status.  Works in both CGI and mod_perl.  Arguments are
a status code and the content (optional).

=item C<-E<gt>send_header>

Send a http header.  Works in both CGI and mod_perl.  Arguments are

lib/CGI/Ex/App.pod  view on Meta::CPAN


Often in your program you will want to set cookies or bounce to a differnt URL.
This can be done using either the builtin CGI::Ex object or the built in
CGI object.  It is suggested that you only use the CGI::Ex methods as it will
automatically send headers and method calls under cgi, mod_perl1, or mod_perl2.
The following shows how to do basic items using the CGI::Ex object returned by
the ->cgix method.

=over 4

=item printing content-type headers

    ### CGI::Ex::App prints headers for you,
    ### but if you are printing custom types, you can send your own
    $self->cgix->print_content_type;
    # SAME AS
    # $self->cgix->print_content_type('text/html');

=item setting a cookie

    $self->cgix->set_cookie({



( run in 2.095 seconds using v1.01-cache-2.11-cpan-524268b4103 )