Result:
found more than 540 distributions - search limited to the first 2001 files matching your query ( run in 1.400 )


CGI-AppBuilder-Security

 view release on metacpan or  search on metacpan

Security.pm  view on Meta::CPAN

use warnings;
use Getopt::Std;
use POSIX qw(strftime);
use Carp;
use CGI ':standard';
use CGI::Cookie;
use CGI::AppBuilder;
use CGI::AppBuilder::Message qw(:echo_msg);

our $VERSION = 0.12;
require Exporter;

Security.pm  view on Meta::CPAN

sub get_cookies {
    my $s = shift;
    my ($q, $ar) = @_;
    
    # retrieve cookies
    # my %cookies = fetch CGI::Cookie;
    my %cookies = CGI::Cookie->fetch;
$s->disp_param(\%cookies);     
    
    my %cks = ();  # parsed cookies
    foreach my $k (sort keys %cookies) {
        foreach my $rec (split /;/, $cookies{$k}) {

Security.pm  view on Meta::CPAN

      push @$ck, $q->cookie(-name=>$k1,-value=>$v,-domain=>$dn, 
        -expires=>'+3M');
    }
    $ar->{_cookie} = $ck;
    # print header(-cookie=>$ck); 
    # for my $i (0..$#$ck) { my $c = $ck->[$i]; print "Set-Cookie: $c\n";  } 
    # print "Content-Type: text/html\n\n"; 

    # $s->echo_msg($kv, 3); 
    # $s->echo_msg($ck, 0);
    # my $c2 = $s->get_cookies($q, $ar); 

 view all matches for this distribution


CGI-Application-Framework

 view release on metacpan or  search on metacpan

t/TestApp.pm  view on Meta::CPAN

sub header_props {
    my $self = shift;
    my %args = @_;
    my $stash = $self->stash;

    $stash->{'Cookie'} = $args{'-cookie'};
}

sub _login_tmpl_params {
    ();
}

 view all matches for this distribution


CGI-Application-Plugin-Apache

 view release on metacpan or  search on metacpan

lib/CGI/Application/Plugin/Apache.pm  view on Meta::CPAN

    # send all the cookies -- there may be several
    if ( $cookie ) {
        my(@cookie) = ref($cookie) && ref($cookie) eq 'ARRAY' ? @{$cookie} : $cookie;
        foreach (@cookie) {
            my $cs = '';
            if( UNIVERSAL::isa($_,'CGI::Cookie') || (MP2() ? UNIVERSAL::isa($_, 'Apache2::Cookie') : UNIVERSAL::isa($_,'Apache::Cookie') ) ) {
                $cs = $_->as_string;
            } else {
                $cs = $_;
            }
            $q->headers_out->add('Set-Cookie'  => $cs);
        }
    }
    # if the user indicates an expiration time, then we need an Expires
    if( $expires ) {
        $q->headers_out('Expires' => _expires($expires,'http'));

lib/CGI/Application/Plugin/Apache.pm  view on Meta::CPAN

        my $self = shift;
        my $q = $self->query(); # $q is an Apache::Request obj not a CGI.pm obj

        # do some stuff
        
        # now we can bake a cookie using Apache::Cookie without interference  
        $cookie = Apache::Cookie->new(
                $q,
                -name       => 'foo',
                -value      => 'bar',
                -expires    => '+2h',
        );

lib/CGI/Application/Plugin/Apache.pm  view on Meta::CPAN


=item Override the way L<CGI::Application> creates and prints it's HTTP headers. Since it was using
L<CGI.pm|CGI>'s C<< header() >> and C<< redirect() >> method's we needed an alternative. So now we
use the C<< Apache->send_http_header() >> method. This has a few additional benefits other
than just not using L<CGI.pm|CGI>. It means that we can use other Apache::* modules that might
also create outgoing headers (e.g. L<Apache::Cookie>) without L<CGI::Application> clobbering
them.

=back

=head1 EXPORTED METHODS

lib/CGI/Application/Plugin/Apache.pm  view on Meta::CPAN


We encourage you to learn the mod_perl way of manipulating headers and cookies. It's really not
that hard we promise. But incase you're easing your way into it, we try and provide as much
backward compatibility as possible.

=head2 Cookies

HTTP cookies should now be created using L<Apache::Cookie> and it's C<< bake() >> method not with 
C<< header_add() >> or C<< header_props() >>.

You can still do the following to create a cookie

    my $cookie = CGI::Cookie->new(
        -name  => 'foo',
        -value => 'bar',
    );
    $self->header_add(-cookie => $cookie);

But now we encourage you to do the following

    my $cookie = Apache::Cookie->new(
        $self->query,
        -name  => 'foo',
        -value => 'bar',
    );
    $cookie->bake();

lib/CGI/Application/Plugin/Apache.pm  view on Meta::CPAN


If you wish to write code that performs well in both environments, you can check the $ENV{MOD_PERL}
environment setting and branch accordingly. For example, to set a cookie:

  if ($ENV{MOD_PERL}) {
    require Apache::Cookie;
    $cookie = Apache::Cookie->new(
      $q,
      -name       => 'favorite',
      -value      => 'chocolate chip',
      -expires    => '+2h',
    );

lib/CGI/Application/Plugin/Apache.pm  view on Meta::CPAN

                                                                                                                                           
=item * L<Apache>

=item * L<Apache::Request> / L<Apache2::Request>

=item * L<Apache::Cookie> / L<Apache2::Cookie>
                                                                                                                                           
=back
                                                                                                                                           
=head1 LICENSE
                                                                                                                                           

 view all matches for this distribution


CGI-Application-Plugin-Authentication

 view release on metacpan or  search on metacpan

lib/CGI/Application/Plugin/Authentication.pm  view on Meta::CPAN

=head2 Choosing a Store

The Store modules keep information about the authentication status of the user persistent
across multiple requests.  The information that is stored in the store include the username,
and the expiry time of the login.  There are two Store modules included with this distribution.
A Session based store, and a Cookie based store.  If your application is already using
Sessions (through the L<CGI::Application::Plugin::Session> module), then I would recommend
that you use the Session store for authentication.  If you are not using the Session
plugin, then you can use the Cookie store.  The Cookie store keeps all the authentication
in a cookie, which contains a checksum to ensure that users can not change the information.

If you do not specify which Store module you wish to use, the plugin will try to determine
the best one for you.

lib/CGI/Application/Plugin/Authentication.pm  view on Meta::CPAN

Here you can choose how we store the authenticated information after a user has successfully 
logged in.  We need to store the username so that on the next request we can tell the user
has already logged in, and we do not have to present them with another login form.  If you
do not provide the STORE option, then the plugin will look to see if you are using the
L<CGI::Application::Plugin::Session> module and based on that info use either the Session
module, or fall back on the Cookie module.  If the module requires extra parameters, you
can pass an array reference that contains as the first parameter the name of the module,
and the rest of the array should contain key value pairs of options for this module.
These storage modules generally live under the CGI::Application::Plugin::Authentication::Store::
name-space, and this part of the package name can be left off when specifying the STORE
parameter.

    STORE => 'Session'

  - or -

    STORE => ['Cookie',
        NAME   => 'MYAuthCookie',
        SECRET => 'FortyTwo',
        EXPIRY => '1d',
    ]


lib/CGI/Application/Plugin/Authentication.pm  view on Meta::CPAN

Time values are specified in seconds. You can also specify the time by using a number with the
following suffixes (m h d w), which represent minutes, hours, days and weeks.  The default
is 0 which means the login will never timeout.

Note that the login is also dependent on the type of STORE that is used.  If the Session store is used,
and the session expires, then the login will also automatically expire.  The same goes for the Cookie
store.

For backwards compatibility, if you set LOGIN_SESSION_TIMEOUT to a time value instead of a hashref,
it will be treated as an IDLE_FOR time out.

lib/CGI/Application/Plugin/Authentication.pm  view on Meta::CPAN

            # No STORE configuration was provided
            if ($self->_cgiapp->can('session') && UNIVERSAL::isa($self->_cgiapp->session, 'CGI::Session')) {
                # The user is already using the Session plugin
                ($store_module, @store_config) = ( 'Session' );
            } else {
                # Fall back to the Cookie Store
                ($store_module, @store_config) = ( 'Cookie' );
            }
        }

        # Load the the class for this store
        my $store_class = _find_deligate_class(

 view all matches for this distribution


CGI-Application-Plugin-CAPTCHA

 view release on metacpan or  search on metacpan

t/02-create.t  view on Meta::CPAN

    # Capture the result.
    $mech->get_ok('http://localhost:' . PORT . '/', "Got CAPTCHA successfully");

    # Get the cookie we should have been fed
    my $jar = $mech->cookie_jar;
    isa_ok($jar, "HTTP::Cookies");

    # Make sure we got a cryptographic hash in a cookie
    my $cookie = $jar->as_string;
    my ($hash) = $cookie =~ /hash=(.*?);/;
    isnt($hash, "", "Received cryptographic hash in cookie");

 view all matches for this distribution


CGI-Application-Plugin-Cache-Adaptive

 view release on metacpan or  search on metacpan

inc/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 CGI::Session->name ) {
                    # keep this cookie
                    push @keep, $cookie;
                }
            }
            push @keep, $newcookie;

 view all matches for this distribution


CGI-Application-Plugin-Header

 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


CGI-Application-Plugin-MessageStack

 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


CGI-Application-Plugin-ProtectCSRF

 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


CGI-Application-Plugin-Session

 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


CGI-Application-Plus

 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


CGI-Application

 view release on metacpan or  search on metacpan

t/basic.t  view on Meta::CPAN

	my $app = TestApp->new();
	$app->query(CGI->new({'test_rm' => 'cookie_test'}));

	response_like(
		$app,
		qr/^Set-Cookie: c_name=c_value/,
		qr/Hello World: cookie_test/,
		"TestApp, cookie test",
	);
}

t/basic.t  view on Meta::CPAN

{
	my $app = TestApp->new();
	$app->query(CGI->new({'test_rm' => 'header_add_arrayref_test'}));
	my $output = $app->run();

	like($output, qr/Set-Cookie: cookie1=header_add/, "arrayref test: cookie1");
	like($output, qr/Set-Cookie: cookie2=header_add/, "arrayref test: cookie2");
}

# make sure header_add does not clobber earlier headers
{
	my $app = TestApp->new();
	$app->query(CGI->new({'test_rm' => 'header_props_before_header_add'}));
	my $output = $app->run();

	like($output, qr/Set-Cookie: cookie1=header_props/, "header_props: cookie1");
	like($output, qr/Set-Cookie: cookie2=header_add/,   "header_add: cookie2");
}

# make sure header_add works after header_props is called
{
	my $app = TestApp->new();
	$app->query(CGI->new({'test_rm' => 'header_add_after_header_props'}));
	my $output = $app->run();

	like($output, qr/Set-Cookie: cookie2=header_add/, "header add after props");
}

# test use of TMPL_PATH without trailing slash
{
	my $app = TestApp->new(TMPL_PATH=>'t/lib/templates');

 view all matches for this distribution


CGI-Auth-Auto

 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


CGI-AuthRegister

 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


CGI-Authen-Simple

 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


CGI-Builder-CgiAppAPI

 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


CGI-Builder-Session

 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


CGI-Bus

 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


CGI-Capture

 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


CGI-Carp-Fatals

 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


CGI-Compile

 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


CGI-Compress-Gzip

 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


CGI-Cookie-Splitter

 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


CGI-Cookie-XS

 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


CGI-CookieSerial

 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


CGI-CurlLog

 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


CGI-Debug

 view release on metacpan or  search on metacpan

Debug.pm  view on Meta::CPAN

    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 );

Debug.pm  view on Meta::CPAN

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. 

Debug.pm  view on Meta::CPAN

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.

Debug.pm  view on Meta::CPAN

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.

Debug.pm  view on Meta::CPAN

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.

Debug.pm  view on Meta::CPAN

(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

Debug.pm  view on Meta::CPAN

author about any problems.


=head2 on fatals

  Cookie / ENV: CGI-Debug-on=fatals

  Import: on => 'fatals'

Only deliver report on fatal errors.

Debug.pm  view on Meta::CPAN

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, ... }

Debug.pm  view on Meta::CPAN

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, ... }

Debug.pm  view on Meta::CPAN


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', ... }

Debug.pm  view on Meta::CPAN

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', ... }

Debug.pm  view on Meta::CPAN

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.

Debug.pm  view on Meta::CPAN

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.

Debug.pm  view on Meta::CPAN

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.

Debug.pm  view on Meta::CPAN

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.

Debug.pm  view on Meta::CPAN

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


CGI-Easy-SendFile

 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


CGI-Easy

 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


CGI-Emulate-PSGI-Streaming

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

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


( run in 1.400 second using v1.01-cache-2.11-cpan-995e09ba956 )