Result:
found more than 823 distributions - search limited to the first 2001 files matching your query ( run in 1.767 )


Data-Random-String-Matches

 view release on metacpan or  search on metacpan

scripts/generate_index.pl  view on Meta::CPAN

						size: 12,
						weight: 'bold'
					}
				}
			}, tooltip: {
				callbacks: {
					label: function(context) {
						const raw = context.raw;
						const coverage = raw.y.toFixed(1);
						const delta = raw.delta?.toFixed(1) ?? '0.0';
						const sign = delta > 0 ? '+' : delta < 0 ? '-' : '±';

 view all matches for this distribution


Data-Region

 view release on metacpan or  search on metacpan

Region.pm  view on Meta::CPAN

=back


=head2 Associating behavior with Data::Regions

The following methods allow you to associate data and callbacks to a
tree of Data::Regions, and to request a Data::Region to perform its tree of
callbacks. 

=over 4

=item  $r->data( [$reference] )

 view all matches for this distribution


Data-SExpression

 view release on metacpan or  search on metacpan

lib/Data/SExpression.pm  view on Meta::CPAN

    return !ref($thing) ||
            ref($thing) eq "GLOB" ||
            ref($thing) eq 'Data::SExpression::Symbol';;
}

=head1 Data::SExpression::Parser callbacks

These are for internal use only, and are used to generate the data
structures returned by L</read>. 

=head2 new_cons CAR CDR

 view all matches for this distribution





Data-Startup

 view release on metacpan or  search on metacpan

t/ExtUtils/SVDmaker/Algorithm/Diff.pm  view on Meta::CPAN


In addition to the 
C<DISCARD_A>,
C<DISCARD_B>, and
C<MATCH>
callbacks supported by C<traverse_sequences>, C<traverse_balanced> supports
a C<CHANGE> callback indicating that one element got C<replaced> by another:

  traverse_sequences( \@seq1, \@seq2,
                     { MATCH => $callback_1,
                       DISCARD_A => $callback_2,

t/ExtUtils/SVDmaker/Algorithm/Diff.pm  view on Meta::CPAN


sub traverse_sequences
{
	my $a                 = shift;                                  # array ref
	my $b                 = shift;                                  # array ref
	my $callbacks         = shift || {};
	my $keyGen            = shift;
	my $matchCallback     = $callbacks->{'MATCH'} || sub { };
	my $discardACallback  = $callbacks->{'DISCARD_A'} || sub { };
	my $finishedACallback = $callbacks->{'A_FINISHED'};
	my $discardBCallback  = $callbacks->{'DISCARD_B'} || sub { };
	my $finishedBCallback = $callbacks->{'B_FINISHED'};
	my $matchVector = _longestCommonSubsequence( $a, $b, $keyGen, @_ );

	# Process all the lines in @$matchVector
	my $lastA = $#$a;
	my $lastB = $#$b;

t/ExtUtils/SVDmaker/Algorithm/Diff.pm  view on Meta::CPAN


sub traverse_balanced
{
	my $a                 = shift;                                  # array ref
	my $b                 = shift;                                  # array ref
	my $callbacks         = shift || {};
	my $keyGen            = shift;
	my $matchCallback     = $callbacks->{'MATCH'} || sub { };
	my $discardACallback  = $callbacks->{'DISCARD_A'} || sub { };
	my $discardBCallback  = $callbacks->{'DISCARD_B'} || sub { };
	my $changeCallback    = $callbacks->{'CHANGE'};
	my $matchVector = _longestCommonSubsequence( $a, $b, $keyGen, @_ );

	# Process all the lines in match vector
	my $lastA = $#$a;
	my $lastB = $#$b;

 view all matches for this distribution


Data-TableAutoSum

 view release on metacpan or  search on metacpan

TableAutoSum.pm  view on Meta::CPAN

    return 1;
}

use constant ROW_COL_TYPE => {
    type      => SCALAR | ARRAYREF,
    callbacks =>  {
        # scalar value
        'integer'          => sub { implies !ref($_[0]) => $_[0] =~ $RE{num}{int} },
            'greater than 0'   => sub { implies !ref($_[0]) => ($_[0] =~ $RE{num}{int}) && (int($_[0]) > 0) },

        # array ref

TableAutoSum.pm  view on Meta::CPAN


sub data : lvalue {
    my $self = shift; 
    my ($row, $col, $value) = validate_pos( @_,
        {type => SCALAR,
         callbacks => {'is a row' => sub {$self->{rowset}->contains(shift())}}
        },
        {type => SCALAR,
         callbacks => {'is a col' => sub {$self->{colset}->contains(shift())}}
        },
        0
    );
    $self->{data}->{$row}->{$col} = $value if defined $value;
    $self->{data}->{$row}->{$col};

 view all matches for this distribution


Data-TableReader-Decoder-HTML

 view release on metacpan or  search on metacpan

lib/Data/TableReader/Decoder/HTML.pm  view on Meta::CPAN

=head1 METHODS

=head2 parse

Unfortunately, I'm not aware of any HTML parsers that properly parse a stream on demand rather
than using callbacks, so this module simply parses all the HTML up-front and iterates the perl
data structure.  This would be a problem if you have more HTML than can fit into memory
comfortably.  Buf if that's the case, you have bigger problems ;-)

This method is called automatically the first time you invoke the iterator.  You might choose
to call it earlier in order to report errors better.

 view all matches for this distribution


Data-TableReader

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

 - Decoder::Mock now correctly handles empty tables (no rows)

Version 0.020 - 2024-04-30
 - Rename on_validation_fail -> on_validation_error
   The action codes are the same, but the callback has different arguments.
   Old callbacks applied using the attribute name 'on_validation_fail' will
   continue to work.
 - New iterator attribute 'dataset_idx', for keeping track of which dataset
   you're on.
 - Unimplemented Iterator->seek now dies as per the documentation.
   (no built-in iterator lacked support for seek, so unlikely to matter)

 view all matches for this distribution


Data-Text

 view release on metacpan or  search on metacpan

scripts/generate_index.pl  view on Meta::CPAN

						size: 12,
						weight: 'bold'
					}
				}
			}, tooltip: {
				callbacks: {
					label: function(context) {
						const raw = context.raw;
						const coverage = raw.y.toFixed(1);
						const delta = raw.delta?.toFixed(1) ?? '0.0';
						const sign = delta > 0 ? '+' : delta < 0 ? '-' : '±';

 view all matches for this distribution


Data-Trace

 view release on metacpan or  search on metacpan

lib/Data/Tie/Watch.pm  view on Meta::CPAN

Note: This is a copy of Tk's Tie::Watch.
Copied to avoid the Tk depedency.

This class module binds one or more subroutines of your devising to a
Perl variable.  All variables can have B<FETCH>, B<STORE> and
B<DESTROY> callbacks.  Additionally, arrays can define B<CLEAR>,
B<DELETE>, B<EXISTS>, B<EXTEND>, B<FETCHSIZE>, B<POP>, B<PUSH>,
B<SHIFT>, B<SPLICE>, B<STORESIZE> and B<UNSHIFT> callbacks, and hashes
can define B<CLEAR>, B<DELETE>, B<EXISTS>, B<FIRSTKEY> and B<NEXTKEY>
callbacks.  If these term are unfamiliar to you, I I<really> suggest
you read L<perltie>.

With Data::Tie::Watch you can:

 . alter a variable's value

lib/Data/Tie/Watch.pm  view on Meta::CPAN

Callback format is patterned after the Perl/Tk scheme: supply either a
code reference, or, supply an array reference and pass the callback
code reference in the first element of the array, followed by callback
arguments.  (See examples in the Synopsis, above.)

Tie::Watch provides default callbacks for any that you fail to
specify.  Other than negatively impacting performance, they perform
the standard action that you'd expect, so the variable behaves
"normally".  Once you override a default callback, perhaps to insert
debug code like print statements, your callback normally finishes by
calling the underlying (overridden) method.  But you don't have to!

lib/Data/Tie/Watch.pm  view on Meta::CPAN

Watch constructor.

The *real* constructor is Data::Tie::Watch->base_watch(),
invoked by methods in other Watch packages, depending upon the variable's
type.  Here we supply defaulted parameter values and then verify them,
normalize all callbacks and bind the variable to the appropriate package.

The watchpoint constructor method that accepts option/value pairs to
create and configure the Watch object.  The only required option is
B<-variable>.

lib/Data/Tie/Watch.pm  view on Meta::CPAN

    $watch_obj->{-value} = $$variable;

    bless $watch_obj, $class;
}

# Default scalar callbacks.

sub Destroy { undef %{ $_[0] } }
sub Fetch   { $_[0]->{-value} }
sub Store   { $_[0]->{-value} = $_[1] }

lib/Data/Tie/Watch.pm  view on Meta::CPAN

    my $watch_obj = Data::Tie::Watch->base_watch( %args );

    bless $watch_obj, $class;
}

# Default array callbacks.

sub Clear     { $_[0]->{-ptr} = () }
sub Delete    { delete $_[0]->{-ptr}->[ $_[1] ] }
sub Destroy   { undef %{ $_[0] } }
sub Exists    { exists $_[0]->{-ptr}->[ $_[1] ] }

lib/Data/Tie/Watch.pm  view on Meta::CPAN

    my $watch_obj = Data::Tie::Watch->base_watch( %args );

    bless $watch_obj, $class;
}

# Default hash callbacks.

sub Clear    { $_[0]->{-ptr} = () }
sub Delete   { delete $_[0]->{-ptr}->{ $_[1] } }
sub Destroy  { undef %{ $_[0] } }
sub Exists   { exists $_[0]->{-ptr}->{ $_[1] } }

 view all matches for this distribution


Data-Transformer

 view release on metacpan or  search on metacpan

lib/Data/Transformer.pm  view on Meta::CPAN

    'My::Class' => sub { shift->set_foo('bar') }
 );

=head1 DESCRIPTION

=head2 Data type callbacks

The basic idea is that you provide a callback subroutine for each type
of data that you wish to affect or collect information from.

The constructor, C<new()>, expects a hash with at least one of the

 view all matches for this distribution


Data-TreeDumper

 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


Data-Validator

 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


Data-Verifier

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

        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


Data-Visitor

 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


Data-Walk

 view release on metacpan or  search on metacpan

ChangeLog  view on Meta::CPAN

	  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


Database-Abstraction

 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


Date-Age

 view release on metacpan or  search on metacpan

scripts/generate_index.pl  view on Meta::CPAN

						size: 12,
						weight: 'bold'
					}
				}
			}, tooltip: {
				callbacks: {
					label: function(context) {
						const raw = context.raw;
						const coverage = raw.y.toFixed(1);
						const delta = raw.delta?.toFixed(1) ?? '0.0';
						const sign = delta > 0 ? '+' : delta < 0 ? '-' : '±';

 view all matches for this distribution


Date-Holidays-PL

 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


DateTime-Calendar-Chinese

 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


DateTime-Calendar-Discordian

 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


DateTime-Calendar-FrenchRevolutionary

 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


DateTime-Calendar-Hebrew

 view release on metacpan or  search on metacpan

Hebrew.pm  view on Meta::CPAN

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 },

Hebrew.pm  view on Meta::CPAN

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


DateTime-Calendar-Japanese

 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


DateTime-Event-Cron

 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


DateTime-Event-NameDay

 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


DateTime-Format-Builder

 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


DateTime-Format-Epoch

 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


( run in 1.767 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )