view release on metacpan or search on metacpan
lib/Business/BR/CNJ/NumberExtractor.pm view on Meta::CPAN
# Or, using LWP::UseAgent and Mojo::DOM (if text/html repsonse)
my @numbers = Business::BR::CNJ::NumberExtractor::cnj_extract_numbers_lwp('https://modeloinicial.com.br/peticao/reclamacao-trabalhista');
# Pass on args to LWP's get method, like cookies or user agent:
my @numbers = Business::BR::CNJ::NumberExtractor::cnj_extract_numbers_lwp('https://modeloinicial.com.br/peticao/11040619/Acao-aposentadoria-invalidez', 'User-Agent', 'That is me.');
my @numbers = Business::BR::CNJ::NumberExtractor::cnj_extract_numbers_lwp('https://modeloinicial.com.br/peticao/11000717/Acao-aposentadoria-Especial', 'Cookie', 'AUTH=123');
# Works even on DOC or PDF files
my @numbers = Business::BR::CNJ::NumberExtractor::cnj_extract_numbers_lwp('http://arquivo.trf1.gov.br/AGText/2011/0001000/00010284120114013819_3.doc');
=head1 DESCRIPTION
view all matches for this distribution
view release on metacpan or search on metacpan
share/dist/Business-CyberSource/production/CyberSourceTransaction_1_71.xsd view on Meta::CPAN
<xsd:element name="driversLicenseState" type="xsd:string" minOccurs="0"/>
<xsd:element name="ssn" type="xsd:string" minOccurs="0"/>
<xsd:element name="customerID" type="xsd:string" minOccurs="0"/>
<xsd:element name="httpBrowserType" type="xsd:string" minOccurs="0"/>
<xsd:element name="httpBrowserEmail" type="xsd:string" minOccurs="0"/>
<xsd:element name="httpBrowserCookiesAccepted" type="tns:boolean" minOccurs="0"/>
<xsd:element name="nif" type="xsd:string" minOccurs="0"/>
<xsd:element name="personalID" type="xsd:string" minOccurs="0"/>
<xsd:element name="language" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Business/EDI/CodeList/CryptographicModeOfOperationCoded.pm view on Meta::CPAN
'33' => [ 'TCBCM',
'TDEA mode of operation, Cipher Block Chaining with output feedback Masking, ANSI X9.52.' ],
'34' => [ 'TCBCM-I',
'TDEA mode of operation, Cipher Block Chaining with output feedback Masking Interleaved, ANSI X9.52.' ],
'35' => [ 'TECB',
'TDEA mode of operation, Electronic Cookbook Mode, ANSI X9.52.' ],
'36' => [ 'CTS',
'RC5 mode of operation, Cipher Text Stealing, Published in RCF 2040.' ],
'ZZZ' => [ 'Mutually agreed',
'Mutually agreed between trading partners.' ],
);
view all matches for this distribution
view release on metacpan or search on metacpan
examples/SampleQuote.txt view on Meta::CPAN
RFF+IA:145'
LIN+7++9780755310166:EN'
PIA+5+0755310160:IB'
IMD+L+010+:::Berry'
IMD+L+011+:::Mary'
IMD+L+050+:::Cook now, eat later'
IMD+L+060+:::be one step ahead with over 130 del:icious recipes to prepare in advanc'
IMD+L+110+:::London'
IMD+L+120+:::Headline'
IMD+L+170+:::2006'
IMD+L+220+:::pbk'
examples/SampleQuote.txt view on Meta::CPAN
RFF+IA:145'
LIN+22++9781841574530:EN'
PIA+5+1841574538:IB'
IMD+L+050+:::Iceland'
IMD+L+110+:::Peterborough'
IMD+L+120+:::Thomas Cook'
IMD+L+170+:::2006'
IMD+L+220+:::pbk'
IMD+L+230+:::914.912046'
IMD+L+250+:::AN'
QTY+1:1'
examples/SampleQuote.txt view on Meta::CPAN
RFF+IA:145'
LIN+23++9781841575773:EN'
PIA+5+1841575771:IB'
IMD+L+050+:::Estonia'
IMD+L+110+:::Peterborough'
IMD+L+120+:::Thomas Cook'
IMD+L+170+:::2006'
IMD+L+220+:::pbk'
IMD+L+230+:::914.7'
IMD+L+250+:::AN'
QTY+1:1'
examples/SampleQuote.txt view on Meta::CPAN
RFF+IA:145'
LIN+24++9781841575780:EN'
PIA+5+184157578X:IB'
IMD+L+050+:::Latvia'
IMD+L+110+:::Peterborough'
IMD+L+120+:::Thomas Cook'
IMD+L+170+:::2006'
IMD+L+220+:::pbk'
IMD+L+230+:::914.7'
IMD+L+250+:::AN'
QTY+1:1'
examples/SampleQuote.txt view on Meta::CPAN
RFF+IA:145'
LIN+25++9781841575957:EN'
PIA+5+184157595X:IB'
IMD+L+010+:::Holmes'
IMD+L+011+:::Robert'
IMD+L+030+:::Thomas Cook Ltd'
IMD+L+050+:::Boston & New England'
IMD+L+110+:::Peterborough'
IMD+L+120+:::Thomas Cook'
IMD+L+170+:::2006'
IMD+L+220+:::pbk'
IMD+L+230+:::917.4461'
IMD+L+250+:::AN'
QTY+1:1'
view all matches for this distribution
view release on metacpan or search on metacpan
utilities/totals view on Meta::CPAN
}
# ok, print results
sub commify
# based on the "Perl Cookbook" recipe 2.17
{
my $s;
return map
{
$s = reverse $_;
view all matches for this distribution
view release on metacpan or search on metacpan
Allopass.pm view on Meta::CPAN
=cut
use strict;
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
use CGI::Cookie;
my $baseurl = 'http://www.allopass.com/check/vf.php4';
=head1 METHODS
Allopass.pm view on Meta::CPAN
'CODE0' => $code ,
'DATAS' => $datas ,
'AP_CA' => $ap_ca
];
$res = $ua->simple_request($req)->as_string;
if ($res=~/Set-Cookie: AP_CHECK/) {
$self->_set_error('Allopass Check Code OK');
my $r = $self->_add_session($docid, $code);
if ($r) {
$self->_set_error($r);
return 0;
Allopass.pm view on Meta::CPAN
sub _is_session {
my $self = shift;
my $doc_id = shift;
my $ok=0;
my %cookies = fetch CGI::Cookie;
my $docid=$doc_id; $docid=~s/\//\./g;
if (!$doc_id) {
$self->_set_error("No Document ID");
return 0
}
if (!$cookies{$docid}){
$self->_set_error("No Session Cookie");
return 0
}
return 0 if !ref $cookies{$docid};
return 0 if !defined $cookies{$docid}->value;
Allopass.pm view on Meta::CPAN
}
print OUTPUT "$doc_id|$code|$ENV{REMOTE_ADDR}|" . $a . "||\n";
if ($self->{os} == 0) {flock (OUTPUT, 8);}
close (OUTPUT);
$doc_id=~s/\//\./g;
my $cookie = new CGI::Cookie(-name=>$doc_id, -value=> $code );
if (ref $self->{hhttp}) {
$self->{hhttp}->add_cookie("Set-Cookie: ".$cookie->as_string);
} else {
print "Set-Cookie: ",$cookie->as_string,"\n";
}
0;
}
sub _end_session {
my $self=shift;
my $doc_id = shift;
my %cookies = fetch CGI::Cookie;
my $docid=$doc_id; $docid=~s/\//\./g;
my $code = $self->{code};
unless ($code) {
return("Unable to remove session : Undefined sid") if !ref $cookies{$docid};
Allopass.pm view on Meta::CPAN
print OUTPUT "$docid|$pass|$IP|$heure|$code|\n";
}
if ($self->{os} == 0) {flock (TEMP, 8);}
close (OUTPUT);
$doc_id=~s/\//\./g;
my $cookie = new CGI::Cookie(-name=>$docid, -value=> '-' );
if (ref $self->{hhttp}) {
$self->{hhttp}->add_cookie("Set-Cookie: ".$cookie->as_string);
} else {
print "Set-Cookie: ",$cookie->as_string,"\n";
}
0;
}
sub _is_res_ok {
my $self=shift;
view all matches for this distribution
view release on metacpan or search on metacpan
config/config.ini view on Meta::CPAN
usps_country_name_translations=<<EOF
American Samoa US Possession
Bosnia And Herzegovina Bosnia-Herzegovina
Bosnia And Herzegowina Bosnia-Herzegovina
Cocos (Keeling) Islands Australia
Cook Islands New Zealand
Corsica France
Cote d` Ivoire (Ivory Coast) Cote d lvoire (Ivory Coast)
East Timor Indonesia
Falkland Islands (Malvinas) Falkland Islands
France (Includes Monaco) France
config/config.ini view on Meta::CPAN
KY Cayman Islands
CL Chile
CN China
CO Colombia
KM Comoros
CK Cook Islands
CR Costa Rica
HR Croatia
CY Cyprus
CZ Czech Republic
DK Denmark
config/config.ini view on Meta::CPAN
Cayman Islands KY
Chile CL
China CN
Colombia CO
Comoros KM
Cook Islands CK
Costa Rica CR
Croatia HR
Cyprus CY
Czech Republic CZ
Denmark DK
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Business/Stripe/WebCheckout.pm view on Meta::CPAN
print $stripe->checkout;
} else {
# handle errors...
}
This last example prints out a fully formed HTML document to the browser containing only the C<head> section. The HTML contains the Javascript necessary to pass the use to the Stripe hosted checkout. The HTML is complete with Content-Type header. ...
print "Set-cookie: MyCookie=$order_number; path=/\n";
$stripe->checkout;
=head1 SEE ALSO
view all matches for this distribution
view release on metacpan or search on metacpan
country-codes.txt view on Meta::CPAN
China, Peoples Republic of CN
Christmas Island CX
Cocos Islands CC
Colombia CO
Congo CG
Cook Islands CK
Costa Rica CR
Croatia HR
Curacao CB
Cyprus CY
Czech Republic CZ
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Business/cXML/Message/PunchOutOrder.pm view on Meta::CPAN
sub from_node {
my ($self, $el) = @_;
$el->ferry($self, {
BuyerCookie => 'buyer_cookie',
PunchOutOrderMessageHeader => {
operationAllowed => 'highest_operation',
quoteStatus => [ 'status', \&_from_status ],
SourcingStatus => '__UNIMPLEMENTED',
Total => [ 'total', 'Business::cXML::Amount' ],
lib/Business/cXML/Message/PunchOutOrder.pm view on Meta::CPAN
sub to_node {
my ($self, $doc) = @_;
my $node = $doc->create($self->{_nodeName});
$node->add('BuyerCookie', $self->{buyer_cookie});
my $head = $node->add('PunchOutOrderMessageHeader', undef,
operationAllowed => $self->{highest_operation},
);
$head->{quoteStatus} = ($self->is_final ? 'final' : 'pending') if defined $self->{status};
view all matches for this distribution
view release on metacpan or search on metacpan
t/samples/stackoverflow.atom view on Meta::CPAN
<pre><code> protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//Set Banner Cookie
HttpCookie BannerCookie = new HttpCookie("ShowBanner");
BannerCookie.Value = "YES";
Response.Cookies.Add(bannercookie)
Panel1.Visible = False;
//Do Somthing...
ShowPageDetails();
ShowBanner();
t/samples/stackoverflow.atom view on Meta::CPAN
}
}
public void ShowBanner()
{
HttpCookie BannerCookie = Request.Cookies["ShowBanner"];
if (BannerCookie != null)
{
Panel1.Visible = True;
BannerCookie.Value = null;
Response.Cookies.Add(BannerCookie);
}
else
{
Panel1.Visible = false;
}
view all matches for this distribution
view release on metacpan or search on metacpan
xt/js/sinon.js view on Meta::CPAN
var unsafeHeaders = {
"Accept-Charset": true,
"Accept-Encoding": true,
"Connection": true,
"Content-Length": true,
"Cookie": true,
"Cookie2": true,
"Content-Transfer-Encoding": true,
"Date": true,
"Expect": true,
"Host": true,
"Keep-Alive": true,
xt/js/sinon.js view on Meta::CPAN
getResponseHeader: function getResponseHeader(header) {
if (this.readyState < FakeXMLHttpRequest.HEADERS_RECEIVED) {
return null;
}
if (/^Set-Cookie2?$/i.test(header)) {
return null;
}
header = header.toLowerCase();
xt/js/sinon.js view on Meta::CPAN
var headers = "";
for (var header in this.responseHeaders) {
if (this.responseHeaders.hasOwnProperty(header) &&
!/^Set-Cookie2?$/i.test(header)) {
headers += header + ": " + this.responseHeaders[header] + "\r\n";
}
}
return headers;
view all matches for this distribution
view release on metacpan or search on metacpan
src/sparse-0.4.4/perl/t/include/block/block.h view on Meta::CPAN
BDRV_ACCT_WRITE,
BDRV_ACCT_FLUSH,
BDRV_MAX_IOTYPE,
};
typedef struct BlockAcctCookie {
int64_t bytes;
int64_t start_time_ns;
enum BlockAcctType type;
} BlockAcctCookie;
void bdrv_acct_start(BlockDriverState *bs, BlockAcctCookie *cookie,
int64_t bytes, enum BlockAcctType type);
void bdrv_acct_done(BlockDriverState *bs, BlockAcctCookie *cookie);
typedef enum {
BLKDBG_L1_UPDATE,
BLKDBG_L1_GROW_ALLOC_TABLE,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CAM/App.pm view on Meta::CPAN
}
elsif (!$cgi->{'.header_printed'})
{
if ($self->{session})
{
return $cgi->header(-cookie => $self->{session}->getCookie(), @_);
}
else
{
return $cgi->header(@_);
}
lib/CAM/App.pm view on Meta::CPAN
$self->error("Internal error: Failed to load the $class library");
}
if ($self->{config}->{cookiename})
{
$class->setCookieName($self->{config}->{cookiename});
}
if ($self->{config}->{sessiontable})
{
$class->setTableName($self->{config}->{sessiontable});
}
view all matches for this distribution
view release on metacpan or search on metacpan
that broke page deletion.
1.21 13 Aug 2008
[FIXES]
- Permit comments after the %%EOF, like Adobe Reader does. Thanks to
Malcolm Cook for pointing out the incompatibility.
1.20 26 Jun 2008
[ENHANCEMENTS]
- Support for Type 2 encryption (just reading, not writing)
- Support for reading PDFs where the owner and user passwords
view all matches for this distribution
view release on metacpan or search on metacpan
t/bugreports.t view on Meta::CPAN
use Test::More tests => 1;
use CAM::PDFTaxforms;
{
# From an email exchange with Malcolm Cook:
# exiftool is appending a comment after the "%%EOF" at the end of
# the document, which is confusing CAM::PDF. Technically that's
# not allowed (the PDF spec says "The last line of the file
# contains only the end-of-file marker, %%EOF.") but the spec
# also has an implementation note in the appendix that says
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CAM/Session.pm view on Meta::CPAN
use DBI;
my $dbh = DBI->connect(...);
CAM::Session->setDBH($dbh);
my $session = new CAM::Session();
$session->printCookie();
$session->set("username", $username);
...
$session->get("username", $username);
$session->delete("username");
lib/CAM/Session.pm view on Meta::CPAN
require 5.005_62;
use strict;
use warnings;
use Carp;
use CGI::Cookie;
use CGI;
use DBI;
our @ISA = qw();
our $VERSION = '1.03';
lib/CAM/Session.pm view on Meta::CPAN
my $type = ref($self->{dbh}) ? ref($self->{dbh}) : "scalar";
&carp("The DBH object is not a valid DBI/DBD connection: $type");
return undef;
}
my %cookies = CGI::Cookie->fetch();
if (exists $cookies{$self->{cookieName}})
{
# existing session
$self->{id} = $cookies{$self->{cookieName}}->value;
if (!$self->loadSessionData())
lib/CAM/Session.pm view on Meta::CPAN
my $self = shift;
return $self->{id};
}
#----------------
=item getCookie
Return a cookie that indicates this session. Any arguments are passed
to CGI::Cookie::new(). Use this, for example, with
print CGI->header(-cookie => $session->getCookie);
=cut
sub getCookie
{
my $self = shift;
my $id = $self->getID();
my $cookie = CGI::Cookie->new(-name => $self->{cookieName},
-value => $id,
-path => "/",
@_);
return $cookie;
}
#----------------
=item printCookie
Outputs a cookie that indicates this session. Use this just before
"print CGI->header()", for example.
=cut
sub printCookie
{
my $self = shift;
my $cookie = $self->getCookie(@_);
print "Set-Cookie: $cookie\n";
}
#----------------
=item getAll
lib/CAM/Session.pm view on Meta::CPAN
my $val = shift;
$global_dbTablename = $val;
}
#----------------
=item setCookieName NAME
Set the name of the cookie that is used for the recording the session.
This is a class method.
Use like this:
CAM::Session->setCookieName($name);
=cut
sub setCookieName
{
my $pkg = shift; # unused
my $val = shift;
$global_cookieName = $val;
}
view all matches for this distribution
view release on metacpan or search on metacpan
my %Result;
my $AISXML;
print STDERR "$$ Session coox: $ENV{HTTP_COOKIE}\n";
my (@Cookies) = ($ENV{HTTP_COOKIE} =~ /AIS_Session=(\w+)/g);
tie my %Session, $Param{tieargs}->[0],
$Param{tieargs}->[1],$Param{tieargs}->[2],$Param{tieargs}->[3],
$Param{tieargs}->[4],$Param{tieargs}->[5],$Param{tieargs}->[6],
$Param{tieargs}->[7],$Param{tieargs}->[8],$Param{tieargs}->[9]
or croak "failed to tie @{$Param{tieargs}}";
print STDERR "Session database has ",scalar(keys %Session)," keys\n";
my $Cookie;
# make Cookie imply its validity
push @Cookies, undef;
while ($Cookie = shift @Cookies){
#$Session{$Cookie} and last;
if($Session{$Cookie}){
print STDERR "Session $Cookie exists\n";
last;
}else{
print STDERR "Session <$Cookie> false\n";
};
};
my $OTUkey;
my $SessionKey;
my ($PostKey) = ($ENV{QUERY_STRING} =~ /AIS_POST_key=(\w+)/);
# if (!$Cookie and $ENV{REQUEST_METHOD} eq 'POST' ){
# in general, whenever we've got the wrong name for the
# server, it won't work. So we need to redirect ourselves
# back to here with the right name for the server, and
# then we'll get our cookie, if we have one.
if (!$Cookie and !defined($PostKey) ){
# print STDERR "$$ Cookieless POST caught early\n";
print STDERR "$$ possible wrong SERVER_NAME\n";
if ($ENV{REQUEST_METHOD} eq 'POST' ){
$PostKey = join('',time,(map {("A".."Z")[rand 26]}(0..9)));
$Session{$PostKey} = join('',(<>));
}else{
close STDOUT;
close STDIN;
close POSTREAD;
print POSTWRITE '&',$Session{$PostKey};
close POSTWRITE or die "$$: Error closing POSTWRITE\n";
$Cookie and delete $Session{$PostKey};
# exit;
#POSIX:_exit(0); # perldoc -f exit
exec '/usr/bin/true';
};
};
# my $Response = `lynx -source $Param{aissri}query?$OTUkey$CRLF$CRLF`
my $Response = miniget $host, $port,
"$Param{aissri}query?$OTUkey", $Param{agent};
$SessionKey = join('',time,(map {("A".."Z")[rand 26]}(0..19)));
# print "Set-Cookie: AIS_Session=$SessionKey; path=$ENV{SCRIPT_NAME};$CRLF";
print "Set-Cookie: AIS_Session=$SessionKey; path=/; expires=$CRLF";
($AISXML) =
$Response =~ m#<aisresponse>(.+)</aisresponse>#si
or die "no <aisresponse> element from $Param{aissri}query?$OTUkey\n";
$Session{$SessionKey} = $AISXML;
}elsif (!$Cookie){
my $PostString = '';
# if ($ENV{REQUEST_METHOD} eq 'POST' and !eof){
if ($ENV{REQUEST_METHOD} eq 'POST' ){
print STDERR "$$ Cookieless POST\n";
my $PostKey = join('',time,(map {("A".."Z")[rand 26]}(0..9)));
$Session{$PostKey} = join('',(<>));
$PostString = "AIS_POST_key=$PostKey&";
};
print "Location: $Param{aissri}present?http://$ENV{SERVER_NAME}$ENV{REQUEST_URI}?${PostString}AIS_OTUkey=\n\n";
exit;
}else{ # We have a cookie
$AISXML = $Session{$Cookie};
delete $Session{$Cookie} if $ENV{QUERY_STRING} eq 'AIS_LOGOUT';
};
foreach (qw{
identity
error
};
#Suppress caching NULL and ERROR
if( $Result{identity} eq 'NULL' or $Result{identity} eq 'ERROR'){
print "Set-Cookie: AIS_Session=$CRLF";
$SessionKey and delete $Session{$SessionKey} ;
$Param{nodie} or die "AIS: $Result{identity} identity $Result{error} error";
};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CGI/Apache2/Wrapper.pm view on Meta::CPAN
require Apache2::URI;
require Apache2::Log;
require APR::URI;
require APR::Pool;
require Apache2::Request;
require CGI::Apache2::Wrapper::Cookie;
require CGI::Apache2::Wrapper::Upload;
$MOD_PERL = 2;
}
else {
die qq{mod_perl 2 required};
lib/CGI/Apache2/Wrapper.pm view on Meta::CPAN
sub cookies {
my $self = shift;
my $cookies = $self->{'.cookies'};
return $cookies if (defined $cookies);
my %cookies = Apache2::Cookie->fetch($self->r);
$self->{'.cookies'} = %cookies ? \%cookies : undef;
return $self->{'.cookies'};
}
sub uploads {
lib/CGI/Apache2/Wrapper.pm view on Meta::CPAN
return '';
}
my $content_type = delete $header_extra->{'Content-Type'} || 'text/html';
$r->content_type($content_type);
foreach my $key (keys %$header_extra) {
if ($key =~ /Set-Cookie/i) {
my $cookie = $header_extra->{$key};
if ($cookie) {
my(@cookie) = ref($cookie) && ref($cookie) eq 'ARRAY' ?
@{$cookie} : $cookie;
foreach my $c (@cookie) {
my $cs = (UNIVERSAL::isa($c,'CGI::Cookie') or
UNIVERSAL::isa($c, 'CGI::Apache2::Wrapper::Cookie') or
UNIVERSAL::isa($c, 'Apache2::Cookie')) ?
$c->as_string : $c;
$r->err_headers_out->add($key => $cs);
}
}
}
lib/CGI/Apache2/Wrapper.pm view on Meta::CPAN
sub self_url {
return shift->url('-path_info' => 1, '-query' => 1);
}
# Apache2::Cookie
sub cookie {
my $self = shift;
my ($name, $value, %args);
if (@_) {
lib/CGI/Apache2/Wrapper.pm view on Meta::CPAN
return () unless $cookies->{$name};
return $cookies->{$name}->value
if defined($name) && $name ne '';
}
return undef unless defined($name) && $name ne ''; # this is an error
my $cookie = CGI::Apache2::Wrapper::Cookie->new($self->r, %args);
return $cookie;
}
# Apache2::Upload
lib/CGI/Apache2/Wrapper.pm view on Meta::CPAN
example described in the I<url> options, this would lead to
I<http://localhost:8529/TestCGI/extra/path/info?opening=hello;closing=goodbye>.
=back
=head2 Apache2::Cookie
A new cookie can be created as
my $c = $cgi->cookie(-name => 'foo',
-value => 'bar',
lib/CGI/Apache2/Wrapper.pm view on Meta::CPAN
-domain => '.capricorn.com',
-path => '/cgi-bin/database',
-secure => 1
);
which is an object of the L<CGI::Apache2::Wrapper::Cookie>
class. The arguments accepted are
=over
=item * I<-name>
lib/CGI/Apache2/Wrapper.pm view on Meta::CPAN
A list of all cookie names can be obtained by calling
I<cookie> without any arguments:
my @names = $cgi->cookie();
See also L<CGI::Apache2::Wrapper::Cookie> for a
L<CGI::Cookie>-compatible interface to cookies.
=head2 Apache2::Upload
Uploads can be handled with the I<upload> method:
view all matches for this distribution
view release on metacpan or search on metacpan
sub disp_header {
my ($s, $q, $ar, $prt, $add_ct) = @_;
my $ck = (exists $ar->{_cookie} && $ar->{_cookie}
&& ref($ar->{_cookie}) =~ /^ARRAY/ ) ? $ar->{_cookie} : [];
# for my $i (0..$#$ck) { my $c = $ck->[$i]; print "Set-Cookie: $c\n"; }
my $f_ma = " <meta name=\"%s\" content=\"%s\" />\n";
my $f_ss = " <link rel=\"stylesheet\" type=\"text/css\" href=\"%s\" />\n";
my $f_sc = "<script src=\"%s\" type=\"text/javascript\"></script>\n";
my $f_s2 = "<script type=\"text/javascript\">\n%s\n</script>\n";
view all matches for this distribution
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
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
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
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
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
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
view release on metacpan or search on metacpan
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",
);
}
{
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
view release on metacpan or search on metacpan
# Since $cookie and $p3p may be array references,
# we must stringify them before CR escaping is done.
my @cookie;
for (ref($cookie) eq 'ARRAY' ? @{$cookie} : $cookie) {
my $cs = UNIVERSAL::isa($_,'CGI::Cookie') ? $_->as_string : $_;
push(@cookie,$cs) if defined $cs and $cs ne '';
}
$p3p = join ' ',@$p3p if ref($p3p) eq 'ARRAY';
# CR escaping for values, per RFC 822
push(@header,"Status: $status") if $status;
push(@header,"Window-Target: $target") if $target;
push(@header,"P3P: policyref=\"/w3c/p3p.xml\", CP=\"$p3p\"") if $p3p;
# push all the cookies -- there may be several
push(@header,map {"Set-Cookie: $_"} @cookie);
# if the user indicates an expiration time, then we need
# both an Expires and a Date header (so that the browser is
# uses OUR clock)
push(@header,"Expires: " . expires($expires))
if $expires;
'-Location'=> $url,
'-nph' => $nph);
unshift(@o,'-Target'=>$target) if $target;
unshift(@o,'-Type'=>'');
my @unescaped;
unshift(@unescaped,'-Cookie'=>$cookie) if $cookie;
return $self->header((map {$self->unescapeHTML($_)} @o),@unescaped);
}
#### Method: start_html
# Canned HTML header
return $url
}
#### Method: cookie
# Set or read a cookie from the specified name.
# Cookie can then be passed to header().
# Usual rules apply to the stickiness of -value.
# Parameters:
# -name -> name for this cookie (optional)
# -value -> value of this cookie (scalar, array or hash)
# -path -> paths for which this cookie is valid (optional)
sub cookie {
my($self,@p) = self_or_default(@_);
my($name,$value,$path,$domain,$secure,$expires,$httponly,$max_age,$samesite,$priority) =
rearrange([NAME,[VALUE,VALUES],PATH,DOMAIN,SECURE,EXPIRES,HTTPONLY,'MAX-AGE',SAMESITE,PRIORITY],@p);
require CGI::Cookie;
# if no value is supplied, then we retrieve the
# value of the cookie, if any. For efficiency, we cache the parsed
# cookies in our state variables.
unless ( defined($value) ) {
$self->{'.cookies'} = CGI::Cookie->fetch unless $COOKIE_CACHE && exists $self->{'.cookies'};
# If no name is supplied, then retrieve the names of all our cookies.
return () unless $self->{'.cookies'};
return keys %{$self->{'.cookies'}} unless $name;
return () unless $self->{'.cookies'}->{$name};
push(@param,'-httponly'=>$httponly) if $httponly;
push(@param,'-max-age'=>$max_age) if $max_age;
push(@param,'-samesite'=>$samesite) if $samesite;
push(@param,'-priority'=>$priority) if $priority;
return CGI::Cookie->new(@param);
}
sub parse_keywordlist {
my($self,$tosplit) = @_;
$tosplit = unescape($tosplit); # unescape the keywords
# is returned.
####
sub raw_cookie {
my($self,$key) = self_or_CGI(@_);
require CGI::Cookie;
if (defined($key)) {
$self->{'.raw_cookies'} = CGI::Cookie->raw_fetch
unless $self->{'.raw_cookies'};
return () unless $self->{'.raw_cookies'};
return () unless $self->{'.raw_cookies'}->{$key};
return $self->{'.raw_cookies'}->{$key};
view all matches for this distribution