view release on metacpan or search on metacpan
t/000-report-versions.t view on Meta::CPAN
# Implementation
# Create an empty YAML::Tiny object
sub new {
my $class = shift;
bless [ @_ ], $class;
}
# Create an object from a file
sub read {
my $class = ref $_[0] ? ref shift : shift;
t/000-report-versions.t view on Meta::CPAN
}
# Create an object from a string
sub read_string {
my $class = ref $_[0] ? ref shift : shift;
my $self = bless [], $class;
my $string = $_[0];
unless ( defined $string ) {
return $self->_error("Did not provide a string to load");
}
t/000-report-versions.t view on Meta::CPAN
# Failed to load Scalar::Util
eval <<'END_PERL';
sub refaddr {
my $pkg = ref($_[0]) or return undef;
if (!!UNIVERSAL::can($_[0], 'can')) {
bless $_[0], 'Scalar::Util::Fake';
} else {
$pkg = undef;
}
"$_[0]" =~ /0x(\w+)/;
my $i = do { local $^W; hex $1 };
bless $_[0], $pkg if defined $pkg;
$i;
}
END_PERL
} else {
Scalar::Util->import('refaddr');
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/DynamoDB/20120810.pm view on Meta::CPAN
sub new {
my $class = shift;
bless { @_ }, $class
}
sub implementation { shift->{implementation} }
sub host { shift->{host} }
sub port { shift->{port} }
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/MWS/Enumeration.pm view on Meta::CPAN
*{"${class}::import"} = *Exporter::import;
foreach my $const (@_) {
my $string = $const;
my $ref = \$string;
bless $ref, $class;
*{"${class}::$const"} = sub { $ref };
push @{"${class}::EXPORT_OK"}, $const;
push @{ ${"${class}::EXPORT_TAGS"}{'all'} }, $const;
}
lib/Amazon/MWS/Enumeration.pm view on Meta::CPAN
=head2 define ( @constants )
For each string passed, installs a class method / exportable sub into the
calling subclass by that name. The value returned by that sub will be an
object blessed into the calling package which stringifies into the constant
itself, e.g. $class->CONSTANT eq 'CONSTANT';
=head2 as_string ()
The stringifier for these enums - simply dereferences the blessed scalar.
=head1 AUTHOR
Paul Driver C<< frodwith@cpan.org >>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/PAApi5/Payload.pm view on Meta::CPAN
my $class = shift;
my $partner_tag = shift or croak 'partner_tag is required';
my $marketplace = shift || 'www.amazon.com';
my $opt = shift || {};
return bless {
partner_tag => $partner_tag,
marketplace => $marketplace,
partner_type => $opt->{partner_type} || 'Associates',
}, $class;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/S3/FastUploader.pm view on Meta::CPAN
our $VERSION = '0.08';
sub new {
my $class = shift;
my $config = shift;
bless { config => $config }, $class;
}
sub upload {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/S3/Lite.pm view on Meta::CPAN
use Digest::MD5 qw(md5_base64 md5);
use English qw(-no_match_vars);
use HTTP::Tiny;
use List::Util qw(pairs);
use MIME::Base64 qw(encode_base64);
use Scalar::Util qw(blessed openhandle);
use URI::Escape qw(uri_escape_utf8);
use XML::Twig;
use Readonly;
Readonly our $TRUE => 1;
lib/Amazon/S3/Lite.pm view on Meta::CPAN
########################################################################
my ( $class, @args ) = @_;
my $options = ref $args[0] ? $args[0] : {@args};
my $self = bless $options, $class;
$self->{host} //= 's3.amazonaws.com';
$self->{secure} //= $TRUE;
$self->{timeout} //= 30;
$self->{region} //= 'us-east-1';
lib/Amazon/S3/Lite.pm view on Meta::CPAN
########################################################################
my ($self) = @_;
my $logger = $self->{logger};
if ( $logger && blessed $logger ) {
# Validate it quacks like a logger
for my $method (qw(trace debug info warn error)) {
croak "logger object must implement '$method'"
if !$logger->can($method);
}
lib/Amazon/S3/Lite.pm view on Meta::CPAN
########################################################################
my ($self) = @_;
# 1. Caller-supplied credentials object (duck-typed)
if ( my $creds = $self->{credentials} ) {
croak "credential object is not blessed.\n"
if !blessed $creds;
foreach (qw(aws_access_key_id aws_secret_access_key token)) {
my $sub = $creds->can($_) // $creds->can("get_$_");
croak "credentials object must implement $_ or get_$_\n"
lib/Amazon/S3/Lite.pm view on Meta::CPAN
}
}
my $body;
if ( openhandle($data) || ( blessed($data) && $data->can('read') ) ) {
# --- Filehandle path ---
my $content_length = $options{content_length};
# Try to stat the handle for real files; suppress warning on
# in-memory handles (IO::Scalar etc.) that have no underlying fd
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/S3/SignedURLGenerator.pm view on Meta::CPAN
$args{prefix} ||= 'https://s3.amazonaws.com';
$args{expires} ||= 3600;
$args{prefix} =~ s/\/$//; # remove last /
return bless \%args, $class;
}
sub generate_url {
my ($self, $method, $path, $headers) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/S3/Thin/ResponseParser.pm view on Meta::CPAN
sub new {
my ($class, %args) = @_;
my $xml = exists $args{xml} ? $args{xml} : XML::LibXML->new();
return bless {
xml => $xml,
}, $class;
}
sub _xpc {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/S3/Thin.pm view on Meta::CPAN
delete $self->{aws_secret_access_key};
delete $self->{aws_session_token};
}
delete $self->{credential_provider};
bless $self, $class;
$self->secure(0) unless defined $self->secure;
$self->ua($self->_default_ua) unless defined $self->ua;
$self->debug(0) unless defined $self->debug;
$self->virtual_host(0) unless defined $self->virtual_host;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/S3.pm view on Meta::CPAN
use English qw(-no_match_vars);
use HTTP::Date;
use LWP::UserAgent::Determined;
use List::Util qw( any pairs none );
use MIME::Base64 qw(encode_base64 decode_base64);
use Scalar::Util qw( reftype blessed );
use URI;
use XML::Simple;
use parent qw(Class::Accessor::Fast Exporter);
lib/Amazon/S3.pm view on Meta::CPAN
########################################################################
sub delete_public_access_block {
########################################################################
my ( $self, $bucket ) = @_;
my $bucketv2 = bless $bucket, 'Amazon::S3::BucketV2';
return $bucketv2->DeletePublicAccessBlock;
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/S3Curl/PurePerl/Digest/HMAC.pm view on Meta::CPAN
{
my($class, $key, $hasher, $block_size) = @_;
$block_size ||= 64;
$key = $hasher->new->add($key)->digest if length($key) > $block_size;
my $self = bless {}, $class;
$self->{k_ipad} = $key ^ (chr(0x36) x $block_size);
$self->{k_opad} = $key ^ (chr(0x5c) x $block_size);
$self->{hasher} = $hasher->new->add($self->{k_ipad});
$self;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/SQS/Exception.pm view on Meta::CPAN
$self->{_requestId} = $errorInfo->{RequestId} // q{};
$self->{_xml} = $errorInfo->{XML} // q{};
$self->{_httpError} = $errorInfo->{HTTPError} // q{};
}
return bless $self, $class;
}
#
# Gets error type returned by the service if available.
#
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/SQS/Consumer.pm view on Meta::CPAN
sub new {
my $class = shift;
my %args = @_;
my $me = \%args;
bless $me, $class;
$me->initialize;
return $me;
}
sub initialize {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/SQS/Simple/Base.pm view on Meta::CPAN
if (!$self->{UseIAMRole} && (!$self->{AWSAccessKeyId} || !$self->{SecretKey})) {
croak "Missing AWSAccessKey or SecretKey";
}
$self = bless($self, $class);
return $self;
}
sub _api_version {
my $self = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/SendToKindle.pm view on Meta::CPAN
smtp_port => $_[4],
smtp_user => $_[5],
smtp_password => $_[6]
};
bless $self, $class;
return $self;
}
# Sends the document.
sub send {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/Signature4/Lite.pm view on Meta::CPAN
die "access_key is required\n" if !$args{access_key};
die "secret_key is required\n" if !$args{secret_key};
die "region is required\n" if !$args{region};
return bless {
access_key => $args{access_key},
secret_key => $args{secret_key},
session_token => $args{session_token},
region => $args{region},
service => $args{service} // 's3',
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/SimpleDB.pm view on Meta::CPAN
use constant KEEP_ALIVE_CACHESIZE => 10;
sub new {
my $class = shift;
my $args = shift || {};
my $self = bless $args, $class;
croak "No aws_access_key_id" unless $self->{aws_access_key_id};
croak "No aws_secret_access_key" unless $self->{aws_secret_access_key};
unless ($self->{agent}) {
my $agent = LWP::UserAgent->new(keep_alive => KEEP_ALIVE_CACHESIZE);
$agent->timeout(10);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Ambrosia/Logger.pm view on Meta::CPAN
use File::Path;
use IO::File;
use Data::Dumper;
use Time::HiRes qw ( time );
use Scalar::Util "blessed";
use Ambrosia::error::Exceptions;
use base qw/Exporter/;
our @EXPORT = qw/logger/;
lib/Ambrosia/Logger.pm view on Meta::CPAN
_op => ( $params{-op} || '' ),
_dir => $params{-dir},
_time => {},
};
$pkg .= $key;
bless $self, $pkg;
no strict 'refs';
no warnings 'redefine';
push @{"${pkg}::ISA"}, __PACKAGE__;
lib/Ambrosia/Logger.pm view on Meta::CPAN
}
}
sub error
{
__info_ex(shift, 'ERROR: ', map { ref $_ && blessed($_) && $_->isa('Ambrosia::error::Exception::Error') ? "$_" : $_ } @_);
}
sub log
{
my ($self, @msg) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
Amethyst/Brain.pm view on Meta::CPAN
use POE;
sub new {
my $class = shift;
my $self = ($#_ == 0) ? { %{ (shift) } } : { @_ };
return bless $self, $class;
}
sub init {
my ($self) = @_;
# Not overriding this is not fatal.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amibroker/OLE/Interface.pm view on Meta::CPAN
croak("No Database path supplied to Amibroker : $!\n")
unless $self->{dbpath};
croak("Invalid Database path to Amibroker : $!\n")
unless -d $self->{dbpath};
bless $self, $class if defined $self;
return $self;
}
=head2 start_amibroker_engine()
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
$args{path} =~ s!::!/!g;
}
$args{file} ||= "$args{base}/$args{prefix}/$args{path}.pm";
$args{wrote} = 0;
bless( \%args, $class );
}
sub call {
my ($self, $method) = @_;
my $obj = $self->load($method) or return;
view all matches for this distribution
view release on metacpan or search on metacpan
t/009_csrf_defender.t view on Meta::CPAN
sub load_config { +{} }
package MyApp::Web::View;
sub new {
bless {}, shift;
}
sub render {
'<!doctype html>
<html>
<form method="post" action="/do">
view all matches for this distribution
view release on metacpan or search on metacpan
t/04_json_encoder.t view on Meta::CPAN
);
}
return $c->create_response(404, [], []);
}
__PACKAGE__->load_plugins('Web::ChromeLogger' => {
json_encoder => JSON->new->ascii(1)->convert_blessed,
});
}
my $mech = Test::WWW::Mechanize::PSGI->new(app => MyApp::Web->to_app);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amon2/Plugin/Web/CpanelJSON.pm view on Meta::CPAN
use strict;
use warnings;
use Amon2::Util ();
use Cpanel::JSON::XS ();
use Scalar::Util qw(blessed);
use HTTP::SecureHeaders;
our $VERSION = "0.01";
my %DEFAULT_CONFIG = (
lib/Amon2/Plugin/Web/CpanelJSON.pm view on Meta::CPAN
json => {
ascii => !!1, # for security
},
# for convenience
unbless_object => undef,
status_code_field => undef,
# for compatibility options
defence_json_hijacking_for_legacy_browser => !!0,
);
lib/Amon2/Plugin/Web/CpanelJSON.pm view on Meta::CPAN
}
return sub {
my ($data, $spec) = @_;
if (my $unbless_object = $conf->{unbless_object}) {
if (blessed($data)) {
$data = $unbless_object->($data, $spec);
}
}
my $output = $json->encode($data, $spec);
lib/Amon2/Plugin/Web/CpanelJSON.pm view on Meta::CPAN
=item name
Name of method. Default: 'render_json'
=item unbless_object
Default: undef
This option is preprocessing coderef encoding an blessed object in JSON.
For example, the code using L<Object::UnblessWithJSONSpec> is as follows:
use Object::UnblessWithJSONSpec ();
__PACKAGE__->load_plugins(
'Web::CpanelJSON' => {
unbless_object => \&Object::UnblessWithJSONSpec::unbless_with_json_spec,
}
);
...
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
$args{path} =~ s!::!/!g;
}
$args{file} ||= "$args{base}/$args{prefix}/$args{path}.pm";
$args{wrote} = 0;
bless( \%args, $class );
}
sub call {
my ($self, $method) = @_;
my $obj = $self->load($method) or return;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amon2/Plugin/Web/Woothee.pm view on Meta::CPAN
use warnings;
use Woothee;
sub new {
my ($class, %args) = @_;
bless \%args, $class;
}
sub user_agent { $_[0]->{user_agent} }
sub name { $_[0]->_get('name') }
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
$args{path} =~ s!::!/!g;
}
$args{file} ||= "$args{base}/$args{prefix}/$args{path}.pm";
$args{wrote} = 0;
bless( \%args, $class );
}
sub call {
my ($self, $method) = @_;
my $obj = $self->load($method) or return;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amon2.pm view on Meta::CPAN
}
sub new {
my $class = shift;
my %args = @_ == 1 ? %{ $_[0] } : @_;
bless { %args }, $class;
}
# For CLI.
sub bootstrap {
my $class = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amp/Util/Strings.pm view on Meta::CPAN
sub json_encode {
my $self = shift;
my $string = shift;
my $opts = shift;
my $json = JSON->new->allow_nonref->allow_blessed->utf8;
if ($opts->{pretty}) {
$json->pretty(1);
}
if ($opts->{indent}) {
$json->indent(1);
lib/Amp/Util/Strings.pm view on Meta::CPAN
}
sub json_decode {
my $self = shift;
my $string = shift;
my $json = JSON->new->allow_nonref->allow_blessed->utf8;
my $data;
if (defined $string) {
$data = $json->decode($string);
}
return $data;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Analizo/Batch.pm view on Meta::CPAN
use parent qw( Analizo::Filter::Client );
sub new {
my ($class, @options) = @_;
return bless { @options }, $class;
}
sub next {
my ($self) = @_;
my $next_job = $self->fetch_next();
view all matches for this distribution