view release on metacpan or search on metacpan
lib/Danga/Socket/AnyEvent.pm view on Meta::CPAN
# by default we keep running, unless a postloop callback (either per-object
# or global) cancels it
my $keep_running = 1;
# per-object post-loop-callbacks
for my $plc (values %PLCMap) {
$keep_running &&= $plc->(\%DescriptorMap, \%OtherFds);
}
# now we're at the very end, call callback if defined
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Danga/Socket/Callback.pm view on Meta::CPAN
Love the fact that Perlbal, Mogilefs, and friends all run fast because of
Danga::Socket, but despise it because you need to subclass it every time?
Well, here's a module for all you lazy people.
Danga::Socket::Callback is a thin wrapper arond Danga::Socket that allows
you to set callbacks to be called at various events. This allows you to
define multiple Danga::Socket-based sockets without defining multiple
classes:
my $first = Danga::Socket::Callback->new(
hadle => $sock1,
lib/Danga/Socket/Callback.pm view on Meta::CPAN
=head2 event_err
=head2 event_hup
Implements each method available from Danga::Socket. If the corresponding
callbacks are available, then calls the callback. Each callback receives
the Danga::Socket::Callback object.
For event_write, if no callback is available, then the default event_write
method from Danga::Socket is called.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dash.pm view on Meta::CPAN
default => sub { [] } );
has _layout => ( is => 'rw',
default => sub { {} } );
has _callbacks => ( is => 'rw',
default => sub { {} } );
has _rendered_scripts => ( is => 'rw',
default => "" );
lib/Dash.pm view on Meta::CPAN
# TODO check_callback
# TODO Callback map
my $output = $callback{Output};
my $callback_id = $self->_create_callback_id($output);
my $callbacks = $self->_callbacks;
$callbacks->{$callback_id} = \%callback;
return $self;
}
my $no_update;
my $internal_no_update = bless( \$no_update, 'Dash::Internal::NoUpdate' );
lib/Dash.pm view on Meta::CPAN
}
sub _dependencies {
my $self = shift;
my $dependencies = [];
for my $callback ( values %{ $self->_callbacks } ) {
my $rendered_callback = { clientside_function => JSON::null };
my $states = [];
for my $state ( @{ $callback->{State} } ) {
my $rendered_state = { id => $state->{component_id},
property => $state->{component_property}
lib/Dash.pm view on Meta::CPAN
sub _update_component {
my $self = shift;
my $request = shift;
if ( scalar( values %{ $self->_callbacks } ) > 0 ) {
my $callbacks = $self->_search_callback( $request->{'output'} );
if ( scalar @$callbacks > 1 ) {
die 'Not implemented multiple callbacks';
} elsif ( scalar @$callbacks == 1 ) {
my $callback = $callbacks->[0];
my @callback_arguments = ();
my $callback_context = {};
for my $callback_input ( @{ $callback->{Inputs} } ) {
my ( $component_id, $component_property ) = @{$callback_input}{qw(component_id component_property)};
for my $change_input ( @{ $request->{inputs} } ) {
lib/Dash.pm view on Meta::CPAN
} else {
return { response => "There is no matching callback" };
}
} else {
return { response => "There is no registered callbacks" };
}
return { response => "Internal error" };
}
sub _search_callback {
my $self = shift;
my $output = shift;
my $callbacks = $self->_callbacks;
my @matching_callbacks = ( $callbacks->{$output} );
return \@matching_callbacks;
}
sub _rendered_stylesheets {
return '';
}
lib/Dash.pm view on Meta::CPAN
in a callback will trigger that callback, and the output returned by the callback will update the property of
the component declared as output.
=back
So to make a Dash app you just need to setup the layout and the callbacks. The basic skeleton will be:
my $app = Dash->new(app_name => 'My Perl Dash App');
$app->layout(...);
$app->callback(...);
$app->run_server();
lib/Dash.pm view on Meta::CPAN
$app->layout(Div('This is a simple div', id => 'my-div'));
=head1 Callbacks
Callbacks are the reactive part of the web app. They listen to changes in properties of components and get fired by those changes.
The output of the callbacks can update properties for other componentes (or different properties for the same components) and
potentially firing other callbacks. So your app is "reacting" to changes. These properties that fire changes and the properties
that get updated are dependencies of the callback, they are the "links" between components and callbacks.
Every component that is expected to fire a callback must have a unique id property.
To define a callback is necessary at least:
=over 4
=item Inputs
The component property (or components properties) which fire the callback on every change. The values of this properties are inputs for the callbacks
=item Output
The component (or components) whose property (or properties) get updated
lib/Dash.pm view on Meta::CPAN
}
);
=head2 Dependencies
Dependencies "link" components and callbacks. Every callback dependency has the following attributes:
=over 4
=item component_id
lib/Dash.pm view on Meta::CPAN
=item * Main package and class for apps is Dash
=item * Component suites will use Perl package convention, I mean: dash_html_components will be Dash::Html::Components
=item * Instead of decorators we'll use plain old callbacks
=item * Callback context is available as the last parameter of the callback but without the response part
=item * Instead of Flask we'll be using L<Mojolicious> (Maybe in the future L<Dancer2>)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DashProfiler/Core.pm view on Meta::CPAN
A reference to a hash containing default formatting arguments for the profile_as_text() method.
=head3 extra_info
Can be used to attach any extra information to the profiler core object. That can be useful sometimes in callbacks.
=cut
sub new {
my ($class, $profile_name, $opt_params) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Annotated.pm view on Meta::CPAN
=cut
our $VERSION = '0.2';
my $callbacks = {
key_does_not_exist => sub {},
index_does_not_exist => sub {},
retrieve_index_from_non_array => sub {},
retrieve_key_from_non_hash => sub {},
};
lib/Data/Annotated.pm view on Meta::CPAN
=cut
sub cat_annotation {
my ($self, $data) = @_;
my $dp = Data::Path->new($data, $callbacks);
my @paths = grep { $dp->get($_) } keys(%$self);
return map { $self->get_annotation($_) } @paths;
}
=head2 get_annotation($path);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Beacon.pm view on Meta::CPAN
while ( $beacon->nextlink ) {
my ($source, $label, $description, $target) = $beacon->link;
...
}
Or by push parsing with handler callbacks:
my $beacon = beacon( $file );
$beacon->parse( 'link' => \link_handler );
$errors = $beacon->errors;
view all matches for this distribution
view release on metacpan or search on metacpan
Data::CGIForm - CGI Paramater Validation
========================================
Data::CGIForm is a library for managing and testing the data sent
from a CGI form. It provides filtering, testing callbacks, support
for multiple values, and other features.
See the POD documentation in CGIForm.pm for more information.
INSTALLATION
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Censor.pm view on Meta::CPAN
sensitive_fields => [ qw(card_number password) ],
# Specify text to replace their values with:
replacement => '(Sensitive data hidden)',
# Or specify callbacks for each field name which return the "censored"
# value - in this case, masking a card number (PAN) to show only the
# last four digits:
replacement_callbacks => {
card_number => sub {
my $pan = shift;
return "x" x (length($pan) - 4) . substr($pan, -4, 4);
},
},
lib/Data/Censor.pm view on Meta::CPAN
against each key to see if it's considered sensitive.
=item replacement
The string to replace each value with. Any censoring callback provided in
C<replacement_callbacks> which matches this key will take precedence over this
straightforward value.
=item replacement_callbacks
A hashref of key => sub {...}, where each key is a column name to match, and the
coderef takes the uncensored value and returns the censored value, letting you
for instance mask a card number but leave the last 4 digits visible.
If you provide both C<replacement> and C<replacement_callbacks>, any callback
defined which matches the key being considered takes precedence.
=back
=cut
lib/Data/Censor.pm view on Meta::CPAN
cvv cvv2 ccv
)
};
}
if ( is_hashref $args{replacement_callbacks} ) {
$self->{replacement_callbacks} = $args{replacement_callbacks};
}
if ( exists $args{replacement} ) {
$self->{replacement} = $args{replacement};
} else {
$self->{replacement} = 'Hidden (looks potentially sensitive)';
lib/Data/Censor.pm view on Meta::CPAN
( $self->{is_sensitive_field}
&& $self->{is_sensitive_field}{ lc $key } )
or ( $self->{censor_regex} && $key =~ $self->{censor_regex} );
# OK, censor this
if ( $self->{replacement_callbacks}{ lc $key } ) {
$data->{$key} = $self->{replacement_callbacks}{ lc $key }->(
$data->{$key}
);
$censored++;
} else {
$data->{$key} = $self->{replacement};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Chronicle.pm view on Meta::CPAN
$subscriber->subscribe("category1", "name2", sub { print 'Hello World' });
=head2 L<Data::Chronicle::Subscriber/unsubscribe>
Given a category, name, clears the callbacks associated with the specified category and name.
$subscriber->unsubscribe("category1", "name2");
=head1 EXAMPLES
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Consumer.pm view on Meta::CPAN
about how they got the piece, a task that should be handled by the framework.
The consumer subclasses assume that the resource can be modeled as a
queue (that there is some ordering principle by which they can be processed
in a predictable sequence). The consume pattern in full glory is something
very close to the following following pseudo code. The items marked with
asterisks are where user callbacks may be invoked:
DO
RESET TO THE BEGINNING OF THE QUEUE
WHILE QUEUE NOT EMPTY AND CAN *PROCEED*
ACQUIRE NEXT ITEM TO PROCESS FROM QUEUE
lib/Data/Consumer.pm view on Meta::CPAN
}
=head2 $consumer->fail($message)
Same as doing C<die($message)> from within a consume/process callback except
that no exception is thrown (no C<$SIG{__DIE__}> callbacks are invoked) and
the error is deferred until the callback actually returns.
Typically used as
return $consumer->fail;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/DPath.pm view on Meta::CPAN
data structure,
like:
/method()
---------------------------------------------------------------------
callbacks on YES no
not found keys
---------------------------------------------------------------------
element "//" no YES
view all matches for this distribution
view release on metacpan or search on metacpan
2010-06-09 Gisle Aas <gisle@ActiveState.com>
Release 1.16
Add support for filter callbacks
- filters can modify how selected objects are dumped
Various enhancements to how/when hash keys are quoted
- don't quote keywords
- don't quote words prefixed with "-"
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Enumerable/Lazy.pm view on Meta::CPAN
=head1 EXAMPLES
=head2 A basic range
This example implements a range generator from $from until $to. In order to
generate this range we define 2 callbacks: C<on_has_next()> and C<on_next()>.
The first one is used as point of truth whether the sequence has any more
non-iterated elements, and the 2nd one is here to return the next element in
the sequence and the one that changes the state of the internal sequence
iterator.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/EventStream/Window.pm view on Meta::CPAN
This document describes Data::EventStream::Window version 0.13
=head1 DESCRIPTION
This class represents time window for which aggregator aggregates data.
Normally window objects are passed to aggregators' callbacks and user has no need to build them himself.
=head1 METHODS
=cut
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Hash/Diff/Smart.pm view on Meta::CPAN
Ignore specific paths. Supports exact paths, regexes, and wildcard
segments.
=item * compare => { '/price' => sub { abs($_[0] - $_[1]) < 0.01 } }
Custom comparator callbacks for specific paths.
=item * array_mode => 'index' | 'lcs' | 'unordered'
Choose how arrays are diffed:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Hive/PathPacker/Flexible.pm view on Meta::CPAN
use strict;
use warnings;
package Data::Hive::PathPacker::Flexible 1.015;
# ABSTRACT: a path packer that can be customized with callbacks
use parent 'Data::Hive::PathPacker';
#pod =head1 DESCRIPTION
#pod
#pod This class provides the Data::Hive::PathPacker interface, and the way in which
#pod paths are packed and unpacked can be defined by callbacks set during
#pod initialization.
#pod
#pod =method new
#pod
#pod my $path_packer = Data::Hive::PathPacker::Flexible->new( \%arg );
lib/Data/Hive/PathPacker/Flexible.pm view on Meta::CPAN
#pod =begin :list
#pod
#pod = escape and unescape
#pod
#pod These coderefs are used to escape and path parts so that they can be split and
#pod joined without ambiguity. The callbacks will be called like this:
#pod
#pod my $result = do {
#pod local $_ = $path_part;
#pod $store->$callback( $path_part );
#pod }
lib/Data/Hive/PathPacker/Flexible.pm view on Meta::CPAN
=encoding UTF-8
=head1 NAME
Data::Hive::PathPacker::Flexible - a path packer that can be customized with callbacks
=head1 VERSION
version 1.015
=head1 DESCRIPTION
This class provides the Data::Hive::PathPacker interface, and the way in which
paths are packed and unpacked can be defined by callbacks set during
initialization.
=head1 PERL VERSION
This library should run on perls released even a long time ago. It should work
lib/Data/Hive/PathPacker/Flexible.pm view on Meta::CPAN
=over 4
=item escape and unescape
These coderefs are used to escape and path parts so that they can be split and
joined without ambiguity. The callbacks will be called like this:
my $result = do {
local $_ = $path_part;
$store->$callback( $path_part );
}
view all matches for this distribution
view release on metacpan or search on metacpan
0.009 2013-07-05 21:37:09 America/New_York
update bugtracker, repackage
0.008 2008-09-23
pass field name to store callbacks
0.007 2008-09-19
allow dig to accept a non-ref arg
0.005 2008-09-19
pass hashref of data (field_name) to sourcers
0.004 2008-09-17
pass input to store callbacks
0.003 2008-09-12
add no_default_for option to consume
0.002 2008-09-12
view all matches for this distribution
view release on metacpan or search on metacpan
share/js/02-chunkloader.js view on Meta::CPAN
parts.pop();
this.buildRoot=parts.join("/")+"/";
window.build_root=this.buildRoot;
//List of objects or callbacks to call as data is being loaded
this.manifest=[];
this.path_manifest={};
this.chunksExpected=100;
view all matches for this distribution
view release on metacpan or search on metacpan
0.00022 Nov 07 2011
* Very small optimization.
* Doc fixes on performance
0.00021 Oct 13 2011
* Add a way to insert callbacks that can be used in the formatters (doy)
0.00020 Apr 10 2011
* add_localizer($object) was not working (rt #67337). Reported by Klaus Ita
* FormFu 0.09 and up were failing (rt #67347). Reported by Andreas Koenig
* Tests failed if Config::Any was not installed (rt #67342). Reported by Andreas Koenig
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Math.pm view on Meta::CPAN
improve memory efficiency
o try an operator overload interface
o examine possibility of arbitrary user-defineable
operations (pattern/action callbacks?)
=head1 AUTHOR
Joseph Brenner, E<lt>doom@kzsu.stanford.eduE<gt>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Model.pm view on Meta::CPAN
validate(
@p, {
index => {
type => HASHREF | UNDEF,
optional => 1,
callbacks => {
has_index_name => sub {
return 1 unless $_[0];
return 0 unless scalar(@{ [ %{ $_[0] } ] }) == 2;
my($name) = %{ $_[0] };
$schema->has_index($name);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Monad/CondVar.pm view on Meta::CPAN
=over 4
=item $cv = as_cv($cb->($cv))
A helper for rewriting functions using callbacks to ones returning CVs.
my $cv = as_cv { http_get "http://google.ne.jp", $_[0] };
my ($data, $headers) = $cv->recv;
=item $cv = cv_unit(@vs)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Object/Role/Tryable.pm view on Meta::CPAN
try(CodeRef | Str $method) : InstanceOf['Data::Object::Try']
The try method takes a method name or coderef and returns a
L<Data::Object::Try> object with the current object passed as the invocant
which means that C<try> and C<finally> callbacks will receive that as the first
argument.
=over 4
=item try example #1
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Object/Try.pm view on Meta::CPAN
The result method executes the try/catch/default/finally logic and returns
either 1) the return value from the successfully tried operation 2) the return
value from the successfully matched catch condition if an exception was thrown
3) the return value from the default catch condition if an exception was thrown
and no catch condition matched. When invoked, the C<try> and C<finally>
callbacks will received an C<invocant> if one was provided to the constructor,
the default C<arguments> if any were provided to the constructor, and whatever
arguments were passed directly to this method.
=over 4
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Object/Types/Keywords.pm view on Meta::CPAN
=head2 is_all_of
is_all_of(CodeRef @checks) : CodeRef
The is_all_of function accepts one or more callbacks and returns truthy if all
of the callbacks return truthy.
=over 4
=item is_all_of example #1
lib/Data/Object/Types/Keywords.pm view on Meta::CPAN
=head2 is_any_of
is_any_of(CodeRef @checks) : CodeRef
The is_any_of function accepts one or more callbacks and returns truthy if any
of the callbacks return truthy.
=over 4
=item is_any_of example #1
lib/Data/Object/Types/Keywords.pm view on Meta::CPAN
=head2 is_one_of
is_one_of(CodeRef @checks) : CodeRef
The is_one_of function accepts one or more callbacks and returns truthy if
only one of the callbacks return truthy.
=over 4
=item is_one_of example #1
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/ObjectDriver.pm view on Meta::CPAN
of I<Class> itself. See TRIGGERS for the available triggers.
=head2 Class->call_trigger($trigger, [@callback_params])
Invokes the triggers watching class I<Class>. The parameters to send to the
callbacks (in addition to I<Class>) are specified in I<@callback_params>. See
TRIGGERS for the available triggers.
=head2 $obj->save
Saves the object I<$obj> to the database.
lib/Data/ObjectDriver.pm view on Meta::CPAN
besides I<$obj>, if any, are passed as I<@callback_params>. See TRIGGERS for
the available triggers.
=head1 TRIGGERS
I<Data::ObjectDriver> provides a trigger mechanism by which callbacks can be
called at certain points in the life cycle of an object. These can be set on a
class as a whole or individual objects (see USAGE).
Triggers can be added and called for these events:
lib/Data/ObjectDriver.pm view on Meta::CPAN
Note I<pre_search> should only be used as a trigger on a class, as I<search> is
never invoked on specific objects.
=over
The return values from your callbacks are ignored.
Note that the invocation of callbacks is the responsibility of the object
driver. If you implement a driver that does not delegate to
I<Data::ObjectDriver::Driver::DBI>, it is I<your> responsibility to invoke the
appropriate callbacks with the I<call_trigger> method.
=back
=back
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Overlay.pm view on Meta::CPAN
=back
=cut
for my $action (keys %action_map) {
# debuggable names for callbacks (not the used perl names)
subname "$action-overlay", $action_map{$action};
# XXX
warn "$action not in \@action_order"
if ! grep { $action eq $_ } @action_order;
view all matches for this distribution
view release on metacpan or search on metacpan
xt/endurance_leak.t view on Meta::CPAN
use strict;
use warnings;
use Test::More;
# Endurance: 500k random ops, observe RSS. Perl handle lifetimes must
# be correct â no SV leaks in XS callbacks. A growing RSS over time
# indicates a leak.
use Data::Pool::Shared;
my $p = Data::Pool::Shared::I64->new_memfd("endur", 512);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Processor.pm view on Meta::CPAN
}
=head2 transform_data
Transform one key in the data according to rules specified
as callbacks that themodule calls for you.
Transforms the data in-place.
my $validator = Data::Processor::Validator->new($schema, data => $data)
my $error_string = $processor->transform($key, $schema_key, $value);
view all matches for this distribution