view release on metacpan or search on metacpan
lib/Apache2/Protocol/ESMTP.pm view on Meta::CPAN
$p->register_callback(qr/^vrfy\s+(\S+?)?\s*$/i, \&_vrfy, 'protocol');
$p->register_callback(qr/^rset\s*$/i, \&_rset, 'protocol');
$p->register_callback(qr/^noop\s*$/i, \&_noop, 'protocol');
$p->register_callback(qr/^help\s*(\S*?)?\s*$/i, \&_help, 'protocol');
$p->register_callback(qr/^quit\s*$/i, \&_quit, 'protocol');
$p->enable_callbacks('protocol');
$p->setup_logging($c);
Apache2::Protocol::handler($c, $p);
}
lib/Apache2/Protocol/ESMTP.pm view on Meta::CPAN
sub _eoh {
my $self = shift;
my $line = shift;
#$self->disable_callbacks('headers');
$self->chunkmode(1);
$self->EOH();
$self->_body($line);
}
lib/Apache2/Protocol/ESMTP.pm view on Meta::CPAN
sub _eom {
my $self = shift;
$self->chunkmode(0);
$self->enable_callbacks('protocol');
$self->default_line_handler(\&_unknown);
# Clear state
$self->{_bodystate} = '';
$self->{_seenMAIL} = 0;
lib/Apache2/Protocol/ESMTP.pm view on Meta::CPAN
}
elsif(not $self->{_seenRCPT}) {
$self->send_response(503, 'Need RCPT (recipient)');
}
else {
$self->disable_callbacks('protocol');
$self->default_line_handler(\&_header);
$self->send_response($self->DATA(@_));
}
# Return OK
}
view all matches for this distribution
view release on metacpan or search on metacpan
Provide on_bad_data_event so that unparsable lines can be handled separately.
Includes some extra code for parsing data as UTF8, including unescaping URLS - currently commented out since
in most cases it's either not useful, or just wrong.
0.003 2011-02-20 18:20:53 Europe/London
Improve filtering support, basic callbacks for things that need to know when new URL packets etc. are seen,
and apply post processing before sending the log line event.
0.002 2011-02-20 04:28:50 Europe/London
Handle partial incoming data streams for expanding, and avoid sending timestamp
for filtered entries.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Alice/Logger.pm view on Meta::CPAN
package App::Alice::Logger;
use Any::Moose;
has callbacks => (
is => 'ro',
isa => 'HashRef',
default => sub {
my $hashref = {map {uc $_ => [\&print_line]}
qw/debug info warn error fatal/};
}
);
sub add_cb {
my ($self, $level, $cb) = @_;
return unless $self->callbacks->{$level};
push @{$self->callbacks->{$level}}, $cb;
}
sub log {
my ($self, $level, $message) = @_;
$level = uc $level;
return unless @{$self->callbacks->{$level}};
$_->($level, $message) for @{$self->callbacks->{$level}};
}
sub print_line {
my ($level, $message) = @_;
my ($sec, $min, $hour, $day, $mon, $year) = localtime(time);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/CPAN2Pkg/UI/Tk.pm view on Meta::CPAN
# -- attributes
# it's not usually a good idea to retain a reference on a poe session,
# since poe is already taking care of the references for us. however, we
# need the session to call ->postback() to set the various gui callbacks
# that will be fired upon gui events.
has _session => ( rw, weak_ref, isa=>'POE::Session' );
# -- initialization
view all matches for this distribution
view release on metacpan or search on metacpan
inc/My/Module/Build.pm view on Meta::CPAN
=item I<find_test_files_predicate()>
=item I<find_test_files_in_directories()>
Those two methods are used as callbacks by L</find_test_files>;
subclasses of I<My::Module::Build> may therefore find it convenient to
overload them. I<find_test_files_in_directories> should return a list
of the directories in which to search for test files.
I<find_test_files_predicate> gets passed the name of each file found
in these directories in the same way as a L<File::Find> C<wanted> sub
view all matches for this distribution
view release on metacpan or search on metacpan
example/test_wrapper.pl view on Meta::CPAN
test_module =>
{
description => 'module',
apropos => [qw(module)],
# save some private data we'll be re-using from the callbacks
_MODULE_RUNNER =>
sub
{
my ($self, $command, $arguments) = @_ ;
eval <<'EOE' ;
view all matches for this distribution
view release on metacpan or search on metacpan
Ev('T') # KeyPress
# Perl Tk Event Info (PTk,bin methods,Ev)
# Stop events in callback.
return # Exits only current sub
Tk::break # Stops all callbacks for an event
# View order of bindings for a widget (PTk,bin methods,Ev)
print for $b->bindtags
print "$_: ", $b->bind($_) for $b->bindtags
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/Test/WithCallback/Command/lol.pm view on Meta::CPAN
use Test::WithCallback -command;
sub opt_spec {
return (
[ "even|e=s", "an even number", {
callbacks => {
valid_email => sub { return !($_[0] % 2) }
}
}],
);
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Codit/Ext/CoditMDI.pm view on Meta::CPAN
# my ($self, $name, $key) = @_;
}
=back
Macros are callbacks executed in the background. For each line in the document the macro is linked to,
the callback is executed with a reference to the text widget and the line number as parameter.
the macro ends after the last line has been processed. Codit uses macro callback to do tasks like show
leading and trailing tabs and spaces and reparing indentation.
=over 4
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Config/Chronicle.pm view on Meta::CPAN
isa => 'Data::Chronicle::Writer',
);
=head2 chronicle_subscriber
The chronicle connection that can notify via callbacks when particular configuration items have a new value set. It should be an instance of L<Data::Chronicle::Subscriber>.
=cut
has chronicle_subscriber => (
is => 'ro',
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/DBBrowser/GetContent/Parse.pm view on Meta::CPAN
grep { length $sf->{o}{csv_in}{$_} }
keys %{$sf->{o}{csv_in}}
};
require Text::CSV_XS;
my $csv = Text::CSV_XS->new( $options ) or die Text::CSV_XS->error_diag();
$csv->callbacks( error => sub {
my ( $code, $str, $pos, $rec, $fld ) = @_;
if ( $code == 2012 ) {
# no warnings for end of data.
# 2012 "EOF - End of data in parsing input stream"
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Dochazka/CLI/Util.pm view on Meta::CPAN
sub truncate_to {
my ( $str, $mlen ) = validate_pos( @_,
{ type => SCALAR|UNDEF },
{
callbacks => {
'greater than or equal to zero' => sub { shift() >= 0 },
},
optional => 1,
type => SCALAR,
},
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Dochazka/REST/Model/Employee.pm view on Meta::CPAN
die "Unexpected _privsched_change_during_range_result: status payload is not an array!";
}
my ( $plval ) = validate_pos( @{ $status->payload },
{
type => SCALAR,
callbacks => {
'non-negative integer' => sub { $_[0] >= 0 }
}
},
);
return $plval;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/DrivePlayer/GUI.pm view on Meta::CPAN
my $path = $self->_current_path() or return;
return unless $path->prev();
$self->_play_at_path($path);
}
# ---- Player callbacks ----
sub _on_track_end {
my ($self) = @_;
$self->_next_track();
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Easer/V2.pm view on Meta::CPAN
$csources->{current} = \@csources;
}
}
}
# propagate pre-execute callbacks down the line
$child->pre_execute_schedule($self->pre_execute);
return $child;
}
view all matches for this distribution
view release on metacpan or search on metacpan
scripts/es-storage-overview.pl view on Meta::CPAN
#------------------------------------------------------------------------#
# Argument Collection
my ($opt,$usage) = describe_options('%c %o',
['sort=s', "sort by name or size, default: name",
{ default => 'name', callbacks => { 'must be name or size' => sub { $_[0] =~ /^name|size$/ } } }
],
['asc', "Sort ascending (default by name)"],
['desc', "Sort descending (default by size)"],
['limit=i', "Limit to showing only this many, ie top N", { default => 0 }],
['raw', "Display numeric data without rollups"],
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Env.pm view on Meta::CPAN
# mostly a duplicate of what's in str(). ick.
my %opt = Params::Validate::validate(
@opts,
{
Exclude => {
callbacks => { 'type' => \&App::Env::_Util::exclude_param_check },
default => undef,
},
AllowIllegalVariableNames => {
optional => 1,
default => !!1,
lib/App/Env.pm view on Meta::CPAN
# this is a bit messy.
my %opt = Params::Validate::validate(
@opts,
{
Exclude => {
callbacks => { 'type' => \&App::Env::_Util::exclude_param_check },
optional => 1,
},
AllowIllegalVariableNames => {
optional => 1,
default => !!0,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/ErrorCalculator.pm view on Meta::CPAN
$window->signal_connect(delete_event => \&_delete_event);
# Here we connect the "destroy" event to a signal handler.
# This event occurs when we call Gtk2::Widget::destroy on the window,
# or if we return FALSE in the "delete_event" callback. Perl supports
# anonymous subs, so we can use one of them for one line callbacks.
$window->signal_connect(destroy => sub { Gtk2->main_quit; });
my $table = Gtk2::Table->new(5, 4, FALSE);
$window->add($table);
view all matches for this distribution
view release on metacpan or search on metacpan
share/status/app/lib/angular/angular-animate.js view on Meta::CPAN
* the element's CSS class attribute value and then run the matching animation event function (if found).
* In other words, if the CSS classes present on the animated element match any of the JavaScript animations then the callback function will
* be executed. It should be also noted that only simple, single class selectors are allowed (compound class selectors are not supported).
*
* Within a JavaScript animation, an object containing various event callback animation functions is expected to be returned.
* As explained above, these callbacks are triggered based on the animation event. Therefore if an enter animation is run,
* and the JavaScript animation is found, then the enter callback will handle that animation (in addition to the CSS keyframe animation
* or transition code that is defined via a stylesheet).
*
*/
share/status/app/lib/angular/angular-animate.js view on Meta::CPAN
//we prefix and suffix the current className value with spaces to avoid substring
//lookups of className tokens
var futureClassName = ' ' + currentClassName + ' ';
if(ngAnimateState.running) {
//if an animation is currently running on the element then lets take the steps
//to cancel that animation and fire any required callbacks
$timeout.cancel(ngAnimateState.closeAnimationTimeout);
cleanup(element);
cancelAnimations(ngAnimateState.animations);
//if the class is removed during the reflow then it will revert the styles temporarily
share/status/app/lib/angular/angular-animate.js view on Meta::CPAN
function fireDoneCallbackAsync() {
doneCallback && $timeout(doneCallback, 0, false);
}
//it is less complicated to use a flag than managing and cancelling
//timeouts containing multiple callbacks.
function fireDOMOperation() {
if(!fireDOMOperation.hasBeenRun) {
fireDOMOperation.hasBeenRun = true;
domOperation();
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/FetchwareX/HTMLPageSync.pm view on Meta::CPAN
EOF
descriptions => {
page_name => <<EOA,
page_name simply names the HTML page the Fetchwarefile is responsible for
downloading, analyzing via optional callbacks, and copying to your
destination_directory.
EOA
html_page_url => <<EOA,
html_page_url is HTMLPageSync's lookup_url equivalent. It specifies a HTTP url
that returns a page of HTML that can be easily parsed of links to later
lib/App/FetchwareX/HTMLPageSync.pm view on Meta::CPAN
extension_name(__PACKAGE__);
opening_message(<<EOM);
HTMLPageSync's new command is not as sophistocated as Fetchware's. Unless you
only want to download images, you will have to get your hands dirty, and code up
some custom Perl callbacks to customize HTMLPageSync's behavior. However, it
will ask you quite nicely the basic options, so if those are all you need, then
this command will successfully generate a HTMLPageSync Fetchwarefile for you.
After it lets you choose the easy options of page_name, html_page_url,
and destination_directory, it will give you an opportunity to modify the
lib/App/FetchwareX/HTMLPageSync.pm view on Meta::CPAN
destination_directory 'wallpapers';
# pretend to be firefox
user_agent 'Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0.1';
# Customize the callbacks.
html_treebuilder_callback sub {
# Get one HTML::Element.
my $h = shift;
# Return true or false to indicate if this HTML::Element shoudd be a
lib/App/FetchwareX/HTMLPageSync.pm view on Meta::CPAN
return undef; #false
}
}
};
=item B<7. Specify an optional download_links_callbacks>
C<download_links_callback> specifies an optional anonymous Perl subroutine
reference that will replace the default one that HTMLPageSync uses. The default
one removes the HTML::Element skin each download link is wrapped in, because of
the use of L<HTML::TreeBuilder>. This simply strips off the object-oriented crap
lib/App/FetchwareX/HTMLPageSync.pm view on Meta::CPAN
=head3 lookup()
lookup() is overridden, and downloads the C<html_page_url>, which is the main
configuration option that HTMLPageSync uses. Then lookup() parses that
C<html_page_url>, and determines what the download urls should be. If the
C<html_trebuilder_callback> and C<download_links_callbacks> exist, then they are
called to customize lookup()'s default bahavior. See their descriptions below.
=head3 download()
download() downloads the array ref of download links that lookup() returns.
lib/App/FetchwareX/HTMLPageSync.pm view on Meta::CPAN
=head1 CAVEATS
Certain features of App::FetchwareX::HTMLPageSync require knowledge of the Perl
programming language in order for you to make use of them. However, this is
limited to optional callbacks that are not needed for most uses. These features
are the C<html_treebuilder_callback> and C<download_links_callback> callbacks.
=head1 AUTHOR
David Yingling <deeelwy@gmail.com>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Framework/Feature/Run.pm view on Meta::CPAN
=head1 DESCRIPTION
Provides for external command running from within an application.
An external conmmand may be run using this feature, and the output from the command may be returned for additional processing. The feature
also provides timed execution (aborting after a certain time), exit code status, and callbacks that can be defined to be called during execution
and/or after program completion.
=head2 Arguments
The access method for this feature (called as B<$app-E<gt>run()>) allows the complete run settings to be specified as a HASH. The call sets
view all matches for this distribution
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
view release on metacpan or search on metacpan
script/xlate view on Meta::CPAN
##############################################################################
# Parse options
##############################################################################
# Save args for get_remaining_args (used by callbacks)
declare -a PARSE_ARGS=("$@")
. getoptlong.sh OPTS "${PARSE_ARGS[@]}" || die "getoptlong.sh not found"
# Debug mode (currently enables trace)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Greple/Grep.pm view on Meta::CPAN
}
}
=head1 CALLBACK EXAMPLE
The L<App::Greple::subst> module uses callbacks to replace matched
text:
my $callback = sub {
my($start, $end, $index, $matched) = @_;
# Return replacement string
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/HTTP_Proxy_IMP/IMP.pm view on Meta::CPAN
############################################################################
# callback from IMP
# process return types and trigger type specific callbacks on (pre)pass/replace
############################################################################
sub _imp_callback {
my $self = shift;
my %fwd; # forwarded data, per dir
view all matches for this distribution
view release on metacpan or search on metacpan
share/static/jquery.jgrowl.js view on Meta::CPAN
* - Fixed IE bug with the filter CSS attribute (special thanks to gotwic)
* - Update IE opacity CSS
* - Changed font sizes to use "em", and only set the base style
*
* Changes in 1.2.3
* - The callbacks no longer use the container as context, instead they use the actual notification
* - The callbacks now receive the container as a parameter after the options parameter
* - beforeOpen and beforeClose now check the return value, if it's false - the notification does
* not continue. The open callback will also halt execution if it returns false.
* - Fixed bug where containers would get confused
* - Expanded the pause functionality to pause an entire container.
*
share/static/jquery.jgrowl.js view on Meta::CPAN
*
* Changes in 1.0.3
* - Fixed bug with options persisting across notifications
* - Fixed theme application bug
* - Simplified some selectors and manipulations.
* - Added beforeOpen and beforeClose callbacks
* - Reorganized some lines of code to be more readable
* - Removed unnecessary this.defaults context
* - If corners plugin is present, it's now customizable.
* - Customizable open animation.
* - Customizable close animation.
share/static/jquery.jgrowl.js view on Meta::CPAN
* - All CSS styling is now external.
* - Added a theme parameter which specifies a secondary class for styling, such
* that notifications can be customized in appearance on a per message basis.
* - Notification life span is now customizable on a per message basis.
* - Added the ability to disable the global closer, enabled by default.
* - Added callbacks for when a notification is opened or closed.
* - Added callback for the global closer.
* - Customizable animation speed.
* - jGrowl now set itself up and tears itself down.
*
* Changes in 1.0.1:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/JESP/Cmd.pm view on Meta::CPAN
sub global_opt_spec {
my ($self) = @_;
return (
[ "verbose|v", "log additional output" ],
[ "lib-inc|I=s@", "additional \@INC dirs", {
callbacks => { 'always fine' => sub { unshift @INC, @{$_[0]}; } }
} ],
$self->SUPER::global_opt_spec,
);
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Kit/Role/Log.pm view on Meta::CPAN
# ro-NOOP: }
else {
return Log::Dispatch->new(
outputs => [ [ "Screen", min_level => "notice", "newline" => 1 ] ],
callbacks => sub { # ? TODO break this out into a thing consumable by Log::Dispatch::Config above ?
my %info = @_;
my $short = $info{'level'};
$short = substr( $info{'level'}, 0, 5 ) eq 'emerg' ? 'M' : uc( substr( $short, 0, 1 ) );
$short = " ã\xc2\xa0$short"; # Unicode: \x{33D2} utf-8: \xe3\x8f\x92
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/MFILE/WWW/Resource.pm view on Meta::CPAN
$r .= 'map: {';
$r .= " '*': { 'jquery': 'jquery-private' },";
$r .= " 'jquery-private': { 'jquery': 'jquery' }";
$r .= '},';
# callbacks for showing module loading progress
$r .= 'onNodeCreated: function(node, config, moduleName, url) {';
$r .= " var t = document.getElementById('myLoadProgress'),";
$r .= " m = '';";
$r .= " m = 'module ' + moduleName + ' is about to be loaded';";
$r .= " console.log(m);";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/MHFS/EventLoop/Poll/Base.pm view on Meta::CPAN
sub register_child {
my ($self, $pid, $cb) = @_;
$self->{'children'}{$pid} = $cb;
}
sub run_dead_children_callbacks {
my ($self) = @_;
while(my $chld = shift(@{$self->{'deadchildren'}})) {
say "PID " . $chld->[1] . ' running SIGCHLD cb';
$chld->[0]($chld->[2]);
}
lib/MHFS/EventLoop/Poll/Base.pm view on Meta::CPAN
elsif(! $!{EINTR}){
say "Poll ERROR $!";
#return undef;
}
$self->run_dead_children_callbacks;
}
sub run {
my ($self, $loop_interval) = @_;
my $default_lp_interval = $loop_interval // -1;
view all matches for this distribution