view release on metacpan or search on metacpan
lib/Data/Microformat.pm view on Meta::CPAN
$fields->{$field} = undef;
}
my $class_name = $class->class_name;
my $self = bless { _class_name => $class_name, _singulars => $singulars, %$fields, config => {%opts} }, $class;
$self->_init();
return $self;
}
sub _init
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Pagination.pm view on Meta::CPAN
# Param int $current_page Current number of page
sub new {
my ($class, $total_entries, $entries_per_page, $pages_per_set, $current_page) = @_;
my $self = bless {} => $class;
# total number of entries (>= 1) (copied from arguments)
$self->{total_entries} = $total_entries;
# number of entries per page (>= 1) (copied from arguments)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Plist.pm view on Meta::CPAN
=cut
sub new {
my $class = shift;
return bless { data => undef, @_ } => $class;
}
=head2 collapse $data
Takes an array of serialized data C<$data>. Recursively
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Polipo.pm view on Meta::CPAN
$fh->seek ($offset, SEEK_SET);
}
my $d = bless {} => $ns;
my $obj = sub {wantarray ? ($fh, $res) : $d};
bless $obj => $class;
}
sub open {
return ($_[0]->())[0];
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Rx.pm view on Meta::CPAN
prefix => { },
handler => { },
sort_keys => !!$arg->{sort_keys},
};
bless $self => $class;
$self->register_type_plugin($_) for @plugins;
$self->add_prefix($_ => $arg->{prefix}{ $_ }) for keys %{ $arg->{prefix} };
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/TagHive.pm view on Meta::CPAN
#pod =cut
sub new {
my ($class) = @_;
return bless { state => {} } => $class;
}
my $tagname_re = qr{ [a-z] [-a-z0-9_]* }x;
my $tagvalue_re = qr{ [-a-z0-9_]+ }x;
my $tagpair_re = qr{ $tagname_re (?::$tagvalue_re)? }x;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Tumbler.pm view on Meta::CPAN
my %defaults = (
consumer => sub { confess "No Data::Tumbler consumer defined" },
add_path => sub { my ($path, $name ) = @_; return [ @$path, $name ] },
add_context => sub { my ($context, $value) = @_; return [ @$context, $value ] },
);
my $self = bless \%defaults => $class;
for my $attribute (qw(consumer add_path add_context)) {
next unless exists $args{$attribute};
$self->$attribute(delete $args{$attribute});
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/06_subroutine.t view on Meta::CPAN
use overload
'&{}' => 'codify',
;
sub new{
my $class = shift;
bless {@_} => $class;
}
sub codify{
my $self = shift;
$self->{code};
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DateTime/Format/Intl.pm view on Meta::CPAN
{
warn( "No error object provided and no previous error set either! It seems the previous method call returned a simple undef" );
}
else
{
$err = ( defined( $class ) ? bless( $error => $class ) : $error );
$err->code( $code ) if( defined( $code ) );
}
}
elsif( defined( $err ) &&
Scalar::Util::blessed( $err ) &&
( scalar( @_ ) == 1 ||
( scalar( @_ ) == 2 && defined( $class ) )
) )
{
$self->{error} = ${ $pack . '::ERROR' } = ( defined( $class ) ? bless( $err => $class ) : $err );
$self->{error}->code( $code ) if( defined( $code ) && $self->{error}->can( 'code' ) );
if( $self->{fatal} || ( defined( ${"${class}\::FATAL_EXCEPTIONS"} ) && ${"${class}\::FATAL_EXCEPTIONS"} ) )
{
die( $self->{error} );
lib/DateTime/Format/Intl.pm view on Meta::CPAN
}
$new = $self;
}
else
{
$new = CORE::bless( $hash => $class );
}
CORE::return( $new );
}
sub TO_JSON { return( shift->as_string ); }
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DateTime/Format/RelativeTime.pm view on Meta::CPAN
{
warn( "No error object provided and no previous error set either! It seems the previous method call returned a simple undef" );
}
else
{
$err = ( defined( $class ) ? bless( $error => $class ) : $error );
$err->code( $code ) if( defined( $code ) );
}
}
elsif( defined( $err ) &&
Scalar::Util::blessed( $err ) &&
( scalar( @_ ) == 1 ||
( scalar( @_ ) == 2 && defined( $class ) )
) )
{
$self->{error} = ${ $pack . '::ERROR' } = ( defined( $class ) ? bless( $err => $class ) : $err );
$self->{error}->code( $code ) if( defined( $code ) && $self->{error}->can( 'code' ) );
if( $self->{fatal} || ( defined( ${"${class}\::FATAL_EXCEPTIONS"} ) && ${"${class}\::FATAL_EXCEPTIONS"} ) )
{
die( $self->{error} );
lib/DateTime/Format/RelativeTime.pm view on Meta::CPAN
}
$new = $self;
}
else
{
$new = CORE::bless( $hash => $class );
}
CORE::return( $new );
}
sub TO_JSON { return( shift->as_string ); }
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DateTime/Format/Unicode.pm view on Meta::CPAN
{
warn( "No error object provided and no previous error set either! It seems the previous method call returned a simple undef" );
}
else
{
$err = ( defined( $class ) ? bless( $error => $class ) : $error );
$err->code( $code ) if( defined( $code ) );
}
}
elsif( defined( $err ) &&
Scalar::Util::blessed( $err ) &&
( scalar( @_ ) == 1 ||
( scalar( @_ ) == 2 && defined( $class ) )
) )
{
$self->{error} = ${ $pack . '::ERROR' } = ( defined( $class ) ? bless( $err => $class ) : $err );
$self->{error}->code( $code ) if( defined( $code ) && $self->{error}->can( 'code' ) );
if( $self->{fatal} || ( defined( ${"${class}\::FATAL_EXCEPTIONS"} ) && ${"${class}\::FATAL_EXCEPTIONS"} ) )
{
die( $self->{error} );
lib/DateTime/Format/Unicode.pm view on Meta::CPAN
}
$new = $self;
}
else
{
$new = CORE::bless( $hash => $class );
}
CORE::return( $new );
}
sub TO_JSON
lib/DateTime/Format/Unicode.pm view on Meta::CPAN
}
$new = $self;
}
else
{
$new = CORE::bless( $hash => $class );
}
CORE::return( $new );
}
sub TO_JSON { return( shift->as_string ); }
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DateTime/Locale/FromCLDR.pm view on Meta::CPAN
{
warn( "No error object provided and no previous error set either! It seems the previous method call returned a simple undef" );
}
else
{
$err = ( defined( $class ) ? bless( $error => $class ) : $error );
$err->code( $code ) if( defined( $code ) );
}
}
elsif( defined( $err ) &&
Scalar::Util::blessed( $err ) &&
( scalar( @_ ) == 1 ||
( scalar( @_ ) == 2 && defined( $class ) )
) )
{
$self->{error} = ${ $pack . '::ERROR' } = ( defined( $class ) ? bless( $err => $class ) : $err );
$self->{error}->code( $code ) if( defined( $code ) && $self->{error}->can( 'code' ) );
if( $self->{fatal} || ( defined( ${"${class}\::FATAL_EXCEPTIONS"} ) && ${"${class}\::FATAL_EXCEPTIONS"} ) )
{
die( $self->{error} );
lib/DateTime/Locale/FromCLDR.pm view on Meta::CPAN
}
$new = $self;
}
else
{
$new = CORE::bless( $hash => $class );
}
$new->{locale} = $locale;
$new->{_cldr} = Locale::Unicode::Data->new;
CORE::return( $new );
}
lib/DateTime/Locale/FromCLDR.pm view on Meta::CPAN
}
$new = $self;
}
else
{
$new = CORE::bless( $hash => $class );
}
CORE::return( $new );
}
sub TO_JSON { return( shift->as_string ); }
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DateTime/Moonpig.pm view on Meta::CPAN
if (@arg == 1) { return $class->from_epoch( epoch => $arg[0] ) }
my %arg = @arg;
$arg{time_zone} = 'UTC' unless exists $arg{time_zone};
bless $class->SUPER::new(%arg) => $class;
}
sub new_datetime {
my ($class, $dt) = @_;
bless $dt->clone => $class;
}
# $a is expected to be epoch seconds
sub plus {
my ($self, $a) = @_;
lib/DateTime/Moonpig.pm view on Meta::CPAN
C<as_seconds> method. C<DateTime> and C<DateTime::Moonpig> objects do I<not> provide this method.
package MyDaysInterval; # Silly example
sub new {
my ($class, $days) = @_;
bless { days => $days } => $class;
}
sub as_seconds { $_[0]{days} * 86400 }
package main;
lib/DateTime/Moonpig.pm view on Meta::CPAN
$z5 = $birthday - $x0; # -10
package Feb13; # Silly example
sub new {
my ($class) = @_;
bless [ "DUMMY" ] => $class;
}
sub epoch { return 1234567890 } # Feb 13 23:31:30 2009 UTC
package main;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Declare/Args.pm view on Meta::CPAN
sub new {
my $class = shift;
my ( %args ) = @_;
my $self = bless { args => {}, default => {} } => $class;
$self->arg( $_, $args{$_} ) for keys %args;
return $self;
}
view all matches for this distribution
view release on metacpan or search on metacpan
ex/MyModule.pm view on Meta::CPAN
@ISA = qw/ Exporter Autoloader NiceModule /;
sub new {
#This is my object oriented constructor!
my($class) = @_;
return bless {} => $class;
}
sub method1 {
my($self) = @_;
return 1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Devel/Monitor.pm view on Meta::CPAN
use Scalar::Util qw(weaken isweak);
sub new {
my ($class) = @_;
my $self = {};
bless($self => $class);
return $self;
}
sub getClassB {
my $self = shift;
lib/Devel/Monitor.pm view on Meta::CPAN
use Scalar::Util qw(weaken isweak);
sub new {
my ($class, $classA) = @_;
my $self = {};
bless($self => $class);
$self->setClassA($classA);
return $self;
}
sub setClassA {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Devel/NYTProf/Data.pm view on Meta::CPAN
return undef if $args->{callback};
print "Processing $file data\n" unless $args->{quiet};
bless $profile => $class;
my $fid_fileinfo = $profile->{fid_fileinfo};
my $sub_subinfo = $profile->{sub_subinfo};
# add profile ref so fidinfo & subinfo objects
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Devel/StatProfiler/SectionGuard.pm view on Meta::CPAN
use 5.12.0;
use warnings;
sub new {
my $class = shift;
my $self = bless({@_} => $class);
Devel::StatProfiler::start_section($self->{section_name});
return $self;
}
sub section_name { $_[0]->{section_name} }
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Devel/TrackGlobalScalar.pm view on Meta::CPAN
sub TIESCALAR {
my $class = shift;
my $instance = shift || undef;
my $name = shift;
my $o = bless [\$instance, $name] => $class;
$globals{$name} = $o;
return $o;
}
sub FETCH {
view all matches for this distribution
view release on metacpan or search on metacpan
X86/MemRegion.pm view on Meta::CPAN
use warnings;
use integer;
sub new {
my ($class, %args) = @_;
my $self = bless { } => $class;
my $mem = $args{mem};
defined $mem or $mem = "";
$self->{mem} = $mem;
$self->{len} = length($mem);
$self->{start} = $args{start} || 0;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dist/Man/Plugin/Template.pm view on Meta::CPAN
sub new {
my $class = shift;
my $self = $class->SUPER::new(@_);
$self->{templates} = { $self->templates };
$self->{renderer} = $self->renderer;
return bless $self => $class;
}
=head1 OBJECT METHODS
=head2 C<< templates() >>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dist/Zilla/Role/ErrorLogger.pm view on Meta::CPAN
use overload '""' => sub { return "Aborting...\n"; };
sub throw {
my ( $class ) = @_;
die bless( {} => $class ); ## no critic ( RequireCarping )
};
# --------------------------------------------------------------------------------------------------
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dist/Zilla/Util/ExpandINI/Reader.pm view on Meta::CPAN
my $self = {
data => [],
sections => {},
};
bless $self => $class;
$self->{current_section} = { name => $self->starting_section, lines => [], comment_lines => [] };
return $self;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Benchmark/Dumb.pm view on Meta::CPAN
# No. Users aren't meant to create new objects at this point.
sub _new {
my $class = shift;
$class = ref($class) if ref($class);
my %args = @_;
my $self = bless {} => $class;
if (defined $args{instance}) {
my $inst = $args{instance};
$self->{name} = $inst->name;
$self->{result} = $inst->result->new;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/E/Mail/Acme.pm view on Meta::CPAN
package E'Mail::Acme::HeaderFieldValues;
our @ISA = qw(E'Mail::Acme::Base);
sub TIEARRAY {
my ($class, $name, $gutter) = @_;
bless [ $name, $gutter ] => $class;
}
sub FETCHSIZE {
my ($self) = @_;
lib/E/Mail/Acme.pm view on Meta::CPAN
my $self = {
lines => [],
parts => [],
bound => time . '-' . $$ . '-' . $i++ . $^T,
};
bless $self => $class;
}
sub CLEAR {
my ($self) = @_;
$self->{lines} = [];
lib/E/Mail/Acme.pm view on Meta::CPAN
package E'Mail::Acme::HeaderField;
our @ISA = qw(E'Mail::Acme::Base);
sub TIESCALAR {
my ($class, $name, $gutter) = @_;
bless [ $name, $gutter ] => $class;
}
sub _str_first {
my ($self) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/EPUB/Parser/Util/Archive.pm view on Meta::CPAN
args(
my $class => 'ClassName',
my $data => { isa => 'Archive::Zip' },
);
bless { data => $data } => $class;
}
sub get_member_data {
args(
my $self => 'Object',
view all matches for this distribution
view release on metacpan or search on metacpan
lib/EB/Booking.pm view on Meta::CPAN
use EB::Tools::Attachments;
sub new {
my ($class) = @_;
$class = ref($class) || $class;
return bless {} => $class;
}
sub adm_open {
my ($self) = @_;
unless ( $dbh->adm_open ) {
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/ETests_CGI.pm view on Meta::CPAN
# ------------------------------------------------------------------------------
sub TIEHANDLE
{
my ($class, $start) = @_;
$start = 0;
return bless \$start => $class;
}
# ------------------------------------------------------------------------------
# READLINE()
# read line
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Email/Abstract.pm view on Meta::CPAN
$foreign = Email::Simple->new($foreign)
unless Scalar::Util::blessed($foreign);
my $adapter = $class->__class_for($foreign); # dies if none available
return bless [ $foreign, $adapter ] => $class;
}
sub __class_for {
my ($self, $foreign, $method, $skip_super) = @_;
$method ||= 'handle';
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Email/Address.pm view on Meta::CPAN
sub new {
my ($class, $phrase, $email, $comment, $orig) = @_;
$phrase =~ s/\A"(.+)"\z/$1/ if $phrase;
bless [ $phrase, $email, $comment, $orig ] => $class;
}
#pod =item purge_cache
#pod
#pod Email::Address->purge_cache;
view all matches for this distribution