view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
$args{path} = $args{name};
$args{path} =~ s!::!/!g;
}
$args{file} ||= "$args{base}/$args{prefix}/$args{path}.pm";
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/Acme/Songmu.pm view on Meta::CPAN
},
},
);
sub instance {
state $_instance = bless {
birthday => Time::Piece->strptime('1980-06-05', '%Y-%m-%d'),
first_name => 'Masayuki',
last_name => 'Matsuki',
}, __PACKAGE__;
}
view all matches for this distribution
view release on metacpan or search on metacpan
local/lib/perl5/Future.pm view on Meta::CPAN
no warnings 'recursion'; # Disable the "deep recursion" warning
our $VERSION = '0.34';
use Carp qw(); # don't import croak
use Scalar::Util qw( weaken blessed reftype );
use B qw( svref_2object );
use Time::HiRes qw( gettimeofday tv_interval );
# we are not overloaded, but we want to check if other objects are
require overload;
local/lib/perl5/Future.pm view on Meta::CPAN
}
sub new
{
my $proto = shift;
return bless {
ready => 0,
callbacks => [], # [] = [$type, ...]
( DEBUG ?
( do { my $at = Carp::shortmess( "constructed" );
chomp $at; $at =~ s/\.$//;
local/lib/perl5/Future.pm view on Meta::CPAN
sub wrap
{
my $class = shift;
my @values = @_;
if( @values == 1 and blessed $values[0] and $values[0]->isa( __PACKAGE__ ) ) {
return $values[0];
}
else {
return $class->done( @values );
}
local/lib/perl5/Future.pm view on Meta::CPAN
return a future. In normal circumstances is equivalent to
$future = $code->( @args )
except that if the code throws an exception, it is wrapped in a new immediate
fail future. If the return value from the code is not a blessed C<Future>
reference, an immediate fail future is returned instead to complain about this
fact.
=cut
local/lib/perl5/Future.pm view on Meta::CPAN
my $class = shift;
my ( $code, @args ) = @_;
my $f;
eval { $f = $code->( @args ); 1 } or $f = $class->fail( $@ );
blessed $f and $f->isa( "Future" ) or $f = $class->fail( "Expected " . CvNAME_FILE_LINE($code) . " to return a Future" );
return $f;
}
sub _shortmess
local/lib/perl5/Future.pm view on Meta::CPAN
$fail ? $self->failure :
();
foreach my $cb ( @$callbacks ) {
my ( $flags, $code ) = @$cb;
my $is_future = blessed( $code ) && $code->isa( "Future" );
next if $done and not( $flags & CB_DONE );
next if $fail and not( $flags & CB_FAIL );
next if $cancelled and not( $flags & CB_CANCEL );
local/lib/perl5/Future.pm view on Meta::CPAN
unless( eval { $f2 = $code->( @args ); 1 } ) {
$fseq->fail( $@ );
next;
}
unless( blessed $f2 and $f2->isa( "Future" ) ) {
$fseq->fail( "Expected " . CvNAME_FILE_LINE($code) . " to return a Future" );
next;
}
$fseq->on_cancel( $f2 );
local/lib/perl5/Future.pm view on Meta::CPAN
sub on_cancel
{
my $self = shift;
my ( $code ) = @_;
my $is_future = blessed( $code ) && $code->isa( "Future" );
$is_future or _callable( $code ) or
Carp::croak "Expected \$code to be callable or a Future in ->on_cancel";
$self->{ready} and return $self;
local/lib/perl5/Future.pm view on Meta::CPAN
sub on_ready
{
my $self = shift;
my ( $code ) = @_;
my $is_future = blessed( $code ) && $code->isa( "Future" );
$is_future or _callable( $code ) or
Carp::croak "Expected \$code to be callable or a Future in ->on_ready";
if( $self->{ready} ) {
my $fail = defined $self->{failure};
local/lib/perl5/Future.pm view on Meta::CPAN
sub unwrap
{
shift; # $class
my @values = @_;
if( @values == 1 and blessed $values[0] and $values[0]->isa( __PACKAGE__ ) ) {
return $values[0]->get;
}
else {
return $values[0] if !wantarray;
return @values;
local/lib/perl5/Future.pm view on Meta::CPAN
sub on_done
{
my $self = shift;
my ( $code ) = @_;
my $is_future = blessed( $code ) && $code->isa( "Future" );
$is_future or _callable( $code ) or
Carp::croak "Expected \$code to be callable or a Future in ->on_done";
if( $self->{ready} ) {
return $self if $self->{failure} or $self->{cancelled};
local/lib/perl5/Future.pm view on Meta::CPAN
sub on_fail
{
my $self = shift;
my ( $code ) = @_;
my $is_future = blessed( $code ) && $code->isa( "Future" );
$is_future or _callable( $code ) or
Carp::croak "Expected \$code to be callable or a Future in ->on_fail";
if( $self->{ready} ) {
return $self if not $self->{failure};
local/lib/perl5/Future.pm view on Meta::CPAN
return $self if $self->{ready};
$self->{cancelled}++;
foreach my $code ( reverse @{ $self->{on_cancel} || [] } ) {
my $is_future = blessed( $code ) && $code->isa( "Future" );
$is_future ? $code->cancel
: $code->( $self );
}
$self->_mark_ready( "cancel" );
local/lib/perl5/Future.pm view on Meta::CPAN
my $fseq;
unless( eval { $fseq = $code->( @args ); 1 } ) {
return Future->fail( $@ );
}
unless( blessed $fseq and $fseq->isa( "Future" ) ) {
return Future->fail( "Expected " . CvNAME_FILE_LINE($code) . " to return a Future" );
}
return $fseq;
}
local/lib/perl5/Future.pm view on Meta::CPAN
{
shift; # ignore this class
my ( $subs ) = @_;
foreach my $sub ( @$subs ) {
blessed $sub and $sub->isa( "Future" ) or Carp::croak "Expected a Future, got $_";
}
# Find the best prototype. Ideally anything derived if we can find one.
my $self;
ref($_) eq "Future" or $self = $_->new, last for @$subs;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Speed.pm view on Meta::CPAN
ShimabukuroHiroko
);
sub new {
my $class = shift;
my $self = bless {members => []}, $class;
$self->_initialize;
return $self;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Spinner.pm view on Meta::CPAN
$self->{y} = shift;
$self->{x} = shift;
$self->{count} = 0;
$self->{seq} = '|\\-/';
return bless( $self, $class );
}
=head2 next
Bump the spinner by one and return it.
view all matches for this distribution
view release on metacpan or search on metacpan
package Number {
sub new {
my ($class, $n) = @_;
bless \$n, $class;
}
sub add {
my ($self, $n) = @_;
Number->new($$self + $$n);
view all matches for this distribution
view release on metacpan or search on metacpan
Stegano/Stegano.pm view on Meta::CPAN
{
my ($class,$filename) = @_;
my @file;
tie @file, 'Tie::File', $filename
or croak "Cant tie filename $filename: $!";
bless \@file, $class
}
sub insert
{
my ($self,$text) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
sub new {
my $class = shift;
croak "Use a classname, not a reference for " . __PACKAGE__ . "::new"
if ref $class;
my $self = bless {}, $class;
my %args = @_;
my $acceptable = $self->_keys();
foreach (keys %args) {
croak "Unknown parameter $_" unless exists $acceptable->{$_};
$self->set($_, $args{$_});
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/String/Trim.pm view on Meta::CPAN
sub new {
my $class = shift;
$class = ref $class if ref $class;
return bless { _string => shift, }, $class;
}
sub string {
my ( $self, $string ) = @_;
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
examples/object_use_example.pl view on Meta::CPAN
#
sub new {
my $proto = shift;
my $package = __PACKAGE__;
my $class = ref($proto) || $proto || $package;
my $self = bless {}, $class;
BindParms : (
my $thing : thing [optional, default="Something Blue"];
my $other : other_thing [required, is_defined];
)
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/Acme/Syntax/Python.pm view on Meta::CPAN
_block_depth => 0,
_lambda_block => {},
_class_block => {},
_debug => $params{debug}
);
filter_add(bless \%context, $class);
}
sub error {
my ($self) = shift;
my ($message) = shift;
lib/Acme/Syntax/Python.pm view on Meta::CPAN
$self->{_lambda_block}->{$self->{_block_depth}} = 0;
s/^/$spaces\};\n/;
} elsif ($self->{_class_block}->{$self->{_block_depth}}){
my $spaces_front = _handle_spacing($self->{_block_depth}, 0);
$self->{_class_block}->{$self->{_block_depth}} = 0;
s/^/$spaces_front return bless \$self, \$class;\n$spaces\}\n/;
} else {
s/^/$spaces\}\n/;
}
-- $self->{_block_depth};
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Taboo.pm view on Meta::CPAN
our $VERSION = "0.01";
our @CENSORED = ('xxx', '***', '???', '(CENSORED)');
sub new {
my ($class, @list) = @_;
bless [@list], $class;
}
sub censor {
my ($self, $str) = @_;
my $taboo = my $replace = undef;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Teddy.pm view on Meta::CPAN
# : @init : All remaining args
# Returns : $self
# Invokes : init()
#
# If invoked with $class only,
# blesses an empty hashref and calls init() with no args.
#
# If invoked with $class and a reference,
# blesses the reference and calls init() with any remaining args.
#
sub new {
my $class = shift;
my $self = shift || {}; # default: hashref
bless ($self => $class);
$self->init(@_);
return $self;
}; ## new
lib/Acme/Teddy.pm view on Meta::CPAN
my $bear = Acme::Teddy->new( \&my_sub );
my $bear = Acme::Teddy->new( { -a => 'x' } );
my $bear = Acme::Teddy->new( [ 1, 2, 3, 4 ] );
my $bear = Acme::Teddy->new( {}, @some_data );
It will bless any reference. If invoked with C<$class> only,
blesses an empty hashref and calls L</init()> with no arguments.
If invoked with C<$class> and a reference,
blesses the reference and calls L</init()> with any remaining C<@args>.
=head2 init()
This is a placeholder method. You might want to override it in a subclass.
For common initializations, you can just invoke L</new()> with initial data.
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
$args{path} = $args{name};
$args{path} =~ s!::!/!g;
}
$args{file} ||= "$args{base}/$args{prefix}/$args{path}.pm";
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/Acme/Terror/NL.pm view on Meta::CPAN
};
sub new {
my ($class, %args) = @_;
my $self = {};
bless $self, $class;
$self->{_level} = UNKNOWN;
$self->{_level_txt} = "UNKNOWN";
return $self;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Terror/UK.pm view on Meta::CPAN
sub new {
my ($class, %args) = @_;
$class = ref($class) if (ref $class);
return bless(\%args, $class);
}
sub fetch {
my $self = shift;
my $url = 'http://www.mi5.gov.uk/';
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Terror.pm view on Meta::CPAN
sub new {
my ($class, %args) = @_;
$class = ref($class) if (ref $class);
return bless(\%args, $class);
}
sub fetch {
my $url = "http://www.dhs.gov/dhspublic/getAdvisoryCondition";
my $con = get($url);
view all matches for this distribution
view release on metacpan or search on metacpan
sub new {
my ($proto,$conf) = @_;
my $class = ref($proto) || $proto;
my $self = {};
bless($self,$class);
croak "File not supplied" unless defined $conf->{'filename'};
croak "Could not read $conf->{filename}" unless -r $conf->{'filename'};
$self->{'filename'} = $conf->{'filename'};
view all matches for this distribution
view release on metacpan or search on metacpan
sv_2uv_flags||5.009001|
sv_2uv|5.004000||p
sv_add_arena|||
sv_add_backref|||
sv_backoff|||n
sv_bless|||
sv_buf_to_ro|||
sv_buf_to_rw|||
sv_cat_decode||5.008001|
sv_catpv_flags||5.013006|
sv_catpv_mg|5.004050||p
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
inc/Module/Install.pm view on Meta::CPAN
$args{path} = $args{name};
$args{path} =~ s!::!/!g;
}
$args{file} ||= "$args{base}/$args{prefix}/$args{path}.pm";
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/Acme/Text/Viceversa.pm view on Meta::CPAN
our $VERSION = "0.07";
sub new {
my $class = shift;
return bless {}, $class;
}
my %ascii = (
q' ' => ' ', # same!
q'!' => '¡',
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/TextLayout.pm view on Meta::CPAN
sub new {
my $class = shift;
my %opts = @_;
my $self = \%opts;
bless $self, $class;
$.Class = $class;
return $self;
}
=head2 B<instantiate>
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/Capture/Tiny.pm view on Meta::CPAN
use Carp ();
use Exporter ();
use IO::Handle ();
use File::Spec ();
use File::Temp qw/tempfile tmpnam/;
use Scalar::Util qw/reftype blessed/;
# Get PerlIO or fake it
BEGIN {
local $@;
eval { require PerlIO; PerlIO->can('get_layers') }
or *PerlIO::get_layers = sub { return () };
t/lib/Capture/Tiny.pm view on Meta::CPAN
unless @opts % 2 == 0;
my $stash = { capture => { @opts } };
for ( keys %{$stash->{capture}} ) {
my $fh = $stash->{capture}{$_};
Carp::confess "Custom handle for $_ must be seekable\n"
unless ref($fh) eq 'GLOB' || (blessed($fh) && $fh->isa("IO::Seekable"));
}
# save existing filehandles and setup captures
local *CT_ORIG_STDIN = *STDIN ;
local *CT_ORIG_STDOUT = *STDOUT;
local *CT_ORIG_STDERR = *STDERR;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Tie/Eleet.pm view on Meta::CPAN
my $self = &_new; # magic call.
$self->{FH} = $fh;
# Return it.
return bless( $self, $pkg );
}
sub TIESCALAR {
# Process args.
lib/Acme/Tie/Eleet.pm view on Meta::CPAN
my $self = &_new; # magic call.
$self->{value} = undef;
# Return it.
return bless( $self, $pkg );
}
#--
# Handlers.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Tie/Formatted.pm view on Meta::CPAN
sub TIEHASH {
my $class = shift;
# Someplace to hang our hat.
bless \my($self), $class;
}
sub FETCH {
my ($self, $key) = @_;
return '' unless $key;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Timecube.pm view on Meta::CPAN
}
sub new {
my $class = shift;
my $self = {};
bless $self, $class;
$self->{ua} = LWP::UserAgent->new;
$self->{wisdom} = HTML::TreeBuilder->new_from_content( $self->{ua}->get( 'http://www.timecube.com' )->decoded_content );
$self->{wisdom} or die "Couldn't fetch wisdom...\n";
@{ $self->{verses} } = $self->{wisdom}->find_by_tag_name( 'p' );
return $self
view all matches for this distribution
view release on metacpan or search on metacpan
}
$Changed_lastval{$key}=$now;
return $e?1:undef;
}
#todo: sub unbless eller sub damn
#todo: ..se også: use Data::Structure::Util qw/unbless/;
#todo: ...og: Acme::Damn sin damn()
#todo? sub swap($$) http://www.idg.no/computerworld/article242008.ece
#todo? catal
#todo?
#void quicksort(int t, int u) int i, m; if (t >= u) return; swap(t, randint(t, u)); m = t; for (i = t + 1; i <= u; i++) if (x[i] < x[t]) swap(++m, i); swap(t, m) quicksort(t, m-1); quicksort(m+1, u);
1;
package Acme::Tools::BloomFilter;
use 5.008; use strict; use warnings; use Carp;
sub new { my($class,@p)=@_; my $self=Acme::Tools::bfinit(@p); bless $self, $class }
sub add { &Acme::Tools::bfadd }
sub addbf { &Acme::Tools::bfaddbf }
sub check { &Acme::Tools::bfcheck }
sub grep { &Acme::Tools::bfgrep }
sub grepnot { &Acme::Tools::bfgrepnot }
view all matches for this distribution