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
lib/Sidef/Parser.pm view on Meta::CPAN
pos => (pos($_) - length($name)),
error => "`$name` is either a keyword or a predefined variable!",
);
}
my $subset = bless({name => $name, class => $class_name}, 'Sidef::Variable::Subset');
unshift @{$self->{vars}{$class_name}},
{
obj => $subset,
name => $name,
lib/Sidef/Parser.pm view on Meta::CPAN
error => "`$name` is either a keyword or a predefined variable!",
);
}
my $obj =
($type eq 'func' or $type eq 'method') ? bless({name => $name, type => $type, class => $class_name}, 'Sidef::Variable::Variable')
: $type eq 'class' ? bless({name => ($built_in_obj // $name), class => $class_name}, 'Sidef::Variable::ClassInit')
: $self->fatal_error(
error => "invalid type",
reason => "expected a magic thing to happen",
code => $_,
pos => pos($_),
lib/Sidef/Parser.pm view on Meta::CPAN
# Class variable in form of `Class!var_name`
if (/\G($self->{var_name_re})!($self->{var_name_re})/goc) {
my ($class_name, $var_name) = ($1, $2);
my $class_obj = $self->parse_expr(code => \$class_name);
return (bless {class => $class_obj, name => $var_name}, 'Sidef::Variable::ClassVar');
}
# Static object (like String or nil)
if (/$self->{static_obj_re}/goc) {
return $^R;
lib/Sidef/Parser.pm view on Meta::CPAN
}
if ($name eq 'ARGV' or $name eq 'ENV') {
my $type = 'var';
my $variable = bless({name => $name, type => $type, class => $class}, 'Sidef::Variable::Variable');
unshift @{$self->{vars}{$class}},
{
obj => $variable,
name => $name,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Software/License.pm view on Meta::CPAN
sub new {
my ($class, $arg) = @_;
Carp::croak "no copyright holder specified" unless $arg->{holder};
bless $arg => $class;
}
#pod =method year
#pod
#pod =method holder
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Software/Security/Policy/Individual.pm view on Meta::CPAN
sub new {
my ($class, $arg) = @_;
Carp::croak "no maintainer is specified" unless $arg->{maintainer};
bless $arg => $class;
}
sub url { (defined $_[0]->{url} ? $_[0]->{url} :
(defined $_[0]->{git_url} ? $_[0]->{git_url} :
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;
sub sheet {
my ($book, $sheet) = @_;
$book && $sheet or return;
my $class = "Spreadsheet::Read::Sheet";
$sheet =~ m/^[0-9]+$/ && $sheet >= 1 && $sheet <= $book->[0]{sheets} and
return bless $book->[$sheet] => $class;
exists $book->[0]{sheet}{$sheet} and
return bless $book->[$book->[0]{sheet}{$sheet}] => $class;
foreach my $idx (1 .. $book->[0]{sheets}) {
$book->[$idx]{label} eq $sheet and
return bless $book->[$idx] => $class;
}
return;
} # sheet
# If option "clip" is set, remove the trailing rows and
sub attr {
my ($sheet, @id) = @_;
my $class = "Spreadsheet::Read::Attribute";
@id == 2 && $id[0] =~ m/^[0-9]+$/ && $id[1] =~ m/^[0-9]+$/ and
return bless $sheet->{attr}[$id[0]][$id[1]] => $class;
if (@id && $id[0] && exists $sheet->{$id[0]}) {
my ($c, $r) = $sheet->cell2cr ($id[0]);
return bless $sheet->{attr}[$c][$r] => $class;
}
undef;
} # attr
sub maxrow {
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
view release on metacpan or search on metacpan
lib/Storable/Improved.pm view on Meta::CPAN
{
my $self = shift( @_ );
my $class = ref( $self ) || $self;
my $args = [ __FILE__, 'r' ];
# We change the glob object into a regular hash-based one to be Storable-friendly
my $this = bless( { args => $args, class => $class } => $class );
return( $this );
}
sub IO::File::STORABLE_thaw_post_processing
{
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Stream/Reader.pm view on Meta::CPAN
Readed => 0,
Stored => 0,
Total => 0,
Error => 0
};
return bless( $self => $class );
ENDC
# Destructor
DESTROY => <<'ENDC',
return 1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/String/Formatter.pm view on Meta::CPAN
my $_codes = {
%{ $class->default_codes },
%{ $arg->{codes} || {} },
};
my $self = bless { codes => $_codes } => $class;
for (keys %METHODS) {
$self->{ $_ } = $arg->{ $_ } || do {
my $default_method = "default_$_";
$class->$default_method;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/String/Interpolate/Delayed.pm view on Meta::CPAN
sub new
{
my $class = shift;
my ($text) = @_;
bless \$text => $class;
}
sub uninterpolated
{
my $self = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Su/Log.pm view on Meta::CPAN
# Su::Log->trace( "classname:" . $class_name );
# Su::Log->trace( Dumper($class_name) );
# Add the caller class to the target list automatically.
return bless { class_name => $class_name, on => 1, level => $level }, $self;
} ## end sub new
=item is_target()
Determine whether the module is a logging target or not.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Sub/Curry.pm view on Meta::CPAN
my $code_str = "sub { \$cb->(@{[join ', ', @str]}) }";
my $self = eval $code_str or die;
#return $self if $nobless;
bless $self => $class;
_code_str($self => $code_str);
_real_spice($self => $spice);
$self->uncurried($cb);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Sub/DeferredPartial.pm view on Meta::CPAN
my $class = shift;
my $Sub = shift;
my $Free = shift;
my $Bound = shift || {};
bless { Sub => $Sub, F => $Free, B => $Bound } => $class;
}
# -----------------------------------------------------------------------------
sub Subify
# -----------------------------------------------------------------------------
{
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/Test/SubExporter/ObjGen.pm view on Meta::CPAN
sub new {
my $class = shift;
my $code = $class->can(shift);
bless { code => $code } => $class;
}
sub group {
return {
foo => sub { return 'FOO' },
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Sub/Meta.pm view on Meta::CPAN
my %args = @args == 1 && (ref $args[0]||"") ne "HASH" ? _croak "single arg must be hashref"
: @args == 1 ? %{$args[0]}
: @args;
my $self = bless \%args => $class;
$self->set_sub(delete $args{sub}) if exists $args{sub}; # build subinfo
$self->set_subname(delete $args{subname}) if exists $args{subname};
$self->set_stashname(delete $args{stashname}) if exists $args{stashname};
$self->set_fullname(delete $args{fullname}) if exists $args{fullname};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Sub/Pipeline.pm view on Meta::CPAN
sub new {
my ($class, $arg) = @_;
$arg->{on_success} ||= 'value';
my $self = bless {} => $class;
$self->order(@{ $arg->{order} }) if $arg->{order};
$self->pipe($_ => $arg->{pipe}{$_}) for (keys %{ $arg->{pipe} });
$self->on_success($arg->{on_success});
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Sub/Signatures.pm view on Meta::CPAN
misleading.
package Foo;
use Sub::Signatures qw/methods/;
sub new($class) { bless {} => $class }
sub _some_func($bar) { return scalar reverse $bar }
sub some_method($self, $bar) {
$self->{bar} = _some_func($bar);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Syntax/Feature/EachOnArray.pm view on Meta::CPAN
}
sub TIEHASH
{
my ($class, $arrayref) = @_;
bless [$arrayref, 0] => $class;
}
sub STORE
{
my ($self, $k, $v) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/TCP/Rebuild.pm view on Meta::CPAN
my %defaults = (
separator => 0,
filter => ''
);
my $self = bless { %defaults, @_ } => $class;
$self->{connections} = {};
return $self;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Tak/STDIONode.pm view on Meta::CPAN
# duplicated in Moo::Role
sub meta {
require Moo::HandleMoose::FakeMetaClass;
my $class = ref($_[0])||$_[0];
bless({ name => $class }, 'Moo::HandleMoose::FakeMetaClass');
}
1;
MOO_OBJECT
lib/Tak/STDIONode.pm view on Meta::CPAN
# duplicate from Moo::Object
sub meta {
require Moo::HandleMoose::FakeMetaClass;
my $class = ref($_[0])||$_[0];
bless({ name => $class }, 'Moo::HandleMoose::FakeMetaClass');
}
sub unimport {
my $target = caller;
_unimport_coderefs($target, $INFO{$target});
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Tangram/Expr/CursorObject.pm view on Meta::CPAN
my $classes = $schema->{classes};
$schema->check_class($class);
my @tables;
my $table_hash = { };
my $self = bless { storage => $storage, tables => \@tables, class => $class,
table_hash => $table_hash }, $pkg;
my %seen;
for my $part ($storage->{engine}->get_parts($schema->classdef($class))) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Taskwarrior/Kusarigama/Wrapper/Exception.pm view on Meta::CPAN
# ABSTRACT: Exception class for Taskwarrior::Kusarigama::Wrapper
$Taskwarrior::Kusarigama::Wrapper::Exception::VERSION = '0.12.0';
use strict;
use warnings;
sub new { my $class = shift; bless { @_ } => $class }
use overload (
q("") => '_stringify',
fallback => 1,
);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/LiquidTidy.pm view on Meta::CPAN
use Template::Liquid;
use Template::LiquidX::Tidy::Tag::include;
use Template::LiquidX::Tidy::Tag::post_url;
sub new ($class, $args) {
bless $args => $class
}
sub run ($self) {
die "No file name specified\n" unless $self->{file};
my $fh;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Term/Caca/Bitmap.pm view on Meta::CPAN
use Term::Caca;
sub new {
my ($class, $bpp, $w, $h, $pitch, $rmask, $gmask, $bmask, $amask) = @_;
my $self = Term::Caca::_create_bitmap($bpp, $w, $h, $pitch, $rmask, $gmask, $bmask, $amask);
return bless($self => $class);
}
sub set_palette {
my ($self, $red, $green, $blue, $alpha) = @_;
return Term::Caca::_set_bitmap_palette($self, $red, $green, $blue, $alpha);
view all matches for this distribution
view release on metacpan or search on metacpan
Interact.pm view on Meta::CPAN
}
sub new {
my $class = shift;
my $self = bless {} => $class;
my $args = $self->process_args( @_ );
for (keys %{ $args }) {
$self->{$_} = $args->{$_};
}
return $self;
view all matches for this distribution