view release on metacpan or search on metacpan
lib/CGI/Application/Plugin/Header.pm view on Meta::CPAN
You can also define your C<header> class which inherits from C<CGI::Header>.
For example,
package MyApp::Header;
use parent 'CGI::Header';
use CGI::Cookie;
sub cookies {
my $self = shift;
my $cookies = $self->header->{cookies} ||= [];
return $cookies unless @_;
if ( ref $_[0] eq 'HASH' ) {
push @$cookies, map { CGI::Cookie->new($_) } @_;
}
else {
push @$cookies, CGI::Cookie->new( @_ );
}
$self;
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/02-check_output.t view on Meta::CPAN
my $output = $testapp->run();
# $output should have the session setup w/ a cookie
# Get the ID # to establish the session in a second request
my $test_name = 'session cookie was setup';
like( $output, qr/Set-Cookie: CGISESSID=\w+/, $test_name );
$output =~ /Set-Cookie: CGISESSID=(\w+);/;
my $session_id = $1;
$test_name = "got the session id ($session_id)";
ok( $session_id, $test_name );
$test_name = "message isn't in output";
view all matches for this distribution
view release on metacpan or search on metacpan
t/02.publish_csrf_ticket.t view on Meta::CPAN
my $app = CSRFApp::PublishCSRFTicket->new;
my $output = $app->run;
like($output, qr/<input type="hidden" name="_csrf_id" value="([a-z0-9]{40})" \/>/, "publish csrf ticket id");
my($cookie) = $output =~ /Set\-Cookie:\s+(CGISESSID=[a-z0-9]+;\s+path=\/)/;
open FILE, ">", "/tmp/cap-protect-csrf-test" or die $!;
print FILE join "\t", $app->csrf_id, $cookie;
close FILE;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CGI/Application/Plugin/Session.pm view on Meta::CPAN
## check cookie option -name with session name
## if different these may cause problems/confusion
if ( exists $options{'-name'} and
$options{'-name'} ne $self->session->name ) {
warn sprintf( "Cookie '%s' and Session '%s' name don't match.\n",
$options{'-name'}, $self->session->name )
}
## setup the values for cookie
$options{'-name'} ||= $self->session->name;
lib/CGI/Application/Plugin/Session.pm view on Meta::CPAN
my @keep;
my %headers = $self->header_props;
my $cookies = $headers{'-cookie'} || [];
$cookies = [$cookies] unless ref $cookies eq 'ARRAY';
foreach my $cookie (@$cookies) {
if ( ref($cookie) ne 'CGI::Cookie' || $cookie->name ne $session->name ) {
# keep this cookie
push @keep, $cookie;
}
}
push @keep, $newcookie;
lib/CGI/Application/Plugin/Session.pm view on Meta::CPAN
This allows you to customize the options that are used when creating the session cookie.
For example you could provide an expiry time for the cookie by passing -expiry => '+24h'.
The -name and -value parameters for the cookie will be added automatically unless
you specifically override them by providing -name and/or -value parameters.
See the L<CGI::Cookie> docs for the exact syntax of the parameters.
NOTE: You can do the following to get both the cookie name and the internal name of the CGI::Session object to be changed:
$self->session_config(
CGI_SESSION_OPTIONS => [
view all matches for this distribution
view release on metacpan or search on metacpan
t/01_cgiapp.t view on Meta::CPAN
# Test 7: run() CGI::Application::Plus sub-class, in run-mode 'cookie_test'. Expect HTTP header w/ cookie 'c_name' => 'c_value' + 'Hello World: cookie_test'.
{
my $t7_ta_obj = TestApp->new();
$t7_ta_obj->query(CGI->new({'test_rm' => 'cookie_test'}));
my $t7_output = $t7_ta_obj->run();
ok (($t7_output =~ /^Set-Cookie\:\ c\_name\=c\_value/) && ($t7_output =~ /Hello\ World\:\ cookie\_test/))
}
; SKIP:
{ skip("HTML::Template is not installed", 3 )
unless eval
{ require HTML::Template
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CGI/Auth/Auto.pm view on Meta::CPAN
my $auth = new CGI::Auth::Auto({ -logintmplpath => '/home/myself/public_html/templates' });
=head1 SEE ALSO
CGI::Auth, CGI::Cookie, HTML::Template
=head1 CONTRIBUTIONS
Dulaunoy Fabrice
view all matches for this distribution
view release on metacpan or search on metacpan
AuthRegister.pm view on Meta::CPAN
$SiteId = $SiteName = $base;
if (-r 'configuration.pl') { package main; require 'configuration.pl'; }
}
########################################################################
# Section: HTTPS Connection and Cookies Management
# Check that the connection is HTTPS and if not, redirect to HTTPS.
# It must be done before script produces any output.
sub require_https {
if ($ENV{'HTTPS'} ne 'on') {
AuthRegister.pm view on Meta::CPAN
=item [CGI::Auth::Auto]
Similar to CGI::Auth.
=item [Apache::AuthCookie]
Relies on the Apache web server; not very flexible.
=item [CGI::Session]
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CGI/Authen/Simple.pm view on Meta::CPAN
package CGI::Authen::Simple;
use strict;
use CGI;
use CGI::Cookie;
use Template;
=head1 NAME
CGI::Authen::Simple - Simple cookie-driven unsessioned form-based authentication
lib/CGI/Authen/Simple.pm view on Meta::CPAN
my $self = shift;
my $to_return = 1;
if(!$self->{'logged_in'})
{
my (%cookie) = fetch CGI::Cookie;
foreach ( qw(userid username password) )
{
if(!exists($cookie{$_}) || $cookie{$_}->value eq '')
{
lib/CGI/Authen/Simple.pm view on Meta::CPAN
. $self->{'USERNAME'} . ' = ? AND ' . $wph,
undef, $username, $password);
if($profile)
{
my $username_cookie = new CGI::Cookie( -name=> 'username', -value => $profile->{'username'} );
my $password_cookie = new CGI::Cookie( -name=> 'password', -value => $profile->{'password'} );
my $userid_cookie = new CGI::Cookie( -name=> 'userid', -value => $profile->{'id'} );
print qq!Set-Cookie: $username_cookie\nSet-Cookie: $password_cookie\nSet-Cookie: $userid_cookie\n!;
$self->{'logged_in'} = 1;
$self->{'profile'} = $profile;
}
else
{
lib/CGI/Authen/Simple.pm view on Meta::CPAN
- needs to work with any DB software (since it just takes a DBH, maybe use SQL::Abstract to generate a
cross DB compatible query.
=head1 SEE ALSO
CGI::Cookie, CGI, Template
=head1 AUTHOR
Shane Allen E<lt>opiate@gmail.comE<gt>
view all matches for this distribution
view release on metacpan or search on metacpan
t/01_cgiapp.t view on Meta::CPAN
# Test 7: run() CGI::Application::Plus sub-class, in run-mode 'cookie_test'. Expect HTTP header w/ cookie 'c_name' => 'c_value' + 'Hello World: cookie_test'.
{
my $t7_ta_obj = TestApp->new();
$t7_ta_obj->query(CGI->new({'test_rm' => 'cookie_test'}));
my $t7_output = $t7_ta_obj->run();
ok (($t7_output =~ /^Set-Cookie\:\ c\_name\=c\_value/) && ($t7_output =~ /Hello\ World\:\ cookie\_test/))
}
; SKIP:
{ skip("HTML::Template is not installed", 3 )
unless eval
{ require HTML::Template
view all matches for this distribution
view release on metacpan or search on metacpan
t/02_features.t view on Meta::CPAN
{
# session new
; my $ap1 = Test1->new( )
; $SID = $ap1->cs->id
; my $o1 = $ap1->capture('process')
; ok($$o1 =~ /Set-Cookie\: CGISESSID=$SID/)
}
{
# session new with other cookie
; my $ap3 = Test2->new()
; my $SID2 = $ap3->cs->id
; my $o3 = $ap3->capture('process')
; ok( ($$o3 =~ /Set-Cookie\: CGISESSID=$SID2/)
&& ($$o3 =~ /Set-Cookie\: control=control/)
)
}
{
# session not new
; my $ap2 = Test2->new(cgi => CGI->new( {CGISESSID => $SID} ) )
; my $o2 = $ap2->capture('process')
; ok( ($$o2 !~ /Set-Cookie\: CGISESSID=/)
&& ($$o2 =~ /Set-Cookie\: control=control/)
)
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CGI/Bus/uauth.pm view on Meta::CPAN
$s->print->htpgstart(undef,$s->parent->{-htpnstart});
$s->print->h1($s->lng(0,'Authentication'));
$s->print('<table><tr>');
$s->print->th($ha,$s->lng(0,'UserName')) ->td($ha,$s->htmlescape($s->parent->user))->text('</tr><tr>');
$s->print->th($ha,$s->lng(0,'OriginalName'))->td($ha,$s->htmlescape($s->parent->useron))->text('</tr><tr>');
$s->print->th($ha,$s->lng(0,'Cookie')) ->td($ha,$s->htmlescape(join(', ',$s->cookie($cooknme))))->text('</tr><tr>');
$s->print->th($ha,$s->lng(0,'Return')) ->td($ha,$g->a({href=>$back}, $s->htmlescape($back)))->text('</tr><tr>');
$s->print('</tr></table>');
$s->print->htpgend;
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/04_partial.t view on Meta::CPAN
use CGI::Capture ();
my $capture_string = <<'END_YAML';
---
CAPTURE_TIME: 1
STDIN: "GET http://foo.com/bar.html?foo=bar\nCookie: foo=bar\nMIME-VERSION: 1.0\n\n"
ENV:
REQUEST_METHOD: POST
CONTENT_TYPE: multipart/form-data
END_YAML
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CGI/Carp/Fatals.pm view on Meta::CPAN
If you wish to enhance ("juice") those error messages, you can import a function
called 'fatalsRemix'. It will append perlinfo data to the error reports.
This function accepts the same options as the perlinfo function from L<HTML::Perlinfo>.
By default, fatalsRemix uses the INFO_VARIABLES option which shows you all predefined variables
from EGPCS (Environment, GET, POST, Cookie, Server).
Please see the L<HTML::Perlinfo> docs for further options and details.
use CGI::Carp::Fatals qw(fatalsRemix);
fatalsRemix(); # defaults to INFO_VARIABLES
fatalsRemix('INFO_GENERAL'); # now includes INFO_GENERAL. There are many other options.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CGI/Compile.pm view on Meta::CPAN
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=head1 SEE ALSO
L<ModPerl::RegistryCooker> L<CGI::Emulate::PSGI>
=cut
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CGI/Compress/Gzip.pm view on Meta::CPAN
# Using unkeyed version of arguments - convert to the keyed version
# arg order comes from the header() function in CGI.pm
my @flags = qw(
Content_Type Status Cookie Target Expires
NPH Charset Attachment P3P
);
for my $i (0 .. $#{$header})
{
if ($i < @flags)
lib/CGI/Compress/Gzip.pm view on Meta::CPAN
break. For example:
# BROKEN CODE
use CGI::Compress::Gzip;
my $q = CGI::Compress::Gzip->new;
print "Set-Cookie: foo=bar\n" . $q->header;
print "Hello, world\n";
# WORKAROUND 1 (preferred)
use CGI::Compress::Gzip;
my $q = CGI::Compress::Gzip->new;
print $q->header("-Set_Cookie" => "foo=bar");
print "Hello, world\n";
# WORKAROUND 2
use CGI::Compress::Gzip;
my $q = CGI::Compress::Gzip->new;
print "Set-Cookie: foo=bar\n";
print $q->header;
print "Hello, world\n";
Future versions could try to parse the header to look for its end rather
than insisting that the printed version match the version returned by
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CGI/Cookie/Splitter.pm view on Meta::CPAN
package CGI::Cookie::Splitter; # git description: v0.04-15-g9f9f932
# ABSTRACT: Split big cookies into smaller ones.
our $VERSION = '0.05';
use strict;
lib/CGI/Cookie/Splitter.pm view on Meta::CPAN
my $tail = $self->new_cookie( $head, value => '', name => $self->mangle_name_next( $head->name ) );
my $max_value_size = $self->size - ( $self->cookie_size( $head ) - length( escape($head->value) ) );
$max_value_size -= 30; # account for overhead the cookie serializer might add
die "Internal math error, please file a bug for CGI::Cookie::Splitter: max size should be > 0, but is $max_value_size (perhaps other attrs are too big?)"
unless ( $max_value_size > 0 );
my ( $head_v, $tail_v ) = $self->split_value( $max_value_size, $head->value );
$head->value( $head_v );
$tail->value( $tail_v );
die "Internal math error, please file a bug for CGI::Cookie::Splitter"
unless $self->cookie_size( $head ) <= $self->size; # 10 is not enough overhead
return $head unless $tail_v;
return ( $head, $self->do_split_cookie( $tail ) );
}
lib/CGI/Cookie/Splitter.pm view on Meta::CPAN
$tail = substr( $value, $adjusted_size );
if ( length(my $escaped = escape($head)) > $max_size ) {
my $adjustment = int( ( length($escaped) - length($head) ) / 3 ) + 1;
die "Internal math error, please file a bug for CGI::Cookie::Splitter"
unless $adjustment;
$adjusted_size -= $adjustment;
redo split_value;
}
lib/CGI/Cookie/Splitter.pm view on Meta::CPAN
=encoding UTF-8
=head1 NAME
CGI::Cookie::Splitter - Split big cookies into smaller ones.
=head1 VERSION
version 0.05
=head1 SYNOPSIS
use CGI::Cookie::Splitter;
my $splitter = CGI::Cookie::Splitter->new(
size => 123, # defaults to 4096
);
@small_cookies = $splitter->split( @big_cookies );
lib/CGI/Cookie/Splitter.pm view on Meta::CPAN
=head1 METHODS
=head2 new
$splitter = CGI::Cookie::Splitter->new(%params)
The only supported parameters right now are C<size>. It defaults to 4096.
=head2 split
@cookies = $splitter->split(@cookies)
This method accepts a list of CGI::Cookie objects (or lookalikes) and returns
a list of L<CGI::Cookie>s.
Whenever an object with a total size that is bigger than the limit specified at
construction time is encountered it is replaced in the result list with several
objects of the same class, which are assigned serial names and have a smaller
size and the same domain/path/expires/secure parameters.
lib/CGI/Cookie/Splitter.pm view on Meta::CPAN
=over 4
=item *
L<CGI::Cookie>
=item *
L<CGI::Simple::Cookie>
=item *
L<http://www.cookiecutter.com/>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CGI/Cookie/XS.pm view on Meta::CPAN
package CGI::Cookie::XS;
use strict;
use warnings;
our $VERSION;
lib/CGI/Cookie/XS.pm view on Meta::CPAN
1;
__END__
=head1 NAME
CGI::Cookie::XS - HTTP Cookie parser in pure C
=head1 VERSION
This document describes CGI::Cookie::XS 0.18 released on September 2, 2009.
=head1 SYNOPSIS
use CGI::Cookie::XS;
my $raw_cookie = 'foo=a%20phrase;weird; bar=yes%2C%20a%20phrase; baz=%5Ewibble&leiyh; qux=%27';
my $res = CGI::Cookie::XS->parse($raw_cookie);
# $res is something like:
# {
# 'bar' => [
# 'yes, a phrase'
# ],
lib/CGI/Cookie/XS.pm view on Meta::CPAN
# '\''
# ]
# };
# or directly read raw cookies from the CGI environments:
$res = CGI::Cookie::XS->fetch;
=head1 DESCRIPTION
This module implements a very simple parser for cookies used in HTTP applications. We've found L<CGI::Simple::Cookie> and L<CGI::Cookie> rather slow according to the profiling results for our L<OpenResty> project, hence the rewrite in C.
This library is still in B<beta> stage and the API is still in flux. We're just following the "release early, releaes often" guideline. So please check back often ;)
Special effort has been made to ensure this module works in the same way as the latest L<CGI::Cookie> (i.e., the pure Perl implementation). If you find it doesn't, please let us know.
=head1 METHODS
We currently provide 2 static methods, C<parse> and C<fetch>. They work mostly the same way as those methods found in L<CGI::Cookie> and L<CGI::Simple::Cookie> but with the exception that our version returns plain Perl data structures rather than has...
We'll implement some cookie dump methods in the near future.
=over
=item C<< $ref = CGI::Cookie::XS->parse($raw_cookie) >>
Parses C<$raw_cookie> and returns the reference of a hash of arrays. The keys
of the hash are cookie variables' names while the values of the hash are lists of cookie variable's values.
There is a length limit on the C<$raw_cookie>. If C<$raw_cookie> is longer than 4 KB (i.e. 4 * 1024 bytes, excluding the trailing '\0'), the overflowing part will be truncated.
Also note that, C<fetch> does not assume any encoding on the cookie values. It just decodes the encoded entries verbatim and treat them as plain "binary" stuff.
=item C<< $ref = CGI::Cookie::XS->fetch() >>
Reads the raw cookie from the C<HTTP_COOKIE> and C<COOKIE> environments
(which are usually set by HTTP servers like lighttd or apache) and then
parses the value using the C<parse> method and finally returns the
results.
lib/CGI/Cookie/XS.pm view on Meta::CPAN
=head1 BUGS
There must be some serious bugs lurking somewhere. We haven't done comprehensive testing for our code yet. It's a TODO.
Please report bugs or send wish-list to
L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=CGI-Cookie-XS>.
=head1 SEE ALSO
L<CGI::Cookie>, L<CGI::Cookie::Simple>.
=head1 AUTHOR
=over
view all matches for this distribution
view release on metacpan or search on metacpan
CookieSerial.pm view on Meta::CPAN
# MODINFO module CGI::CookieSerial a wrapper for creating serialized cookies with Data::Serializer and CGI::Cookie
package CGI::CookieSerial;
# MODINFO dependency module 5.006
use 5.006;
# MODINFO dependency module warnings
use warnings;
# MODINFO dependency module CGI::Cookie
use CGI::Cookie;
# MODINFO dependency module Data::Serializer
use Data::Serializer;
# MODINFO version 0.06
our $VERSION = '0.06';
# MODINFO constructor new create a new CookieSerial object
sub new {
my $class = shift;
$class = ref($class) if ref($class);
my $self = bless {}, $class;
my %flags = @_;
CookieSerial.pm view on Meta::CPAN
if ( ! $self->{noserialize} ) {
$self->{data} = $self->{capncrunch}->freeze($self->{data});
}
# make into cookie form
my $cookie = CGI::Cookie->new(
-name => $self->{name},
-value => $self->{data},
-path => $self->{path},
-domain => $self->{domain},
-secure => $self->{secure},
-expires => $self->{expires},
);
# print header
print "Set-Cookie: $cookie\n";
}
# MODINFO method cool
sub cool {
my $self = shift;
# fetch cookie
my %cookies = fetch CGI::Cookie;
$self->{data} ||= '';
$self->{debug} = "\$self->{data} = $self->{data}<br>".
"\$self->{name} = $self->{name}<br>";
my $data = $cookies{$self->{name}}->value() if $self->{data};
CookieSerial.pm view on Meta::CPAN
1;
__END__
=head1 NAME
CGI::CookieSerial - a wrapper for creating a CGI serial cookie or cookies with any serialized perl data stuctures
=head1 SYNOPSIS
Setting a cookie with data:
use strict;
use CGI;
use CGI::CookieSerial;
my $cgi = new CGI;
my $pbscookie = new CGI::CookieSerial(
-name => 'ticklemeelmo',
);
my @data = (
{
CookieSerial.pm view on Meta::CPAN
Retrieving a cookie with data:
use strict;
use Data::Dumper;
use CGI;
use CGI::CookieSerial;
my $cgi = new CGI;
my $pbscookie = new CGI::CookieSerial(
-name => 'ticklemeelmo',
);
my @data = @{$pbscookie->cool()};
CookieSerial.pm view on Meta::CPAN
Retrieving a regular cookie:
use strict;
use Data::Dumper;
use CGI;
use CGI::CookieSerial;
my $cgi = new CGI;
my $pbscookie = new CGI::CookieSerial(
-name => 'tv.station',
-noserialize => 1,
);
my $station_call_letters = $pbscookie->cool();
CookieSerial.pm view on Meta::CPAN
print "</body></html>";
=head1 ABSTRACT
Although deceptively similar to the workings of CGI::Cookie, this module
operates a little differently. By design, it is very simple to use. In
essence, one need only instantiate a new object and name the cookie,
create the data, and burn the cookie. Retrieval is just as simple.
=head1 DESCRIPTION
CookieSerial.pm view on Meta::CPAN
=head1 METHONDS
=head2 new()
In addition to the CGI::Cookie->new() parameters, the constructor also takes the same parameters as Data::Serializer->new(). There is one new parameter, -noserialize, which is a boolean that enables one to turn off the serializing function and fetch ...
-name
-value
-expires
-domain
CookieSerial.pm view on Meta::CPAN
=back
=head1 SEE ALSO
L<CGI>, L<CGI::Cookie>, L<Data::Serializer>
=head1 AUTHOR
Duncan McGreggor, E<lt>oubiwann at cpan dot orgE<gt>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CGI/CurlLog.pm view on Meta::CPAN
}
if ($ENV{"HTTP_AUTHORIZATION"}) {
$cmd .= "-H \"Authorization: $ENV{HTTP_AUTHORIZATION}\" ";
}
if ($ENV{"HTTP_COOKIE"}) {
$cmd .= "-H \"Cookie: $ENV{HTTP_COOKIE}\" ";
}
# if ($ENV{"HTTP_USER_AGENT"}) {
# $cmd .= "-H \"UserAgent: $ENV{HTTP_USER_AGENT}\" ";
# }
if ($ENV{"CONTENT_LENGTH"}) {
view all matches for this distribution
view release on metacpan or search on metacpan
return &key_values( 'Parameters', { map{ $_, [&CGI::param($_)] } &CGI::param } );
}
sub report_cookies
{
return &key_values( 'Cookies', { map{ $_, &CGI::cookie($_) } &CGI::cookie() } );
}
sub report_environment
{
return &key_values( 'Environment', \%ENV );
Send debug data as mail to file owner:
use CGI::Debug( to => 'mail' );
=head1 CONTROL PARAMETERS
Cookie control variables makes it possible to control the debugging
environment from a program in another browser window. This would be
prefereble with complex web pages (framesets, etc). The page is viewd
as normal in one window. All debugging data is shown i another window,
that also provides controls to alter the debugging environment. (But
this external debugging program is not yet implemented.)
Environment control variables makes it more easy to globaly set the
debugging environment for a web site. It is also a way for the target
program to control the CGI::Debug module actions.
The four methods can be mixed. (Cookies, enviroment, import parameters
and defaults.) The module will try to make sense with whatever you
give it. The possibilites of control are more limitied in the Cookie /
ENV version.
=head2 report errors
Cookie / ENV: CGI-Debug-report=errors
Import: report => 'errors'
report => [ 'errors', ... ]
Report the content of STDERR.
the other defualt things will be reported. This will only override the
default. Other report controls will be accumulated.
=head2 report empty_body
Cookie / ENV: CGI-Debug-report=empty_body
Import: report => 'empty_body'
report => [ 'empty_body', ... ]
Report if HTTP-body is empty.
This requires that "header control" is set.
=head2 report time
Cookie / ENV: CGI-Debug-report=time
Import: report => 'time'
report => [ 'time', ... ]
Report the elapsed time from beginning to end of execution.
If Time::Hires is found, this will be given with subsecond precision.
=head2 report params
Cookie / ENV: CGI-Debug-report=params
Import: report => 'params'
report => [ 'params', ... ]
Report a table of all name/value pairs, as given by the CGI module.
will be truncated to the "set param_length" number of chars. The total
length is shown for each value.
=head2 report cookies
Cookie / ENV: CGI-Debug-report=cookies
Import: report => 'cookies'
report => [ 'cookies', ... ]
Report a table of all cookies, as given by the CGI module.
will be truncated to the "set param_length" number of chars. The total
length is shown for each value.
=head2 report environment
Cookie / ENV: CGI-Debug-report=environment
Import: report => 'environment'
report => [ 'environment', ... ]
Report a table of all environment varialbes
INCLUDING empty_body, time, params, cookies.
=head2 report everything
Cookie / ENV: CGI-Debug-report=everything
Import: report => 'everything'
report => [ 'everything', ... ]
Report environment and all what that includes.
(The plan is for this control to include the contorl of HTML
compliance.)
=head2 report internals
Cookie / ENV: CGI-Debug-report=internals
Import: report => 'internals'
report => [ 'internals', ... ]
Report data for the debugging of the module itself, including
author about any problems.
=head2 on fatals
Cookie / ENV: CGI-Debug-on=fatals
Import: on => 'fatals'
Only deliver report on fatal errors.
will also be delivered if an empty body is detected, in case "header
control" is set.
=head2 on warnings
Cookie / ENV: CGI-Debug-on=warnings
Import: on => 'warnings'
Only deliver report on fatals or if there was any output to STDERR.
=head2 on anything
Cookie / ENV: CGI-Debug-on=anything
Import: on => 'anything'
Always deliver reports, even if there was no errors.
=head2 to browser
Cookie / ENV: CGI-Debug-to=browser
Import: to => 'browser'
to => [ 'browser', ... ]
to => { 'browser' => 1, ... }
report. This could be controled with "report html_compliance" (which is
not yet implemented).
=head2 to log
Cookie / ENV: CGI-Debug-to=log
Import: to => 'log'
to => [ 'log', ... ]
to => { 'log' => 1, ... }
This will easily result in a huge log.
=head2 to file
Cookie / ENV: CGI-Debug-to=file
CGI-Debug-to-file=filename
Import: to => 'file'
to => [ 'file', ... ]
to => { 'file' => 'filename', ... }
reports at a time. The action of this control may change in future
versions.
=head2 to mail
Cookie / ENV: CGI-Debug-to=mail
CGI-Debug-to-mail=mailaddress
Import: to => 'mail'
to => [ 'mail', ... ]
to => { 'mail' => 'mailaddress', ... }
besides yourself is getting an error. You will not get your own
errors as email if you overide that action with a control cookie.
=head2 header control
Cookie / ENV: CGI-Debug-header=control
Import: header => 'control'
Controls that the HTTP-header is correct.
program. All other controls can be changed during before the end of
the program.
=head2 header ignore
Cookie / ENV: CGI-Debug-header=ignore
Import: header => 'ignore'
Assume that the HTTP-header is correct and specifies text/html.
error response will result if the program compile ok but does not
produce a valid HTTP-header.
=head2 header minimal
Cookie / ENV: CGI-Debug-header=minimal
Import: header => 'minimal'
Generates a simple text/html HTTP-header for you.
row. But this action will guarantee that you have a valid header,
without the need to save STDOUT to a temporary file.
=head2 set param_length
Cookie / ENV: CGI-Debug-set-param_length=value
Import: set => { param_length => 'value', ... }
Set the max length of the parameter values.
cookies and environment. The purpose is to give you a table that looks
good.
=head2 set error_document
Cookie / ENV: CGI-Debug-set-error_document=value
Import: set => { error_document => 'value', ... }
Set what page to redirect to if there was an error report, not sent to
browser.
view all matches for this distribution
view release on metacpan or search on metacpan
t/send_file.t view on Meta::CPAN
my $h = CGI::Easy::Headers->new();
my ($data, $wait);
my %wait_h = (
'Status' => '200 OK',
'Date' => q{},
'Set-Cookie' => [],
'Accept-Ranges' => 'bytes',
'Content-Type' => 'application/x-download',
);
my $data_dynamic = 'Test file';
my $file_dynamic = \$data_dynamic;
t/send_file.t view on Meta::CPAN
});
is ${$data}, q{}, 'image/cache/inline real (ifmod current)';
is_deeply $h, {
Status => '304 Not Modified',
'Content-Type' => 'text/html; charset=utf-8', # XXX?
'Set-Cookie' => [],
Date => q{},
};
$h = CGI::Easy::Headers->new();
$h->{Expires} = 'Sat, 01 Jan 2000 00:00:00 GMT',
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CGI/Easy.pm view on Meta::CPAN
change these keys/headers and add your own headers. When you ready to
output all headers from this object/hash you should call compose() method,
and it will return string with all HTTP headers suitable for sending to
browser.
There one exception: value for key 'Set-Cookie' is ARRAYREF with HASHREF,
where each HASHREF keep cookie details:
$h->{'Set-Cookie'} = [
{ name=>'mycookie1', value=>'myvalue1' },
{ name=>'x', value=>5,
domain=>'.example.com', expires=>time+86400 }
];
lib/CGI/Easy.pm view on Meta::CPAN
my $somevalue = $r->{cookie}{somename};
$h->add_cookie({ name => 'somename', value => $somename });
If you will use CGI::Easy::Session, then it will read/write values for
three cookies: C<sid>, C<perm> and C<temp>. Cookie C<sid> will contain
automatically generated ID unique to this visitor, cookies C<perm> and
C<temp> will contain simple perl hashes (automatically serialized to
strings for storing in cookies) with different lifetime: C<perm> will
expire in 1 year, C<temp> will expire when browser closes.
view all matches for this distribution
view release on metacpan or search on metacpan
1.0.1 2020-11-16 14:16:18+00:00 Europe/London
- Probably fixed RT#133593, thanks to David Cook for reporting
it. There was a possibility of losing some data if the CGI prints
very long lines
1.0.0 2016-02-17 14:00:48+00:00 Europe/London
- first release
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CGI/Ex.pm view on Meta::CPAN
} else {
if (my $r = $self->apache_request) {
if ($self->is_mod_perl_1) {
$r->header_out("Set-cookie", $cookie);
} else {
$r->headers_out->add("Set-Cookie", $cookie);
}
} else {
print "Set-Cookie: $cookie\r\n";
}
}
}
### print the last modified time
view all matches for this distribution
view release on metacpan or search on metacpan
examples/htdocs/examples.js view on Meta::CPAN
init : function(){
// var t = Ext.get('exttheme');
// if(!t){ // run locally?
// return;
// }
// var theme = Cookies.get('exttheme') || 'aero';
// if(theme){
// t.dom.value = theme;
// Ext.getBody().addClass('x-'+theme);
// }
// t.on('change', function(){
// Cookies.set('exttheme', t.getValue());
// setTimeout(function(){
// window.location.reload();
// }, 250);
// });
//
examples/htdocs/examples.js view on Meta::CPAN
//Ext.onReady(Ext.example.init, Ext.example);
// old school cookie functions
var Cookies = {};
Cookies.set = function(name, value){
var argv = arguments;
var argc = arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : '/';
var domain = (argc > 4) ? argv[4] : null;
examples/htdocs/examples.js view on Meta::CPAN
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
};
Cookies.get = function(name){
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
var j = 0;
while(i < clen){
j = i + alen;
if (document.cookie.substring(i, j) == arg)
return Cookies.getCookieVal(j);
i = document.cookie.indexOf(" ", i) + 1;
if(i == 0)
break;
}
return null;
};
Cookies.clear = function(name) {
if(Cookies.get(name)){
document.cookie = name + "=" +
"; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
};
Cookies.getCookieVal = function(offset){
var endstr = document.cookie.indexOf(";", offset);
if(endstr == -1){
endstr = document.cookie.length;
}
return unescape(document.cookie.substring(offset, endstr));
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/CGI/FileManager/Test.pm view on Meta::CPAN
my $cookie_value = $t->extract_cookie($result);
=cut
sub extract_cookie {
my ($self, $result) = @_;
if ($result =~ /^Set-Cookie: $self->{cookie}=([^;]*);/m) {
return $1;
} else {
return "";
}
}
=pod
sub cookie_set {
my ($result, $cookie) = @_;
$T->like($result, qr{^Set-Cookie: $COOKIE=$cookie; domain=$ENV{HTTP_HOST}; path=/}m, 'cookie set');
}
sub setup_sessions {
my $n = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CGI/FormBuilder.pm view on Meta::CPAN
my $self = shift;
$self->{header} = shift if @_;
return unless $self->{header};
my %head;
if ($self->{cookies} && defined(my $sid = $self->sessionid)) {
require CGI::Cookie;
$head{'-cookie'} = CGI::Cookie->new(-name => $self->{sessionidname},
-value => $sid);
}
# Set the charset for i18n
$head{'-charset'} = $self->charset;
lib/CGI/FormBuilder.pm view on Meta::CPAN
$self->{sessionid} = shift if @_;
return $self->{sessionid} if $self->{sessionid};
return undef unless $self->{sessionidname};
my %cookies;
if ($self->{cookies}) {
require CGI::Cookie;
%cookies = CGI::Cookie->fetch;
}
if (my $cook = $cookies{"$self->{sessionidname}"}) {
return $cook->value;
} else {
return $self->{params}->param($self->{sessionidname}) || undef;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CGI/Framework.pm view on Meta::CPAN
}
if (!$cookie_value || ($self->{_session}->id() ne $cookie_value)) {
# We just created a new session - send it to the user
print "Set-Cookie: $para{cookie_name}=", $self->{_session}->id(), ($para{cookie_domain} ? "; domain=" . $para{cookie_domain} : ""), "\n";
}
$expire = $para{"expire"} ? ($para{"expire"} =~ /[^0-9]/ ? $para{"expire"} : "+$para{expire}m") : "+15m";
$self->{_session}->expire($expire);
#
view all matches for this distribution
view release on metacpan or search on metacpan
examples/lib/CGI/Simple/Header/Adapter.pm view on Meta::CPAN
$self->SUPER::as_arrayref;
}
sub _bake_cookie {
my ( $self, $cookie ) = @_;
ref $cookie eq 'CGI::Simple::Cookie' ? $cookie->as_string : $cookie;
}
sub _date {
my ( $self, $expires ) = @_;
CGI::Simple::Util::expires( $expires, 'http' );
view all matches for this distribution
view release on metacpan or search on metacpan
bin/info.pl view on Meta::CPAN
}
}
if($ENV{'HTTP_COOKIE'}) {
print 'HTTP_COOKIE: ', $ENV{'HTTP_COOKIE'}, "\n",
"Cookies:\n";
foreach my $cookie(split (/; /, $ENV{'HTTP_COOKIE'})) {
my ($key, $value) = split(/=/, $cookie);
print "Cookie $key:\n";
my $c = $info->get_cookie(cookie_name => $key);
if(!defined($c)) {
print "ERROR: Expected $value, got undef\n";
} elsif($c eq $value) {
print "$c\n";
view all matches for this distribution