view release on metacpan or search on metacpan
lib/Return/Value.pm view on Meta::CPAN
my ($self, $key, $value) = @_;
my $class = ref $self;
bless $self => "ain't::overloaded";
$self->{$key} = $value if @_ > 2;
my $return = $self->{$key};
bless $self => $class;
return $return;
}
sub _builder {
my %args = (type => shift);
view all matches for this distribution
view release on metacpan or search on metacpan
examples/currency.pl view on Meta::CPAN
# would have better validation
sub new {
my ( $class, $arg_for ) = @_;
$arg_for ||= {};
my $amount = $arg_for->{amount} || 0;
bless { amount => $amount } => $class;
}
sub amount {
my $self = shift;
return $self->{amount} unless @_;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Rubric/WebApp/Session.pm view on Meta::CPAN
#pod
#pod =cut
sub new {
my ($class, $data) = @_;
bless $data => $class;
}
#pod =head2 param
#pod
#pod $obj->param('foo'); # get
view all matches for this distribution
view release on metacpan or search on metacpan
t/extendingrect.t view on Meta::CPAN
my $self = $class->SUPER::new(@_);
unless ( ref $self ) {
require Carp;
Carp::confess SDL::GetError();
}
return bless $self => $class;
}
sub foo {
my $self = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
examples/My/PersistentIterator.pm view on Meta::CPAN
my $iterator;
sub new {
my $self = shift;
my $class = ref($self) || $self;
$iterator ||= (bless {_num=>shift} => $class);
}
sub next {
my $self = shift;
$self->{_num}++;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/SOAP/Transport/FTP.pm view on Meta::CPAN
while (@_) {
$class->can($_[0])
? push(@method_from, shift() => shift)
: push(@arg_from, shift)
}
my $self = bless {@arg_from} => $class;
while (@method_from) {
my($method, $param_ref) = splice(@method_from,0,2);
$self->$method(ref $param_ref eq 'ARRAY' ? @$param_ref : $param_ref)
}
return $self;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/SOAP/Transport/MQ.pm view on Meta::CPAN
while (@_) {
$class->can( $_[0] )
? push( @methods, shift() => shift )
: push( @params, shift );
}
my $self = bless {@params} => $class;
while (@methods) {
my ( $method, $params ) = splice( @methods, 0, 2 );
$self->$method( ref $params eq 'ARRAY' ? @$params : $params );
}
SOAP::Trace::objects('()');
view all matches for this distribution
view release on metacpan or search on metacpan
lib/SQL/Type/Guess.pm view on Meta::CPAN
"decimal;varchar" => 'varchar(%1$d)',
"decimal;decimal" => 'decimal(%2$d,%3$d)',
";" => '',
};
bless \%options => $class;
}
=head2 C<< $g->column_type >>
$g->guess({ foo => 1, bar => 'Hello' },{ foo => 1000, bar => 'World' });
view all matches for this distribution
view release on metacpan or search on metacpan
FH: {
package My::FH;
sub TIEHANDLE {
my ($class, $buf) = @_;
bless { buf => $buf } => $class;
}
sub PRINT {
${ shift->{buf} } .= join '', @_;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Tie/Hash/SerializedString.pm view on Meta::CPAN
my $class = shift;
my ($ref, $implementation) = @_;
croak "need a scalar ref to tie hash to" unless ref $ref eq 'SCALAR';
$implementation = "Scalar::Accessors::LikeHash::JSON" unless defined $implementation;
Module::Runtime::use_package_optimistically($implementation);
bless [$implementation, $ref] => $class;
}
for my $method (qw( STORE FETCH EXISTS DELETE CLEAR ))
{
my $lc_method = lc $method;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/SystemCatalog.pm view on Meta::CPAN
=cut
sub new {
my $class = shift;
my $dbi = shift;
my $obj = bless { dbi => $dbi, class => $class, schema => '' },$class;
$obj->{Driver} = $obj->{dbi}->{Driver}->{Name};
# Only base class can dispatch to more specific class
if ($class eq 'DBIx::SystemCatalog') {
my $driver_name = 'DBIx::SystemCatalog::'.$obj->{Driver};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Scope/Session/Flyweight.pm view on Meta::CPAN
my ( $class, %args ) = @_;
return $args{id};
}
sub new {
my ( $class, %args ) = @_;
return bless {%args} => $class;
}
my $flyweight = Test::Object->acquire( id => 10 );
my $flyweight2 = Test::Object->acquire( id => 10 );
=head1 METHODS
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Scrabble/Dict.pm view on Meta::CPAN
_undefined_as => delete $init{undefined_as} || $defaults{undefined_as},
};
$self->{_ua} = LWP::UserAgent->new(%init, cookie_jar => {});
return bless $self => $class;
}
sub define {
my ($self, $word) = (shift, lc shift);
my $ua = $self->{_ua};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Search/Fulltext/Tokenizer/Ngram.pm view on Meta::CPAN
unless (looks_like_number $token_length and $token_length > 0) {
Carp::croak('Token length must be 1+.');
}
bless +{ token_length => $token_length } => $class;
}
sub create_token_iterator {
my ($self, $text) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Search/GIN/Extract/Class.pm view on Meta::CPAN
my $meta = Class::MOP::get_metaclass_by_name($class);
my @roles = $meta && $meta->can("calculate_all_roles") ? ( map { $_->name } $meta->calculate_all_roles ) : ();
return $self->process_keys({
blessed => $class,
class => $isa,
does => \@roles,
});
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/SemVer/V2/Strict.pm view on Meta::CPAN
sub pre_release { shift->{pre_release} }
sub build_metadata { shift->{build_metadata} }
sub new {
my $class = shift;
my $self = bless {} => $class;
$self->_init_by_version_numbers if @_ == 0;
$self->_init_by_version_string(@_) if @_ == 1;
$self->_init_by_version_numbers(@_) if @_ >= 2;
view all matches for this distribution
view release on metacpan or search on metacpan
author_tools/freeze_thaw_timing.pl view on Meta::CPAN
package Foo;
sub new {
my $class= shift;
return bless( {@_} => $class );
}
sub FREEZE {
my ( $self, $serializer )= @_;
return $self->{name}; # performance
view all matches for this distribution
view release on metacpan or search on metacpan
author_tools/freeze_thaw_timing.pl view on Meta::CPAN
package Foo;
sub new {
my $class= shift;
return bless( {@_} => $class );
}
sub FREEZE {
my ( $self, $serializer )= @_;
return $self->{name}; # performance
view all matches for this distribution
view release on metacpan or search on metacpan
author_tools/freeze_thaw_timing.pl view on Meta::CPAN
my $dec = Sereal::Decoder->new();
package Foo;
sub new {
my $class = shift;
return bless({@_} => $class);
}
sub FREEZE {
my ($self, $serializer) = @_;
return $self->{name}; # performance
view all matches for this distribution
view release on metacpan or search on metacpan
Iterator/author_tools/freeze_thaw_timing.pl view on Meta::CPAN
my $dec = Sereal::Decoder->new();
package Foo;
sub new {
my $class = shift;
return bless({@_} => $class);
}
sub FREEZE {
my ($self, $serializer) = @_;
return $self->{name}; # performance
view all matches for this distribution
view release on metacpan or search on metacpan
t/130_freezethaw.t view on Meta::CPAN
package Foo;
sub new {
my $class= shift;
return bless( { bar => 1, @_ } => $class );
}
sub FREEZE {
my ( $self, $serializer )= @_;
$freeze_called= $serializer eq 'Sereal' ? 1 : 0;
view all matches for this distribution
view release on metacpan or search on metacpan
t/011_inflate.t view on Meta::CPAN
{
package Mock::Inflate::Result;
sub new {
my ($class, %args) = @_;
bless \%args => $class;
}
sub result {
shift->{result};
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Spreadsheet/Engine.pm view on Meta::CPAN
=cut
sub _new {
my $class = shift;
bless { _sheet => {} } => $class;
}
sub new {
my $class = shift;
return $class->load_data([]);
view all matches for this distribution
view release on metacpan or search on metacpan
error => undef,
sheets => 0,
sheet => { },
}];
}
bless $r => $class;
} # new
sub parsers {
ref $_[0] eq __PACKAGE__ and shift;
my @c;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Squatting/H.pm view on Meta::CPAN
# Squatting::H->new(\%attributes) -- constructor
sub new {
my ($class, $opts) = @_;
$opts ||= {};
CORE::bless { %$opts } => $class;
}
# Squatting::H->bless(\%attributes) -- like new() but directly bless $opts instead of making a shallow copy.
sub bless {
my ($class, $opts) = @_;
$opts ||= {};
CORE::bless $opts => $class;
}
# $object->extend(\%attributes) -- extend keys and values of another hashref into $self
sub extend {
my ($self, $extend) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Statistics/Covid.pm view on Meta::CPAN
'config-hash' => undef,
'datum-io' => undef,
'db-version' => undef,
},
};
bless $self => $class;
if( exists $params->{'debug'} ){ $self->debug($params->{'debug'}) }
my $debug = $self->debug();
if( exists $params->{'save-to-file'} ){ $self->save_to_file($params->{'save-to-file'}) }
if( exists $params->{'save-to-db'} ){ $self->save_to_db($params->{'save-to-db'}) }
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Statistics/Test/Sequence.pm view on Meta::CPAN
my $self = {
data => undef,
};
bless $self => $class;
return $self;
}
=head2 set_data
view all matches for this distribution