view release on metacpan or search on metacpan
TreeDumper.pm view on Meta::CPAN
if this option is set, B<Data::TreeDumper> will use it instead for the console width.
=head1 Custom Rendering
B<Data::TreeDumper> has a plug-in interface for other rendering formats. The renderer callbacks are
set by overriding the native renderer. Thanks to Stevan Little author of Tree::Simple::View for getting
B<Data::TreeDumper> on this track. Check B<Data::TreeDumper::Renderer::DHTML>.
DumpTree
(
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Validator.pm view on Meta::CPAN
If it is a CODE reference, it is called in scalar context as
C<< $default->($validator, $rule, $args) >> and its return value
is used as a default value.
Because arguments are validated in the order of definitions, C<default>
callbacks can rely on the previously-filled values:
my $v = Data::Validator->new(
foo => { default => 99 },
bar => { default => sub {
my($validator, $this_rule, $args) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
the field.
* Result's value is no longer serialized.
0.10
* Change post_check's calling convention after reading some wisdom from
nuffin: http://blog.woobling.org/2009/09/method-style-callbacks.html
* Change internal API to use a field class rather than a bunch of hashes.
0.09
* Document check order
* Clean up post-check test a bit
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Visitor/Callback.pm view on Meta::CPAN
package Data::Visitor::Callback;
use Moose;
# ABSTRACT: A Data::Visitor with callbacks.
our $VERSION = '0.32';
use Data::Visitor ();
use Carp qw(carp);
lib/Data/Visitor/Callback.pm view on Meta::CPAN
use constant DEBUG => Data::Visitor::DEBUG();
use constant FIVE_EIGHT => ( $] >= 5.008 );
extends qw(Data::Visitor);
has callbacks => (
isa => "HashRef",
is => "rw",
default => sub { {} },
);
has class_callbacks => (
isa => "ArrayRef",
is => "rw",
default => sub { [] },
);
lib/Data/Visitor/Callback.pm view on Meta::CPAN
my $args = $class->SUPER::BUILDARGS(@args);
my %init_args = map { $_->init_arg => undef } $class->meta->get_all_attributes;
my %callbacks = map { $_ => $args->{$_} } grep { not exists $init_args{$_} } keys %$args;
my @class_callbacks = do {
no strict 'refs';
grep {
# this check can be half assed because an ->isa check will be
# performed later. Anything that cold plausibly be a class name
# should be included in the list, even if the class doesn't
# actually exist.
m{ :: | ^[A-Z] }x # if it looks kinda lack a class name
or
scalar keys %{"${_}::"} # or it really is a class
} keys %callbacks;
};
# sort from least derived to most derived
@class_callbacks = sort { !$a->isa($b) <=> !$b->isa($a) } @class_callbacks;
return {
%$args,
callbacks => \%callbacks,
class_callbacks => \@class_callbacks,
};
}
sub visit {
my $self = shift;
lib/Data/Visitor/Callback.pm view on Meta::CPAN
$data = $self->callback_and_reg( object => $data );
my $class_cb = 0;
foreach my $class ( grep { $data->isa($_) } @{ $self->class_callbacks } ) {
last unless blessed($data);
die "Unexpected object $data found"
unless $data->isa($class);
$self->trace( flow => class_callback => $class, on => $data ) if DEBUG;
lib/Data/Visitor/Callback.pm view on Meta::CPAN
}
sub callback {
my ( $self, $name, $data, @args ) = @_;
if ( my $code = $self->callbacks->{$name} ) {
$self->trace( flow => callback => $name, on => $data ) if DEBUG;
if ( wantarray ) {
my @ret = $self->$code( $data, @args );
return $self->ignore_return_values ? ( $data, @args ) : @ret;
} else {
lib/Data/Visitor/Callback.pm view on Meta::CPAN
=encoding UTF-8
=head1 NAME
Data::Visitor::Callback - A Data::Visitor with callbacks.
=head1 VERSION
version 0.32
=head1 SYNOPSIS
use Data::Visitor::Callback;
my $v = Data::Visitor::Callback->new(
# you can provide callbacks
# $_ will contain the visited value
value => sub { ... },
array => sub { ... },
lib/Data/Visitor/Callback.pm view on Meta::CPAN
# 'visit_ref' callback which normally traverse unblessed references
object => "visit_ref",
# you can also use class names as callbacks
# the callback will be invoked on all objects which inherit that class
'Some::Class' => sub {
my ( $v, $obj ) = @_; # $v is the visitor
lib/Data/Visitor/Callback.pm view on Meta::CPAN
$v->visit( $some_perl_value );
=head1 DESCRIPTION
This is a L<Data::Visitor> subclass that lets you invoke callbacks instead of
needing to subclass yourself.
=head1 METHODS
=over 4
=item new %opts, %callbacks
Construct a new visitor.
The options supported are:
=over 4
=item ignore_return_values
When this is true (off by default) the return values from the callbacks are
ignored, thus disabling the fmapping behavior as documented in
L<Data::Visitor>.
This is useful when you want to modify $_ directly
lib/Data/Visitor/Callback.pm view on Meta::CPAN
=back
=head1 CALLBACKS
Use these keys for the corresponding callbacks.
The callback is in the form:
sub {
my ( $visitor, $data ) = @_;
lib/Data/Visitor/Callback.pm view on Meta::CPAN
You can use any class name as a callback. This is called only after the
C<object> callback.
If the object C<isa> the class then the callback will fire.
These callbacks are called from least derived to most derived by comparing the
classes' C<isa> at construction time.
=item object_no_class
Called for every object that did not have a class callback.
=item object_final
The last callback called for objects, useful if you want to post process the
output of any class callbacks.
=item array
Called for array references.
view all matches for this distribution
view release on metacpan or search on metacpan
unblessed references
2005-11-14 19:23 Guido Flohr <guido.flohr@cantanea.com>
* README, lib/Data/Walk.pm, t/TC_Copy.pm, t/TS_All.pm: implemented
call-by-reference for preprocessing callbacks
2005-11-14 18:35 Guido Flohr <guido.flohr@cantanea.com>
* README, lib/Data/Walk.pm, t/TC_Follow.pm, t/TS_All.pm: handle
cyclic references correctly
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Database/Abstraction.pm view on Meta::CPAN
# in scalar assignment in error_diag
# RT121127
# auto_diag => 1,
auto_diag => 0,
# Don't do this, it causes "Attempt to free unreferenced scalar"
# callbacks => {
# after_parse => sub {
# my ($csv, @rows) = @_;
# my @rc;
# foreach my $row(@rows) {
# if($row->[0] !~ /^#/) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Date/Holidays/PL.pm view on Meta::CPAN
# Params::Validate config
my $ValidateOpts = {
year => {
type => SCALAR,
regex => qr/^\d{4}$/,
callbacks => {
'between 1951 and 9999' => sub {
shift >= 1951
},
},
},
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DateTime/Calendar/Chinese.pm view on Meta::CPAN
cycle => {
default => 1,
},
cycle_year => {
default => 1,
callbacks => {
'is between 1 and 60' => sub { $_[0] >= 1 && $_[0] <= 60 }
}
},
month => {
default => 1,
callbacks => {
'is between 1 and 12' => sub { $_[0] >= 1 && $_[0] <= 12 }
}
},
leap_month => {
default => 0,
lib/DateTime/Calendar/Chinese.pm view on Meta::CPAN
default => 1,
type => Params::Validate::SCALAR()
},
hour => {
type => Params::Validate::SCALAR(), default => 0,
callbacks => {
'is between 0 and 23' => sub { $_[0] >= 0 && $_[0] <= 23 },
},
},
minute => {
type => Params::Validate::SCALAR(), default => 0,
callbacks => {
'is between 0 and 59' => sub { $_[0] >= 0 && $_[0] <= 59 },
},
},
second => {
type => Params::Validate::SCALAR(), default => 0,
callbacks => {
'is between 0 and 61' => sub { $_[0] >= 0 && $_[0] <= 61 },
},
},
nanosecond => {
type => Params::Validate::SCALAR(), default => 0,
callbacks => {
'cannot be negative' => sub { $_[0] >= 0 },
}
},
locale => { type => Params::Validate::SCALAR() | Params::Validate::OBJECT(), optional => 1 },
language => { type => Params::Validate::SCALAR() | Params::Validate::OBJECT(), optional => 1 },
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DateTime/Calendar/Discordian.pm view on Meta::CPAN
my %args = validate(
@arguments,
{
day => {
callbacks => {
q{between 1 and 73 or St. Tib's Day} => sub {
my ( $day, $opts ) = @_;
if ( $day =~ $tibsday ) {
if ( !defined $opts->{season} ) {
return 1;
lib/DateTime/Calendar/Discordian.pm view on Meta::CPAN
},
},
},
season => {
default => undef,
callbacks => {
'valid season name' => sub {
my ( $season, $opts ) = @_;
if ( defined $season ) {
return scalar grep { /((?-x)$season)/imsx }
keys %seasons;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DateTime/Calendar/FrenchRevolutionary.pm view on Meta::CPAN
use DateTime::Calendar::FrenchRevolutionary::Locale;
my $BasicValidate =
{ year => { type => SCALAR },
month => { type => SCALAR, default => 1,
callbacks =>
{ 'is between 1 and 13' =>
sub { $_[0] >= 1 && $_[0] <= 13 }
},
},
day => { type => SCALAR, default => 1,
callbacks =>
{ 'is between 1 and 30' =>
sub { $_[0] >= 1 && $_[0] <= 30 },
},
},
hour => { type => SCALAR, default => 0,
callbacks =>
{ 'is between 0 and 9' =>
sub { $_[0] >= 0 && $_[0] <= 9 },
},
},
minute => { type => SCALAR, default => 0,
callbacks =>
{ 'is between 0 and 99' =>
sub { $_[0] >= 0 && $_[0] <= 99 },
},
},
second => { type => SCALAR, default => 0,
callbacks =>
{ 'is between 0 and 99' =>
sub { $_[0] >= 0 && $_[0] <= 99 },
},
},
abt_hour => { type => SCALAR, default => 0,
callbacks =>
{ 'is between 0 and 23' =>
sub { $_[0] >= 0 && $_[0] <= 23 },
},
},
abt_minute => { type => SCALAR, default => 0,
callbacks =>
{ 'is between 0 and 59' =>
sub { $_[0] >= 0 && $_[0] <= 59 },
},
},
abt_second => { type => SCALAR, default => 0,
callbacks =>
{ 'is between 0 and 61' =>
sub { $_[0] >= 0 && $_[0] <= 61 },
},
},
nanosecond => { type => SCALAR, default => 0,
callbacks =>
{ 'cannot be negative' =>
sub { $_[0] >= 0 },
}
},
locale => { type => SCALAR | OBJECT,
callbacks =>
{ "only 'fr', 'en', 'es' and 'it' possible" =>
sub { ($_[0] eq 'fr') or ($_[0] eq 'en')
or ($_[0] eq 'es')
or ($_[0] eq 'it')
or ref($_[0]) =~ /(?:en|es|fr|it)$/ },
lib/DateTime/Calendar/FrenchRevolutionary.pm view on Meta::CPAN
};
my $NewValidate =
{ %$BasicValidate,
time_zone => { type => SCALAR | OBJECT,
callbacks =>
{ "only 'floating' possible" =>
sub { ($_[0] eq 'floating') or ref($_[0]) and $_[0]->is_floating },
},
default => 'floating' },
};
view all matches for this distribution
view release on metacpan or search on metacpan
sub new {
my $class = shift;
my %p = validate( @_,
{ year => { type => SCALAR },
month => { type => SCALAR, default => 1,
callbacks => {
'is between 1 and 13' =>
sub { $_[0] >= 1 && $_[0] <= 13 }
}
},
day => { type => SCALAR, default => 1,
callbacks => {
'is between 1 and 30' =>
sub { $_[0] >= 1 && $_[0] <= 30 }
}
},
hour => { type => SCALAR, default => 0,
callbacks => {
'is between 0 and 23' =>
sub { $_[0] >= 0 && $_[0] <= 23 }
}
},
minute => { type => SCALAR, default => 0,
callbacks => {
'is between 0 and 59' =>
sub { $_[0] >= 0 && $_[0] <= 59 }
}
},
second => { type => SCALAR, default => 0,
callbacks => {
'is between 0 and 59' =>
sub { $_[0] >= 0 && $_[0] <= 59 }
}
},
nanosecond => { type => SCALAR, default => 0,
callbacks => {
'is between 0 and 999999999' =>
sub { $_[0] >= 0 && $_[0] <= 999999999 }
}
},
sunset => { type => OBJECT, optional => 1 },
sub set {
my $self = shift;
my %p = validate( @_,
{ year => { type => SCALAR, optional => 1 },
month => { type => SCALAR, optional => 1,
callbacks => {
'is between 1 and 13' =>
sub { $_[0] >= 1 && $_[0] <= 13 }
}
},
day => { type => SCALAR, optional => 1,
callbacks => {
'is between 1 and 30' =>
sub { $_[0] >= 1 && $_[0] <= 30 }
}
},
hour => { type => SCALAR, optional => 1,
callbacks => {
'is between 0 and 23' =>
sub { $_[0] >= 0 && $_[0] <= 23 }
}
},
minute => { type => SCALAR, optional => 1,
callbacks => {
'is between 0 and 59' =>
sub { $_[0] >= 0 && $_[0] <= 59 }
}
},
second => { type => SCALAR, optional => 1,
callbacks => {
'is between 0 and 59' =>
sub { $_[0] >= 0 && $_[0] <= 59 }
}
},
nanosecond => { type => SCALAR, optional => 1,
callbacks => {
'is between 0 and 999999999' =>
sub { $_[0] >= 0 && $_[0] <= 999999999 }
}
},
sunset => { type => OBJECT, optional => 1 },
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DateTime/Calendar/Japanese.pm view on Meta::CPAN
optional => 1,
},
hour => {
type => Params::Validate::SCALAR(),
default => 1,
callbacks => { 'is between 1 and 12' =>
sub { $_[0] >= 1 && $_[0] <= 12 } }
},
hour_quarter => {
type => Params::Validate::SCALAR(),
default => 1,
callbacks => { 'is between 1 and 4' =>
sub { $_[0] >= 1 && $_[0] <= 4 } }
},
cycle => {
default => 1,
},
cycle_year => {
default => 1,
callbacks => {
'is between 1 and 60' => sub { $_[0] >= 1 && $_[0] <= 60 }
}
},
month => {
default => 1,
callbacks => {
'is between 1 and 12' => sub { $_[0] >= 1 && $_[0] <= 12 }
}
},
leap_month => {
default => 0,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DateTime/Event/Cron.pm view on Meta::CPAN
sub as_set {
# Return self as DateTime::Set
my $self = shift;
my %sparms = @_;
Carp::cluck "Recurrence callbacks overriden by ". ref $self . "\n"
if $sparms{next} || $sparms{recurrence} || $sparms{previous};
delete $sparms{next};
delete $sparms{previous};
delete $sparms{recurrence};
$sparms{next} = sub { $self->next(@_) };
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DateTime/Event/NameDay.pm view on Meta::CPAN
my $self = shift;
my %p = validate( @_,
{ country => { type => SCALAR,
optional => 1,
callbacks =>
{'known day mapping' => \&_check_country }
},
date_args => { type => HASHREF,
default => {},
},
lib/DateTime/Event/NameDay.pm view on Meta::CPAN
{
my $self = shift;
my %p = validate( @_,
{ country => { type => SCALAR,
optional => 1,
callbacks =>
{'known day mapping' => \&_check_country }
},
date => { type => OBJECT,
can => 'utc_rd_values',
},
lib/DateTime/Event/NameDay.pm view on Meta::CPAN
sub get_namedays {
my $self = shift;
my %p = validate( @_,
{ country => { type => SCALAR,
optional => 1,
callbacks =>
{'known day mapping' => \&_check_country }
},
date_args => { type => HASHREF,
default => undef,
},
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DateTime/Format/Builder.pm view on Meta::CPAN
When a simple single specification is given for a method, the method isn't
given a single parser directly. It's given a wrapper that will call C<on_fail>
if the single parser returns C<undef>. The single parser must return C<undef>
so that a multiple parser can work nicely and actual errors can be thrown from
any of the callbacks.
Similarly, any multiple parsers will only call C<on_fail> right at the end
when it's tried all it could.
C<on_fail> (see L<later|/on_fail>) is defined, by default, to throw an error.
Multiple parser specifications can also specify C<on_fail> with a coderef as
an argument in the options block. This will take precedence over the
inheritable and overrideable method.
That said, don't throw real errors from callbacks in multiple parser
specifications unless you really want parsing to stop right there and not try
any other parsers.
In summary: calling a B<method> will result in either a C<DateTime> object
being returned or an error being thrown (unless you've overridden C<on_fail>
lib/DateTime/Format/Builder.pm view on Meta::CPAN
parser specification.
=item * label
B<label> provides a name for the specification and is passed to some of the
callbacks about to mentioned.
=item * on_match and on_fail
B<on_match> and B<on_fail> are callbacks. Both routines will be called with
parameters of:
=over 4
=item * input
B<input> is the input to the parser (after any preprocessing callbacks).
=item * label
B<label> is the label of the parser if there is one.
lib/DateTime/Format/Builder.pm view on Meta::CPAN
This all said, I generally wouldn't recommend using this feature unless you
have to.
=head2 Callbacks
I mention a number of callbacks in this document.
Any time you see a callback being mentioned, you can, if you like, substitute
an arrayref of coderefs rather than having the straight coderef.
=head1 MULTIPLE SPECIFICATIONS
lib/DateTime/Format/Builder.pm view on Meta::CPAN
=back
=head1 EXECUTION FLOW
Builder allows you to plug in a fair few callbacks, which can make following
how a parse failed (or succeeded unexpectedly) somewhat tricky.
=head2 For Single Specifications
A single specification will do the following:
lib/DateTime/Format/Builder.pm view on Meta::CPAN
L<DateTime::Format::W3CDTF> and the encouragement to rewrite these docs almost
100%!
Claus Färber (CFAERBER) for having me get around to fixing the
auto-constructor writing, providing the 'args'/'self' patch, and suggesting
the multi-callbacks.
Rick Measham (RICKM) for L<DateTime::Format::Strptime> which Builder now
supports.
Matthew McGillis for pointing out that C<on_fail> overriding should be
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DateTime/Format/Epoch.pm view on Meta::CPAN
sub new {
my $class = shift;
my %p = validate( @_,
{ epoch => {type => OBJECT,
can => 'utc_rd_values'},
unit => {callbacks =>
{'valid unit' =>
sub { exists $units_per_second{$_[0]}
or $_[0] > 0 }},
default => 'seconds'},
type => {regex => qr/^(?:int|float|bigint)$/,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DateTime/Format/Human.pm view on Meta::CPAN
my %args = validate( @_,
{
evening => {
type => SCALAR,
callbacks => {
'is >= 0 <= 23' => sub { $_[0] >= 0 && $_[0] <= 23 },
'is integer' => sub { $_[0] =~ /^\d+$/ },
},
default => $evening,
},
night => {
type => SCALAR,
callbacks => {
'is >= 0 <= 23' => sub { $_[0] >= 0 && $_[0] <= 23 },
'is integer' => sub { $_[0] =~ /^\d+$/ },
},
default => $night,
},
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DateTime/Format/Japanese.pm view on Meta::CPAN
my $self = shift;
my $current = $self->{number_format};
if (@_) {
my($val) = validate_pos(@_, {
type => SCALAR,
callbacks => {
'is valid number_format' => \&DateTime::Format::Japanese::Common::_valid_number_format
}
});
$self->{number_format} = $val;
}
lib/DateTime/Format/Japanese.pm view on Meta::CPAN
my $self = shift;
my $current = $self->{year_format};
if (@_) {
my($val) = validate_pos(@_, {
type => SCALAR,
callbacks => {
'is valid year_format' => \&DateTime::Format::Japanese::Common::_valid_year_format
}
});
$self->{year_format} = $val;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DateTime/Format/Mail.pm view on Meta::CPAN
use vars qw( $VERSION );
my %validations = (
year_cutoff => {
type => SCALAR,
callbacks => {
'greater than or equal to zero, less than 100' => sub {
defined $_[0]
and $_[0] =~ /^ \d+ $/x
and $_[0] >= 0
and $_[0] < 100
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DateTime/Format/Natural.pm view on Meta::CPAN
validate(@_, {
demand_future => {
# SCALARREF due to boolean.pm's implementation
type => BOOLEAN | SCALARREF,
optional => true,
callbacks => {
'mutually exclusive' => sub
{
return true unless exists $_[1]->{prefer_future};
die "prefer_future provided\n";
},
lib/DateTime/Format/Natural.pm view on Meta::CPAN
},
prefer_future => {
# SCALARREF due to boolean.pm's implementation
type => BOOLEAN | SCALARREF,
optional => true,
callbacks => {
'mutually exclusive' => sub
{
return true unless exists $_[1]->{demand_future};
die "demand_future provided\n";
},
},
},
time_zone => {
type => SCALAR | OBJECT,
optional => true,
callbacks => {
'valid timezone' => sub
{
my $val = shift;
if (blessed($val)) {
return $val->isa('DateTime::TimeZone');
lib/DateTime/Format/Natural.pm view on Meta::CPAN
},
},
daytime => {
type => HASHREF,
optional => true,
callbacks => {
'valid daytime' => sub
{
my $href = shift;
my %daytimes = map { $_ => true } qw(morning afternoon evening);
if (any { !$daytimes{$_} } keys %$href) {
lib/DateTime/Format/Natural.pm view on Meta::CPAN
},
},
datetime => {
type => OBJECT,
optional => true,
callbacks => {
'valid object' => sub
{
my $obj = shift;
blessed($obj) && $obj->isa('DateTime');
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DateTime/Format/PGN.pm view on Meta::CPAN
my %args = validate( @_,
{
fix_errors => {
type => BOOLEAN,
default => 0,
callbacks => {
'is 0, 1, or undef' =>
sub { ! defined( $_[0] ) || $_[0] == 0 || $_[0] == 1 },
},
},
use_incomplete => {
type => BOOLEAN,
default => 0,
callbacks => {
'is 0, 1, or undef' =>
sub { ! defined( $_[0] ) || $_[0] == 0 || $_[0] == 1 },
},
},
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DateTime/Indic/Chandramana.pm view on Meta::CPAN
default => 0,
},
masa => {
type => SCALAR,
default => 1,
callbacks => {
'between 1 and 12' => sub { ( $_[0] > 0 && $_[0] < 13 ) },
},
},
adhikamasa => {
type => BOOLEAN,
default => 0,
callbacks =>
{ '0 or 1' => sub { ( $_[0] == 0 || $_[0] == 1 ) }, },
},
paksha => {
type => BOOLEAN,
default => 0,
callbacks =>
{ '0 or 1' => sub { ( $_[0] == 0 || $_[0] == 1 ) }, },
},
tithi => {
type => SCALAR,
default => 1,
callbacks => {
'between 1 and 14, or 15 or 30' => sub {
( $_[0] > 0 && $_[0] < 15 )
|| $_[0] == 15
|| $_[0] == 30;
},
},
},
adhikatithi => {
type => BOOLEAN,
default => 0,
callbacks =>
{ '0 or 1' => sub { ( $_[0] == 0 || $_[0] == 1 ) }, },
},
latitude => {
type => SCALAR,
default => '23.15',
callbacks => {
'between -180 and 180' =>
sub { ( $_[0] >= -180 && $_[0] < 180 ) },
},
},
longitude => {
type => SCALAR,
default => '75.76',
callbacks => {
'between -180 and 180' =>
sub { ( $_[0] >= -180 && $_[0] < 180 ) },
},
},
time_zone => {
lib/DateTime/Indic/Chandramana.pm view on Meta::CPAN
can => 'utc_rd_values',
},
latitude => {
type => SCALAR,
default => '23.15', # lat. of Avantika
callbacks => {
'between -180 and 180' =>
sub { ( $_[0] >= -180 && $_[0] < 180 ) },
},
},
longitude => {
type => SCALAR,
default => '75.76', # long. of Avantika
callbacks => {
'between -180 and 180' =>
sub { ( $_[0] >= -180 && $_[0] < 180 ) },
},
},
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DateTime/Locale/FromCLDR.pm view on Meta::CPAN
=head1 SERIALISATION
C<Locale::Unicode> supports L<Storable::Improved>, L<Storable>, L<Sereal> and L<CBOR|CBOR::XS> serialisation, by implementing the methods C<FREEZE>, C<THAW>, C<STORABLE_freeze>, C<STORABLE_thaw>
For serialisation with L<Sereal>, make sure to instantiate the L<Sereal encoder|Sereal::Encoder> with the C<freeze_callbacks> option set to true, otherwise, C<Sereal> will not use the C<FREEZE> and C<THAW> methods.
See L<Sereal::Encoder/"FREEZE/THAW CALLBACK MECHANISM"> for more information.
For L<CBOR|CBOR::XS>, it is recommended to use the option C<allow_sharing> to enable the reuse of references, such as:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DateTime/Set.pm view on Meta::CPAN
Note that this recurrence takes leap seconds into account. Consider
using C<truncate()> in this manner to avoid complicated arithmetic
problems!
It is also possible to create a recurrence by specifying either or both
of 'next' and 'previous' callbacks.
The callbacks can return C<DateTime::Infinite::Future> and
C<DateTime::Infinite::Past> objects, in order to define I<bounded
recurrences>. In this case, both 'next' and 'previous' callbacks must
be defined:
# "monthly from $dt until forever"
my $months = DateTime::Set->from_recurrence(
view all matches for this distribution
view release on metacpan or search on metacpan
examples/web/jquery-1.5.2.js view on Meta::CPAN
promiseMethods = "then done fail isResolved isRejected promise".split( " " ),
// Static reference to slice
sliceDeferred = [].slice;
jQuery.extend({
// Create a simple deferred (one callbacks list)
_Deferred: function() {
var // callbacks list
callbacks = [],
// stored [ context , args ]
fired,
// to avoid firing when already doing so
firing,
// flag to know if the deferred has been cancelled
examples/web/jquery-1.5.2.js view on Meta::CPAN
elem = args[ i ];
type = jQuery.type( elem );
if ( type === "array" ) {
deferred.done.apply( deferred, elem );
} else if ( type === "function" ) {
callbacks.push( elem );
}
}
if ( _fired ) {
deferred.resolveWith( _fired[ 0 ], _fired[ 1 ] );
}
examples/web/jquery-1.5.2.js view on Meta::CPAN
if ( !cancelled && !fired && !firing ) {
// make sure args are available (#8421)
args = args || [];
firing = 1;
try {
while( callbacks[ 0 ] ) {
callbacks.shift().apply( context, args );
}
}
finally {
fired = [ context, args ];
firing = 0;
examples/web/jquery-1.5.2.js view on Meta::CPAN
},
// Cancel
cancel: function() {
cancelled = 1;
callbacks = [];
return this;
}
};
return deferred;
},
// Full fledged deferred (two callbacks list)
Deferred: function( func ) {
var deferred = jQuery._Deferred(),
failDeferred = jQuery._Deferred(),
promise;
// Add errorDeferred methods, then and promise
examples/web/jquery-1.5.2.js view on Meta::CPAN
( callbackContext.nodeType || callbackContext instanceof jQuery ) ?
jQuery( callbackContext ) : jQuery.event,
// Deferreds
deferred = jQuery.Deferred(),
completeDeferred = jQuery._Deferred(),
// Status-dependent callbacks
statusCode = s.statusCode || {},
// ifModified key
ifModifiedKey,
// Headers (they are sent all at once)
requestHeaders = {},
examples/web/jquery-1.5.2.js view on Meta::CPAN
deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
} else {
deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
}
// Status-dependent callbacks
jqXHR.statusCode( statusCode );
statusCode = undefined;
if ( fireGlobals ) {
globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ),
examples/web/jquery-1.5.2.js view on Meta::CPAN
deferred.promise( jqXHR );
jqXHR.success = jqXHR.done;
jqXHR.error = jqXHR.fail;
jqXHR.complete = completeDeferred.done;
// Status-dependent callbacks
jqXHR.statusCode = function( map ) {
if ( map ) {
var tmp;
if ( state < 2 ) {
for( tmp in map ) {
examples/web/jquery-1.5.2.js view on Meta::CPAN
jqXHR.abort();
return false;
}
// Install callbacks on deferreds
for ( i in { success: 1, error: 1, complete: 1 } ) {
jqXHR[ i ]( s[ i ] );
}
// Get transport
examples/web/jquery-1.5.2.js view on Meta::CPAN
jsonpCallback: function() {
return jQuery.expando + "_" + ( jsc++ );
}
});
// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
var dataIsString = ( typeof s.data === "string" );
if ( s.dataTypes[ 0 ] === "jsonp" ||
examples/web/jquery-1.5.2.js view on Meta::CPAN
} );
var // #5280: next active xhr id and list of active xhrs' callbacks
xhrId = jQuery.now(),
xhrCallbacks,
// XHR used to determine supports properties
testXHR;
examples/web/jquery-1.5.2.js view on Meta::CPAN
// and has been retrieved directly (IE6 & IE7)
// we need to manually fire the callback
if ( !s.async || xhr.readyState === 4 ) {
callback();
} else {
// Create the active xhrs callbacks list if needed
// and attach the unload handler
if ( !xhrCallbacks ) {
xhrCallbacks = {};
xhrOnUnloadAbort();
}
// Add to list of active xhrs callbacks
handle = xhrId++;
xhr.onreadystatechange = xhrCallbacks[ handle ] = callback;
}
},
view all matches for this distribution
view release on metacpan or search on metacpan
t/examples/traces/1.txt view on Meta::CPAN
Memcached::libmemcached::memcached_behavior_set
Memcached::libmemcached::MEMCACHED_BEHAVIOR_RETRY_TIMEOUT
Memcached::libmemcached::memcached_behavior_set
Memcached::libmemcached::MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT
Memcached::libmemcached::memcached_behavior_set
MyLibmemcachedWrapper::_mk_callbacks (/media/sf_FictionHub/XPortal/Memcached.pm:300-346)
Scalar::Util::weaken
Memcached::libmemcached::set_callback_coderefs
Data::MessagePack::new (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/Data/MessagePack.pm:34-37)
CODE(0x4a817b8)
Cache::Memcached::libmemcached::add ((eval 27)[/opt/perl5.26.1/lib/site_perl/5.26.1/Cache/Memcached/libmemcached.pm:62]:1-12)
t/examples/traces/1.txt view on Meta::CPAN
Memcached::libmemcached::memcached_behavior_set
Memcached::libmemcached::MEMCACHED_BEHAVIOR_NO_BLOCK
Memcached::libmemcached::memcached_behavior_set
Memcached::libmemcached::MEMCACHED_BEHAVIOR_NOREPLY
Memcached::libmemcached::memcached_behavior_set
MyLibmemcachedWrapper::_mk_callbacks (/media/sf_FictionHub/XPortal/Memcached.pm:300-346)
Scalar::Util::weaken
Memcached::libmemcached::set_callback_coderefs
Data::MessagePack::new (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/Data/MessagePack.pm:34-37)
CODE(0x4a817b8)
Cache::Memcached::libmemcached::get ((eval 25)[/opt/perl5.26.1/lib/site_perl/5.26.1/Cache/Memcached/libmemcached.pm:62]:1-12)
t/examples/traces/1.txt view on Meta::CPAN
XPortal::XSL::TransformXMLLocal (/media/sf_FictionHub/XPortal/XSL.pm:205-211)
XPortal::XSL::LibXSL::TransformXMLLocal (/media/sf_FictionHub/XPortal/XSL/LibXSL.pm:147-162)
XPortal::XSL::set_hash_debug (/media/sf_FictionHub/XPortal/XSL.pm:66-82)
XPortal::XSL::LibXSL::ParseXML (/media/sf_FictionHub/XPortal/XSL/LibXSL.pm:164-201)
XML::LibXML::parse_string (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXML.pm:827-869)
XML::LibXML::_init_callbacks (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXML.pm:735-744)
XML::LibXML::InputCallback::new (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXML.pm:2277-2280)
XML::LibXML::InputCallback::init_callbacks (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXML.pm:2308-2349)
XML::LibXML::InputCallback::lib_init_callbacks
XML::LibXML::match_callback (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXML.pm:468-481)
XML::LibXML::open_callback (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXML.pm:513-526)
XML::LibXML::read_callback (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXML.pm:483-496)
XML::LibXML::close_callback (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXML.pm:498-511)
XML::LibXML::_parse_string
XML::LibXML::_auto_expand (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXML.pm:716-733)
XML::LibXML::expand_xinclude (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXML.pm:672-675)
XML::LibXML::__parser_option (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXML.pm:553-566)
XML::LibXML::_cleanup_callbacks (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXML.pm:746-749)
XML::LibXML::InputCallback::cleanup_callbacks (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXML.pm:2352-2364)
XML::LibXML::InputCallback::lib_cleanup_callbacks
CODE(0x2b3acc8)
XPortal::XSL::LibXSL::ApplyXML (/media/sf_FictionHub/XPortal/XSL/LibXSL.pm:203-237)
XPortal::Profiler::ProfileEventStart (/media/sf_FictionHub/XPortal/Profiler.pm:20-28)
Time::HiRes::gettimeofday
XPortal::XSL::LibXSL::GetReadyXSLT (/media/sf_FictionHub/XPortal/XSL/LibXSL.pm:287-292)
XML::LibXSLT::parse_stylesheet_file (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXSLT.pm:277-305)
XML::LibXSLT::_init_callbacks (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXSLT.pm:217-236)
XML::LibXML::InputCallback::new (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXML.pm:2277-2280)
XML::LibXSLT::match_callback (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXSLT.pm:135-148)
XML::LibXSLT::open_callback (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXSLT.pm:180-193)
XML::LibXSLT::read_callback (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXSLT.pm:150-163)
XML::LibXSLT::close_callback (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXSLT.pm:165-178)
XML::LibXML::InputCallback::init_callbacks (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXML.pm:2308-2349)
XML::LibXML::InputCallback::lib_init_callbacks
XML::LibXSLT::_parse_stylesheet_file
XML::LibXML::InputCallback::_callback_match (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXML.pm:2198-2223)
XML::LibXML::InputCallback::_callback_match (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXML.pm:2198-2223)
XML::LibXML::InputCallback::_callback_match (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXML.pm:2198-2223)
XML::LibXML::InputCallback::_callback_match (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXML.pm:2198-2223)
t/examples/traces/1.txt view on Meta::CPAN
XML::LibXML::InputCallback::_callback_match (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXML.pm:2198-2223)
XML::LibXML::InputCallback::_callback_match (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXML.pm:2198-2223)
XML::LibXML::InputCallback::_callback_match (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXML.pm:2198-2223)
XML::LibXML::InputCallback::_callback_match (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXML.pm:2198-2223)
XML::LibXML::InputCallback::_callback_match (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXML.pm:2198-2223)
XML::LibXSLT::_cleanup_callbacks (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXSLT.pm:238-245)
XML::LibXML::InputCallback::cleanup_callbacks (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXML.pm:2352-2364)
XML::LibXML::InputCallback::lib_cleanup_callbacks
XML::LibXSLT::match_callback (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXSLT.pm:135-148)
XPortal::Profiler::ProfileEventEnd (/media/sf_FictionHub/XPortal/Profiler.pm:39-60)
Time::HiRes::gettimeofday
XPortal::Profiler::ProfileEventStart (/media/sf_FictionHub/XPortal/Profiler.pm:20-28)
Time::HiRes::gettimeofday
XPortal::XSL::set_hash (/media/sf_FictionHub/XPortal/XSL.pm:83-111)
XML::LibXSLT::StylesheetWrapper::transform (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXSLT.pm:464-478)
XML::LibXSLT::StylesheetWrapper::_init_callbacks (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXSLT.pm:425-448)
XML::LibXSLT::StylesheetWrapper::match_callback (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXSLT.pm:343-356)
XML::LibXSLT::StylesheetWrapper::open_callback (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXSLT.pm:388-401)
XML::LibXSLT::StylesheetWrapper::read_callback (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXSLT.pm:358-371)
XML::LibXSLT::StylesheetWrapper::close_callback (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXSLT.pm:373-386)
XML::LibXML::InputCallback::init_callbacks (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXML.pm:2308-2349)
XML::LibXML::InputCallback::lib_init_callbacks
XML::LibXSLT::Stylesheet::transform
XML::LibXSLT::perl_dispatcher (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXSLT.pm:59-87)
CODE(0x83ebe28)
XPortal::Profiler::ProfileEventStart (/media/sf_FictionHub/XPortal/Profiler.pm:20-28)
Time::HiRes::gettimeofday
t/examples/traces/1.txt view on Meta::CPAN
Time::HiRes::gettimeofday
XPortal::XSL::RevisionNumber (/media/sf_FictionHub/XPortal/XSL.pm:49-55)
XPortal::Profiler::ProfileEventEnd (/media/sf_FictionHub/XPortal/Profiler.pm:39-60)
Time::HiRes::gettimeofday
XML::LibXML::Node::DESTROY
XML::LibXSLT::StylesheetWrapper::_cleanup_callbacks (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXSLT.pm:450-462)
XML::LibXML::InputCallback::cleanup_callbacks (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXML.pm:2352-2364)
XML::LibXML::InputCallback::lib_cleanup_callbacks
XML::LibXSLT::StylesheetWrapper::match_callback (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXSLT.pm:343-356)
XPortal::Profiler::ProfileEventEnd (/media/sf_FictionHub/XPortal/Profiler.pm:39-60)
Time::HiRes::gettimeofday
XML::LibXSLT::StylesheetWrapper::output_string (/opt/perl5.26.1/lib/site_perl/5.26.1/x86_64-linux-5.26.0-thread-multi-ld/XML/LibXSLT.pm:510-510)
XML::LibXSLT::Stylesheet::_output_string
view all matches for this distribution
view release on metacpan or search on metacpan
t/17-db-event-loop.t view on Meta::CPAN
# Tests that callbacks are routed properly when more than one debugger is attached
use strict;
use warnings;
use Test2::V0; no warnings 'void';
BEGIN { $^P = 0x73f } # Turn on all the debugging stuff
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Devel/CompiledCalls.pm view on Meta::CPAN
perl -MDevel::CompiledCalls=foo -e '...'
In both these cases the standard callback - which simply prints to STDERR - will
be installed.
=head2 Custom callbacks
Custom callbacks can be installed with the C<attach_callback> subroutine.
This routine is not exported and must be called with a fully qualified
function call.
=over
view all matches for this distribution
view release on metacpan or search on metacpan
- Profiling and speedups
- Collect data for path coverage
- Mutation coverage
- Regular Expression coverage
- Indicate how to increase coverage?
- BEGIN and CHECK blocks and code in modules. Requires callbacks from perl?
- Create a base class for Devel::Cover::Branch and Devel::Cover::Condition
- Handle C< $y || "${p}qqq" >
- 22:09 <@nothingmuch> return, redo, next, last, goto should probably all
be treated as short circuiting
- Add aliased subroutines to subroutine coverage
view all matches for this distribution
view release on metacpan or search on metacpan
- Add Devel::Declare::Context::Simple and
Devel::Declare::MethodInstaller::Simple as an experimental way to make
creating block- and sub-like keywords easier (Rhesa Rozendaal).
0.002999_01 - 2008-10-24
- Use B::Hooks::OP::Check to register PL_check callbacks.
- Use B::Hooks::EndOfScope instead of %^H and Scope::Guard.
- Don't segfault if HvNAME(PL_curstash) == NULL.
- Don't segfault on 5.9.5+, where PL_parser is a symbol, not a define.
- Don't delete the previous symbol table entry when shadowing subs. This
makes us work within the debugger.
view all matches for this distribution