view release on metacpan or search on metacpan
}
};
sub new {
my ($class, $id) = @_;
return bless { id => $id } => $class;
}
sub id { $_[0]{id} }
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/bundled/Software/License.pm view on Meta::CPAN
my ($class, $arg) = @_;
# XXX changed from Carp::croak to die
die "no copyright holder specified" unless $arg->{holder};
bless $arg => $class;
}
sub year { defined $_[0]->{year} ? $_[0]->{year} : (localtime)[5]+1900 }
sub holder { $_[0]->{holder} }
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Module/Generic.pm view on Meta::CPAN
sub new_glob
{
my $that = shift( @_ );
my $class = ref( $that ) || $that;
no warnings 'once';
my $self = bless( \do{ local *FH } => $class );
*$self = {};
if( defined( ${ "${class}\::LOG_DEBUG" } ) )
{
*$self->{log_debug} = ${ "${class}::LOG_DEBUG" };
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Module/Starter/Plugin/CGIApp.pm view on Meta::CPAN
my $class = ref $proto || $proto;
my $self = $class->SUPER::new(%opts);
$self->{templates} = { $self->templates };
return bless $self => $class;
}
=head2 create_distro ( %args )
This method works as advertised in L<Module::Starter|Module::Starter>.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Module/Starter/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/Mojar/Cron/Date.pm view on Meta::CPAN
sub new {
my $proto = shift;
my $class = ref $proto || $proto;
my $payload = @_ ? shift : ref $proto ? $$proto : $class->today;
bless \$payload => $class;
}
sub today {
my ($d, $m , $y) = (localtime)[3, 4, 5];
return shift->new(sprintf '%04u-%02u-%02u', $y + 1900, $m + 1, $d);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Mojo/Run.pm view on Meta::CPAN
sub _constructor {
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = $class->SUPER::new;
bless $self => $class;
# install SIGCHLD handler
$SIG{'CHLD'} = sub { _sig_chld($self, @_) };
return $self;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Mojo/Webqq/Run.pm view on Meta::CPAN
sub _constructor {
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = $class->SUPER::new(@_);
bless $self => $class;
# install SIGCHLD handler
$SIG{'CHLD'} = sub { _sig_chld($self, @_) };
return $self;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Mojo/Weixin/Run.pm view on Meta::CPAN
sub _constructor {
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = $class->SUPER::new(@_);
bless $self => $class;
# install SIGCHLD handler
$SIG{'CHLD'} = sub { _sig_chld($self, @_) };
return $self;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Mojolicious/Plugin/StaticShare.pm view on Meta::CPAN
#~ if $pkg->can('import');
return $pkg->new()
if $pkg->can('new') && $pkg->can('parse');
return
unless $pkg->can('markdown');
bless {pkg=>$pkg} => $class;
}
sub parse { my $self = shift; no strict 'refs'; ($self->{pkg}.'::markdown')->(@_); }
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Mojolicious/Plugin/Vparam/Address.pm view on Meta::CPAN
use Encode qw(encode is_utf8);
sub new {
my ($class, $opts) = @_;
return bless $opts => $class;
}
=head2 parse $str
Parse address from string
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Mongoose/Engine.pm view on Meta::CPAN
}
}
else { #non-moose
my $data = delete $doc->{$name};
if ( my $data_class = ref $data ) {
$doc->{$name} = $data_class eq 'boolean' ? $data : bless $data => $class;
}
else {
push @later, { attrib => $name, value => $data };
}
}
}
return undef unless defined $doc;
bless $doc => $class_main;
for ( @later ) {
my $attr = $class_main->meta->get_attribute($_->{attrib});
if( defined $attr ) {
# works for read-only values
$attr->set_value($doc, $_->{value});
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Moo/Object.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;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/MooX/Cmd/Tester.pm view on Meta::CPAN
MooX::Cmd::Tester::Result;
sub new
{
my ($class, $arg) = @_;
bless $arg => $class;
}
}
my $res = Package::Stash->new("MooX::Cmd::Tester::Result");
for my $attr (qw(app cmd stdout stderr output error execute_rv exit_code))
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Class/MOP/Instance.pm view on Meta::CPAN
$self->inline_set_slot_value($instance, $slot_name, $self->inline_slot_access($instance, $slot_name));
}
sub inline_rebless_instance_structure {
my ($self, $instance, $class_variable) = @_;
"bless $instance => $class_variable";
}
sub _inline_get_mop_slot {
my ($self, $instance) = @_;
$self->inline_get_slot_value($instance, $RESERVED_MOP_SLOT);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/MooseX/ArrayRef/Meta/Instance.pm view on Meta::CPAN
}
override create_instance => sub {
my $meta = shift;
my $class = $meta->associated_metaclass;
bless [ (EMPTY) x $meta->slot_count ] => $class->name;
};
override clone_instance => sub {
my ($meta, $instance) = @_;
my $class = $meta->associated_metaclass;
bless [ @{$instance} ] => $class->name;
};
override get_slot_value => sub {
my ($meta, $instance, $slot_name) = @_;
my $value = $instance->[ $meta->slot_index($slot_name) ];
view all matches for this distribution
view release on metacpan or search on metacpan
lib/MooseX/ClosedHash/Meta/Instance.pm view on Meta::CPAN
}
override create_instance => sub {
my $meta = shift;
my $class = $meta->associated_metaclass;
bless($meta->get_fresh_closure => $class->name);
};
override clone_instance => sub {
my ($meta, $instance) = @_;
my $class = $meta->associated_metaclass;
bless $meta->get_fresh_closure($instance->(clone => ())) => $class->name;
};
override get_slot_value => sub {
my ($meta, $instance, $slot_name) = @_;
$instance->(fetch => $slot_name);
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Class/MOP/Instance.pm view on Meta::CPAN
$self->inline_set_slot_value($instance, $slot_name, $self->inline_slot_access($instance, $slot_name));
}
sub inline_rebless_instance_structure {
my ($self, $instance, $class_variable) = @_;
"bless $instance => $class_variable";
}
sub _inline_get_mop_slot {
my ($self, $instance) = @_;
$self->inline_get_slot_value($instance, $RESERVED_MOP_SLOT);
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/InsideOut/BaseArray.pm view on Meta::CPAN
use constant FOO => 0;
sub new {
my $class = shift;
my %p = @_;
my $self = bless [] => $class;
$self->[FOO] = $p{base_foo};
return $self;
}
sub base_foo {
view all matches for this distribution
view release on metacpan or search on metacpan
package Foo;
sub new {
my $class = shift;
bless { _class => $class }, $class;
}
package Foo::Moose;
use Moose;
use MooseX::NonMoose;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Morpheus/Key.pm view on Meta::CPAN
$key =~ s{/+}{/}g;
$key =~ s{^/*}{/}; #TODO: support relative keys?
$key =~ s{/+$}{};
bless \$key => $class;
}
sub upgrade {
map { ref $_ ? $_ : __PACKAGE__->new($_) } @_;
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/90-MooseX-NonMoose/001-basic.t view on Meta::CPAN
package Foo;
sub new {
my $class = shift;
bless { _class => $class }, $class;
}
package Foo::Mouse;
use Mouse;
use MouseX::Foreign qw(Foo);
view all matches for this distribution
view release on metacpan or search on metacpan
t/050-non-mop-integration/003-attributes-in-non-mop-inherited-class.t view on Meta::CPAN
use strict;
use warnings;
sub new {
my $class = shift;
bless { @_ } => $class;
}
}
{
package App;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Net/CIDR/MobileJP.pm view on Meta::CPAN
};
sub new {
my ($class, $stuff) = @_;
return bless {spanner => $class->_create_spanner($class->_load_config($stuff))}, $class;
}
sub _create_spanner {
my ($class, $conf) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Net/CVE.pm view on Meta::CPAN
elsif (@_ == 2) {
my %p = @_;
$r{$_} = $p{$_} for keys %p;
}
}
bless \%r => $class;
} # new
sub diag {
my $self = shift or return;
ref $self or return;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Net/DAAP/Client.pm view on Meta::CPAN
);
sub new {
my $class = shift;
my $self = bless { %Defaults } => $class;
if (@_ > 1) {
$self->_init(@_);
} elsif (@_) {
$self->{SERVER_HOST} = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Net/DHCP/Control/Generic.pm view on Meta::CPAN
Net::DHCP::Control::open_object($object, $handle) or return;
unless ($opts{callback}) {
Net::DHCP::Control::wait_for_completion($object) or return;
}
bless $self => $class;
}
for my $key (qw(obj kind handle opts auth class lazy)) {
my $methname = $key;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Net/Domain/Match.pm view on Meta::CPAN
source => $SOURCE,
cache => $CACHE,
@_,
};
my $o = bless $args => $class;
unless( -e $o->{local} ){
$o->pull;
}
view all matches for this distribution