view release on metacpan or search on metacpan
lib/Ask/Callback.pm view on Meta::CPAN
__END__
=head1 NAME
Ask::Callback - interact with yourself via callbacks
=head1 SYNOPSIS
my $ask = Ask::Callback->new(
input_callback => sub { ... },
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Aspect.pm view on Meta::CPAN
* We need a way to match subs with an attribute, attributes::get()
will currently not work.
* isa() support for method pointcuts as Gaal Yahas suggested: match
methods on class hierarchies without callbacks
* Perl join points: phasic- BEGIN/INIT/CHECK/END
=head2 Weaving
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Assert/Refute.pm view on Meta::CPAN
More arguments MAY be added in the future.
Return value is ignored.
A read-only report instance is returned by C<try_refute> instead.
If C<on_pass>/C<on_fail> callbacks were specified during C<use> or
using C<configure>, they will also be executed if appropriate.
If C<NDEBUG> or C<PERL_NDEBUG> environment variable is set at compile time,
this block is replaced with a stub
which returns an unconditionally passing report.
lib/Assert/Refute.pm view on Meta::CPAN
B<[EXPERIMENTAL]>. Name and meaning MAY change in the future.
=back
The callbacks MUST be either
a C<CODEREF> accepting L<Assert::Refute::Report> object,
or one of predefined strings:
=over
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Asterisk/AMI.pm view on Meta::CPAN
If you are running an event loop and use blocking methods (e.g. get_response, check_response, action,
simple_action, connected, or a blocking connect) the outcome is unspecified. It may work, it may lock everything up, the action may
work but break something else. I have tested it and behavior seems unpredictable at best and is very
circumstantial.
If you are running an event-loop use non-blocking callbacks! It is why they are there!
However if you do play with blocking methods inside of your loops let me know how it goes.
=head2 Actions
lib/Asterisk/AMI.pm view on Meta::CPAN
});
=head3 Originate Examples
These don't include non-blocking examples, please read the section on 'Callbacks' below for information
on using non-blocking callbacks and events.
NOTE: Please read about the 'OriginateHack' option for the constructor above if you plan on using the 'Async'
option in your Originate command, as it may be required to properly retrieve the response.
In these examples we are dialing extension '12345' at a sip peer named 'peer' and when the call connects
lib/Asterisk/AMI.pm view on Meta::CPAN
=head3 Callback Caveats
Callbacks only work if we are processing packets, therefore you must be running an event loop. Alternatively, we run
mini-event loops for our blocking calls (e.g. action(), get_action()), so in theory if you set callbacks and then
issue a blocking call those callbacks should also get triggered. However this is an unsupported scenario.
Timeouts are done using timers and they are set as soon as you send the object. Therefore if you send an action with a
timeout and then monkey around for a long time before getting back to your event loop (to process input) you can time
out before ever even attempting to receive the response.
lib/Asterisk/AMI.pm view on Meta::CPAN
Returns 1 if there are currently errors on the socket, 0 if everything is ok.
destroy ()
Destroys the contents of all buffers and removes any current callbacks that are set.
Mostly used internally. Useful if you want to ensure that our IO handle watcher gets removed.
Gets called automatically when our object goes out of scope.
loop ()
lib/Asterisk/AMI.pm view on Meta::CPAN
my ($self, $message) = @_;
warnings::warnif('Asterisk::AMI', "Failed to connect to asterisk - $self->{CONFIG}->{PEERADDR}:$self->{CONFIG}->{PEERPORT}");
warnings::warnif('Asterisk::AMI', "Error Message: $message");
#Dispatch all callbacks as if they timed out
$self->_clear_cbs();
if (exists $self->{CONFIG}->{ON_CONNECT_ERR}) {
$self->{CONFIG}->{ON_CONNECT_ERR}->($self, $message);
} elsif (exists $self->{CONFIG}->{ON_ERROR}) {
lib/Asterisk/AMI.pm view on Meta::CPAN
my ($self) = @_;
my $message = "Remote end disconnected - $self->{CONFIG}->{PEERADDR}:$self->{CONFIG}->{PEERPORT}";
warnings::warnif('Asterisk::AMI', "Remote Asterisk Server ended connection - $self->{CONFIG}->{PEERADDR}:$self->{CONFIG}->{PEERPORT}");
#Call all callbacks as if they had timed out
_
$self->_clear_cbs();
if (exists $self->{CONFIG}->{ON_DISCONNECT}) {
$self->{CONFIG}->{ON_DISCONNECT}->($self, $message);
lib/Asterisk/AMI.pm view on Meta::CPAN
return 1;
}
#Used once and action completes
#Determines goodness and performs any oustanding callbacks
sub _action_complete {
my ($self, $actionid) = @_;
#Determine 'Goodness'
if (defined $self->{RESPONSEBUFFER}->{$actionid}->{'Response'}
lib/Asterisk/AMI.pm view on Meta::CPAN
}
return 1;
}
#Handles proccessing and callbacks for action responses
sub _handle_action {
my ($self, $packet) = @_;
#Snag our actionid
my $actionid = $packet->{'ActionID'};
lib/Asterisk/AMI.pm view on Meta::CPAN
}
return 1;
}
#Handles proccessing and callbacks for 'Event' packets
sub _handle_event {
my ($self, $event) = @_;
#If handlers were configured just dispatch, don't buffer
if ($self->{CONFIG}->{HANDLERS}) {
lib/Asterisk/AMI.pm view on Meta::CPAN
}
return 1;
}
#This is used to provide blocking behavior for calls It installs callbacks for an action if it is not in the buffer
#and waits for the response before returning it.
sub _wait_response {
my ($self, $id, $timeout) = @_;
#Already got it?
lib/Asterisk/AMI.pm view on Meta::CPAN
#Callback for login action
my $login_cb = sub { $self->_logged_in($_[1]) };
#Do a md5 challenge
if (%{$challenge}) {
#Create callbacks for the challenge
my $challenge_cb = sub {
if ($_[1]->{'GOOD'}) {
my $md5 = Digest::MD5->new();
$md5->add($_[1]->{'PARSED'}->{'Challenge'});
lib/Asterisk/AMI.pm view on Meta::CPAN
my $timeout = $self->{CONFIG}->{TIMEOUT} || 5;
return $self->send_action({ Action => 'Ping' }, $cb, $timeout);
}
#Calls all callbacks as if they had timed out Used when an error has occured on the socket
sub _clear_cbs {
my ($self) = @_;
foreach my $id (keys %{$self->{CALLBACKS}}) {
my $response = $self->{RESPONSEBUFFER}->{$id};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Asterisk/CoroManager.pm view on Meta::CPAN
port => $args->{port} || 5038,
user => $args->{user},
secret => $args->{secret},
watcher => undef,
finished => undef, # Will hold AnyEvent->condvar
action_cb => {}, # Action response callbacks
event_cb => {}, # event callbacks
event_dcb => undef, # event default callback
uevent_cb => {}, # userevent callbacks
uevent_dcb => undef, # userevent default callback
ami_version => undef,
read_buffer => [],
}, __PACKAGE__;
lib/Asterisk/CoroManager.pm view on Meta::CPAN
sub handle_event {
my( $astman, $pack ) = @_;
my $event = $pack->{Event};
if ( my $callbacks =
$astman->{event_cb}{$event} ||
$astman->{event_dcb}
) {
$astman->debug("Handling event: $event");
foreach my $cb (@$callbacks) {
&{$cb}($pack);
}
}
else {
$astman->trace("Unhandled event: $event");
lib/Asterisk/CoroManager.pm view on Meta::CPAN
sub handle_uevent {
my( $astman, $pack ) = @_;
my $uevent = $pack->{UserEvent};
if ( my $callbacks =
$astman->{uevent_cb}{$uevent} ||
$astman->{uevent_dcb} ||
$astman->{event_dcb}
) {
$astman->debug("Handling uevent: $uevent");
foreach my $cb (@$callbacks) {
&{$cb}($pack);
}
}
else {
$astman->trace("Unhandled uevent: $uevent");
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Astro/FITS/CFITSIO/Simple.pm view on Meta::CPAN
depends => 'extname',
default => 0
},
hdunum => {
type => SCALAR,
callbacks => { 'illegal HDUNUM' => \&validHDUNUM, },
optional => 1
},
hdutype => {
type => SCALAR,
callbacks => { 'illegal HDU type' => \&validHDUTYPE, },
default => 'any',
optional => 1
},
resethdu => { type => SCALAR, default => 0 },
);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Astro/Montenbruck/RiseSet.pm view on Meta::CPAN
}
);
return %res;
}
# if caller doesn't ask for a result, just call the function with the callbacks
$func->(
get_position => sub { _get_equatorial( $pla, $_[0] ) },
sin_h0 => sin( deg2rad($h0) ),
on_event => $arg{on_event},
on_noevent => $arg{on_noevent},
lib/Astro/Montenbruck/RiseSet.pm view on Meta::CPAN
}
}
return %res;
}
# if caller doesn't ask for a result, just call the function with the callbacks
for (@RS_EVENTS) {
my ( $state, $jd ) = $evt_func->($_);
if ( $state eq $_ ) {
$arg{on_event}->( $_, $jd );
}
lib/Astro/Montenbruck/RiseSet.pm view on Meta::CPAN
=head3 Returns
function, which calculates rise, set and transit for a celestial body.
It accepts celestial body identifier as positional argument (see L<Astro::Montenbruck::Ephemeris::Planet>)
and two optional callbacks as named arguments:
=over
=item *
lib/Astro/Montenbruck/RiseSet.pm view on Meta::CPAN
=back
=head3 Returns
function, which calculates rise and set times of the planet. It accepts and two callbacks as named arguments:
=over
=item *
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Astro/XSPEC/Model/Parse.pm view on Meta::CPAN
my $class = shift;
my %par = validate( @_,
{
model => { type => HASHREF,
callbacks => { 'handler' =>
sub {
pop @_;
validate( @_, \%model_handler )
}
},
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Async/Chain.pm view on Meta::CPAN
log(...);
};
=head1 RATIONALE
A asynchronous code often have deep nested callbacks, therefore it is tangled
and hard to change. This module help to converta a code like following to some
more readable form. Also, with C<chain> you can easily skip some unneeded steps
in this thread. For example jump to log step after the first failed query in
the chain.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Async/ContextSwitcher.pm view on Meta::CPAN
=item * you create a L</new> context for an entry point
It can be a new web request, a new message from a queue to process
or command line script command
=item * use L</cb_w_context> to create all callbacks in your application
=item * correct context restored when your callbacks are called
=item * use L</context> to access data
=back
lib/Async/ContextSwitcher.pm view on Meta::CPAN
return $CTX = __PACKAGE__->new;
}
=head2 cb_w_context
Wrapper for callbacks. Function is exported. Wraps a callback with code
that stores and restores context to make sure correct context travels
with your code.
async_call( callback => cb_w_context { context->{good} = shift } );
Make sure that all callbacks in your code are created with this function
or you can loose track of your context.
=cut
sub cb_w_context(&) {
view all matches for this distribution
view release on metacpan or search on metacpan
my $self = shift ;
warn "$self->{name} ",shift if $self->{test} ;
}
# Call a set of asynchronous functions which MUST have their set of user
# callbacks.. Note that the user call-back invoked when the function MUST
# call the asyncDone function with a result.
#
# When all function calls are over (i.e. all call-back were performed)
# all the returned results are logically 'anded' and the resulting result
# is passed to the main user call-back function
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Async/Hooks.pm view on Meta::CPAN
developers can use to extend your functionality, or just react to
important state modifications.
There are other modules that provide the same functionality (see
L<SEE ALSO> section). The biggest diference is that you can pause
processing of the chain of callbacks at any point and start a
asynchronous network request, and resume processing when that request
completes.
Developers are not expect to subclass from C<Async::Hooks>. The
recomended usage is to stick a C<Async::Hooks> instance in a slot or as
lib/Async/Hooks.pm view on Meta::CPAN
your class. For example, if you where writting a feed aggregator, you
could define a hook for notification of new items.
In some other cases, your module wants to make part of its bussiness
logic extendable or even replaceable. For example, a SMTP server can ask
if a specific mail address is a valid RCPT. All the registered callbacks
would be called and if one of them has a definitive answer she can just
stop the chain. You can even define a default callback to be called at
the end, as a cleanup step.
You don't need to pre-declare or create a hook. Clients of your module
lib/Async/Hooks.pm view on Meta::CPAN
optional parameter is an arrayref with arguments, or undef. The third
optional argument, a coderef, is a cleanup callback. This callback
will be called at the end of the chain or as soon as some callback
ends the chain.
The callbacks all have a common signature. They receive two parameters.
The first one is a L<Async::Hooks::Ctl|Async::Hooks::Ctl> object, used
to control the chain of callbacks. The second is an arrayref with the
arguments you used when the hook was called. Something like this:
sub my_callback {
my ($ctl, $args) = @_;
....
lib/Async/Hooks.pm view on Meta::CPAN
with a true value if the chain was ended prematurely C<done()> or
C<stop()>.
The callback only has one responsability: decide if you want to decline
processing of this event, or stop processing if we are done with it.
Cleanup callbacks I<MUST> just return.
To do that, callbacks must call one of two methods:
C<< $ctl->decline() >> or C<< $ctl->done() >>. You can also use
C<next()> or C<declined()> as alias to C<decline()>, and C<stop()>
as alias to C<done()>, whatever feels better.
But you can delay that decision. You can start a network request,
lib/Async/Hooks.pm view on Meta::CPAN
The optional cleanup callback will be called at the end of the chain, or
when a callback calls C<< $ctl->done() >>.
=item $count = $registry->has_hooks_for($hook);
Returns the number of callbacks registered with C<$hook>.
=back
=head1 SEE ALSO
view all matches for this distribution
view release on metacpan or search on metacpan
Interrupt.pm view on Meta::CPAN
C<$value> must be in the valid range for a C<sig_atomic_t>, except C<0>
(1..127 is portable).
If the function is called while the Async::Interrupt object is already
signaled but before the callbacks are being executed, then the stored
C<value> is either the old or the new one. Due to the asynchronous
nature of the code, the C<value> can even be passed to two consecutive
invocations of the callback.
=item $address = $async->c_var
view all matches for this distribution
view release on metacpan or search on metacpan
t/10-sync.t view on Meta::CPAN
is($q->$_(), $handlers{$_}, "get $_ handler") foreach keys %handlers;
ok(!defined($q->$_(undef)), "set $_ handler to undef") foreach keys %handlers;
}
{
note('--- event callbacks receive the object as the first argument');
my @results = ();
my $q; $q = new_ok('Async::Queue', [
concurrency => 1, worker => sub {
my ($task, $cb) = @_;
push(@results, $task);
view all matches for this distribution
view release on metacpan or search on metacpan
eg/examples.pl view on Meta::CPAN
print "B: $res{B}\n";
## persistent callback
});
## Trigger the resources.
## Execution order of watcher callbacks is not guaranteed.
($A, $B) = ('aaaaa', 'bbbbb');
$selector->trigger('A', 'B'); ## -> A: aaaaa
## -> B: bbbbb
print "--------\n";
## $watcher_a is already canceled.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Async/Trampoline.pm view on Meta::CPAN
Importantly, such trampolines eliminate tail calls.
This programming style is powerful but inconvenient
because you tend to get callback hell.
This module implements simple Futures with an async/await syntax.
Instead of nesting the callbacks, we can now chain callbacks more easily.
This module was initially created
in order to write recursive algorithms around compiler construction:
recursive-descent parsers and recursive tree traversal.
However, it is certainly applicable to other problems as well.
lib/Async/Trampoline.pm view on Meta::CPAN
=for test
In B<Incomplete> states, the Async will be processed in the future.
At some point, the Async will transition to a completed state.
In C<async> and C<await> callbacks,
the Async will be updated to the state of the return value of that callback.
B<Completed> states are terminal.
The Asyncs are not subject to further processing.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Async/Util.pm view on Meta::CPAN
action ever passes an error to its callback then the cb coderef is immediately
invoked and passed the error. No more inputs are processed.
=head2 azipmap
C<azipmap> executes a list of callbacks on a list of corresponding inputs.
Every provided action is executed and passed the input found in the same
position in the list of provided inputs. In other words, the list of actions
and the list of inputs are zipped in to action/input pairs, then each action
is executed on its input.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AtExit.pm view on Meta::CPAN
I<reverse> order of registration (last one registered is invoked first).
Registering the same subroutine more than once will cause that subroutine
to be invoked once for each registration.
An B<AtExit> object can be created in any scope. When invoked as a
function, B<atexit> registers callbacks to be
executed at I<program-exit> time. But when invoked as an object-method
(using the C<$object-E<gt>method_name> syntax),
callbacks registered with an B<AtExit> object are executed at
I<object-destruction time>! The rules for order of execution of the
registered subroutines are the same for objects during
object-destruction, as for the program during program-termination.
The B<atexit> function/method should be passed a subroutine name or
lib/AtExit.pm view on Meta::CPAN
removed from the front of the queue immediately before it is invoked).
Note that in both cases (program-exit, and object-destruction) the
subroutines in this queue are invoked in first-to-last order (the
I<reverse> order in which they were registered with B<atexit>).
=head2 Adding and removing callbacks during exit/destruction time.
The method B<ignore_when_exiting> specifies how exit-callback
registration and unregistration will be handled during program-exit
or object-destruction time, while exit-callbacks are in process
of being invoked.
When invoked as a class method (e.g., C<AtExit-E<gt>ignore_when_exiting>),
B<ignore_when_exiting> corresponds to the handling of calls to
B<atexit> and B<rmexit> during program-termination. But when invoked as
lib/AtExit.pm view on Meta::CPAN
value will correspond to object-destruction processing for the given
object.
If, for any reason, the list of registered callback needs to be directly
accessed or manipulated, the B<exit_subs> function will return a reference
to the list of program-exit callbacks. When invoked as a method, B<exit_subs>
will return a reference to the list of object-destruction callbacks for the
corresponding object.
=head1 EXPORTS
For backward compatibility, B<atexit> and B<rmexit> are exported
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Attribute/Params/Validate.pm view on Meta::CPAN
{
# insert code here
}
# for some reason Perl insists that the entire attribute be on one line
sub foo2 : Validate( foo => { type => ARRAYREF }, bar => { can => [ 'print', 'flush', 'frobnicate' ] }, baz => { type => SCALAR, callbacks => { 'numbers only' => sub { shift() =~ /^\d+$/ }, 'less than 90' => sub { shift() < 90 } } } )
{
# insert code here
}
# note that this is marked as a method. This is very important!
view all matches for this distribution
view release on metacpan or search on metacpan
SkipUntilSpecification skip_specification;
SkipUntilSpecification until_specification;
} flac_datasource;
/* start all the callbacks here. */
static void meta_callback(
const decoder_t *decoder,
const FLAC__StreamMetadata *metadata, void *client_data) {
flac_datasource *datasource = (flac_datasource *)client_data;
view all matches for this distribution
view release on metacpan or search on metacpan
GtkGramofile/GUI.pm view on Meta::CPAN
}
sub connect_signals {
my $self = shift;
my @callbacks = qw(quit record play save tracksplit_browse start_tracksplit stop_tracksplit process_infile process_outfile
simple_median_filter double_median_filter simple_mean_filter rms_filter cond_median_filter cond_median2_filter
cond_median3_filter simple_normalize_filter start_process stop_process);
foreach my $callback (@callbacks) {
$self->{$callback."_button"}->signal_connect('clicked', $self->{gtkgramofile}->{signals}->get_callback($callback), $self->{gtkgramofile}->{signals});
}
$self->{gramofile}->signal_connect('delete_event', $self->{gtkgramofile}->{signals}->get_callback("quit"));
foreach my $check (qw(tracksplit_rms_file_check tracksplit_generate_graph_check)) {
view all matches for this distribution
view release on metacpan or search on metacpan
Network/Network.pm view on Meta::CPAN
}
}
else {
$plugin = Audio::LADSPA->plugin(@_)->new($self->{sample_rate});
}
$plugin->set_monitor($self); # register callbacks.
return $plugin;
}
sub graph {
return $_[0]->{graph};
Network/Network.pm view on Meta::CPAN
EXPR can be an Audio::LADSPA::Plugin object, an Audio::LADSPA::Plugin classname or any
expression supported by L<< Audio::LADSPA->plugin()|Audio::LADSPA/plugin >>.
Any $plugin added to a $network will have its monitor set to that $network. This
means that a $plugin cannot be in more than 1 Audio::LADSPA::Network at any given time, and that
all callbacks from the $plugin are handled by the $network.
See also L<Audio::LADSPA::Plugin/SETTING CALLBACKS>.
=head2 has_plugin
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Audio/Radio/Sirius.pm view on Meta::CPAN
verbosity => 0,
_sequence => 0,
_serial => undef,
_lastack => -1,
_lastreq => -1,
_callbacks => {
'channel_update' => undef,
},
_buffer => '',
);
lib/Audio/Radio/Sirius.pm view on Meta::CPAN
}
=head2 set_callback (callback type, function reference)
When the tuner sends an update, such as new artist/title information on the current channel, it may be helpful to execute some code which handles this
event. To accomidate this, you may define function callbacks activated when each event occurs. Note that some of the parameters below are marked with
an asterisk. This indicates that they may be undefined when your function is called. You should account for this in your callback function.
=head3 channel_update (channel, *pid, *artist, *title, *composer)
$tuner->set_callback ('channel_update', \&channel);
lib/Audio/Radio/Sirius.pm view on Meta::CPAN
sub set_callback {
my $self = shift;
if (!ref($self) eq 'CODE') { croak "$self isn't an object"; }
my ($reqtype, $funcref) = @_;
if (!ref $funcref) { croak "$funcref must be a reference to a function"; }
if (!exists($DEFAULTS{'_callbacks'}{$reqtype}) ) { croak "$reqtype is not a supported update type"; }
# validated enough for 'ya??
$self->{'_callbacks'}{$reqtype} = $funcref;
}
=head2 verbosity (level)
Not to be confused with C<debug>, verbosity changes the updates the tuner sends. By default, the tuner only sends updates for artist/title/PID
lib/Audio/Radio/Sirius.pm view on Meta::CPAN
sub _call_channel_handler {
my $self = shift;
my ($channel) = @_;
# update handler: ($channel, $pid, $artist, $title, $composer)
my $handler = $self->{'_callbacks'}{'channel_update'};
if (ref($handler)) {
&$handler (
$channel,
$self->{'channels'}{$channel}{'pid'},
$self->{'channels'}{$channel}{'artist'},
view all matches for this distribution
view release on metacpan or search on metacpan
Play of subranges
Change 2553 on 2002/12/17 by nick@dromedary
Overview and range callbacks
Change 2552 on 2002/12/17 by nick@dromedary
Basic scope
view all matches for this distribution
view release on metacpan or search on metacpan
examples/js/jquery-1.9.1.js view on Meta::CPAN
firingStart,
// Actual callback list
list = [],
// Stack of fire calls for repeatable lists
stack = !options.once && [],
// Fire callbacks
fire = function( data ) {
memory = options.memory && data;
fired = true;
firingIndex = firingStart || 0;
firingStart = 0;
examples/js/jquery-1.9.1.js view on Meta::CPAN
}
}
},
// Actual Callbacks object
self = {
// Add a callback or a collection of callbacks to the list
add: function() {
if ( list ) {
// First, we save the current length
var start = list.length;
(function add( args ) {
examples/js/jquery-1.9.1.js view on Meta::CPAN
// Inspect recursively
add( arg );
}
});
})( arguments );
// Do we need to add the callbacks to the
// current firing batch?
if ( firing ) {
firingLength = list.length;
// With memory, if we're not firing then
// we should call right away
examples/js/jquery-1.9.1.js view on Meta::CPAN
});
}
return this;
},
// Check if a given callback is in the list.
// If no argument is given, return whether or not list has callbacks attached.
has: function( fn ) {
return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
},
// Remove all callbacks from the list
empty: function() {
list = [];
return this;
},
// Have the list do nothing anymore
examples/js/jquery-1.9.1.js view on Meta::CPAN
},
// Is it locked?
locked: function() {
return !stack;
},
// Call all callbacks with the given context and arguments
fireWith: function( context, args ) {
args = args || [];
args = [ context, args.slice ? args.slice() : args ];
if ( list && ( !fired || stack ) ) {
if ( firing ) {
examples/js/jquery-1.9.1.js view on Meta::CPAN
fire( args );
}
}
return this;
},
// Call all the callbacks with the given arguments
fire: function() {
self.fireWith( this, arguments );
return this;
},
// To know if the callbacks have already been called at least once
fired: function() {
return !!fired;
}
};
examples/js/jquery-1.9.1.js view on Meta::CPAN
jQuery( callbackContext ) :
jQuery.event,
// Deferreds
deferred = jQuery.Deferred(),
completeDeferred = jQuery.Callbacks("once memory"),
// Status-dependent callbacks
statusCode = s.statusCode || {},
// Headers (they are sent all at once)
requestHeaders = {},
requestHeadersNames = {},
// The jqXHR state
examples/js/jquery-1.9.1.js view on Meta::CPAN
s.mimeType = type;
}
return this;
},
// Status-dependent callbacks
statusCode: function( map ) {
var code;
if ( map ) {
if ( state < 2 ) {
for ( code in map ) {
// Lazy-add the new callback in a way that preserves old ones
statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
}
} else {
// Execute the appropriate callbacks
jqXHR.always( map[ jqXHR.status ] );
}
}
return this;
},
examples/js/jquery-1.9.1.js view on Meta::CPAN
}
// aborting is no longer a cancellation
strAbort = "abort";
// Install callbacks on deferreds
for ( i in { success: 1, error: 1, complete: 1 } ) {
jqXHR[ i ]( s[ i ] );
}
// Get transport
examples/js/jquery-1.9.1.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( isSuccess ? "ajaxSuccess" : "ajaxError",
examples/js/jquery-1.9.1.js view on Meta::CPAN
this[ callback ] = true;
return callback;
}
});
// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
var callbackName, overwritten, responseContainer,
jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
"url" :
examples/js/jquery-1.9.1.js view on Meta::CPAN
// retrieved directly we need to fire the callback
setTimeout( callback );
} else {
handle = ++xhrId;
if ( xhrOnUnloadAbort ) {
// Create the active xhrs callbacks list if needed
// and attach the unload handler
if ( !xhrCallbacks ) {
xhrCallbacks = {};
jQuery( window ).unload( xhrOnUnloadAbort );
}
// Add to list of active xhrs callbacks
xhrCallbacks[ handle ] = callback;
}
xhr.onreadystatechange = callback;
}
},
examples/js/jquery-1.9.1.js view on Meta::CPAN
anim: animation,
queue: animation.opts.queue
})
);
// attach callbacks from options
return animation.progress( animation.opts.progress )
.done( animation.opts.done, animation.opts.complete )
.fail( animation.opts.fail )
.always( animation.opts.always );
}
examples/js/jquery-1.9.1.js view on Meta::CPAN
timers.splice( index, 1 );
}
}
// start the next in the queue if the last step wasn't forced
// timers currently will call their complete callbacks, which will dequeue
// but only if they were gotoEnd
if ( dequeue || !gotoEnd ) {
jQuery.dequeue( this, type );
}
});
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Authen/CAS/UserAgent.pm view on Meta::CPAN
# password => the password to use to login to the specified CAS server
# pgt => the pgt for a proxy login handler
# proxy => a boolean indicating this handler is a proxy login handler
# restful => a boolean indicating if the CAS server supports the RESTful API
# callback => a login callback to use for logging into CAS, it should return a ticket for the specified service
# ticket_heuristics => an array of heuristic callbacks that are performed when searching for the service and ticket in a CAS response
# strict => only allow CAS login when the service is the same as the original url
sub attach_cas_handler($%) {
my $self = shift;
my (%opt) = @_;
lib/Authen/CAS/UserAgent.pm view on Meta::CPAN
ref($opt{'callback'}) eq 'CODE' ? $opt{'callback'} :
$opt{'proxy'} ? $proxyLoginCallback :
$opt{'restful'} ? $restLoginCallback :
$defaultLoginCallback;
# process any default config values for bundled callbacks/heuristics, we do this here
# instead of in the callbacks to make default values available to custom
# callbacks
$opt{'ticket_heuristics'} = [$opt{'ticket_heuristics'}] if(ref($opt{'ticket_heuristics'}) ne 'ARRAY');
push @{$opt{'ticket_heuristics'}}, $defaultTicketHeuristic;
@{$opt{'ticket_heuristics'}} = grep {ref($_) eq 'CODE'} @{$opt{'ticket_heuristics'}};
$opt{'param_heuristics'} = [$opt{'param_heuristics'}] if(ref($opt{'param_heuristics'}) ne 'ARRAY');
view all matches for this distribution
view release on metacpan or search on metacpan
=over 4
=item callback ( NAME )
Tells if the named callback has a handler installed. The list of implemented
callbacks is "user", "auth", and "language". Others may be implemented in
future releases.
=item callback( NAME => VALUE, NAME => VALUE, ... )
Sets the given callback(s) to the given value(s). See the C<Callbacks> section
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Authen/SASL/Perl/NTLM.pm view on Meta::CPAN
(Unfortunately, Authen::SASL currently doesn't tell you which SASL mechanism
is missing.)
=head1 CALLBACK
The callbacks used are:
=head2 Client
=over 4
view all matches for this distribution
view release on metacpan or search on metacpan
0.11
added setpass and checkpass methods
added setpass callback
applied a patch by Graham Barr (found with google) for enabling GSSAPI
authentication (fix a problem in Security.pm)
added a check for undef return values when using sub-callbacks (Thanks
to Quanah Gibson-Mount for discovering this one)
0.10
Added the iplocalport and ipremote port to *_new methods, after filling
in the appropriate string (see doc) ASC is able to manage KERBEROS_V4
0.09
Added callback documenation
Perl-Callback types (PVMG, PV, PVIV) handling extended
0.08-desy-internal
Almost complete rewrite of Perlcallbacks from Cyrus.xs.
SASL-Server functionality added, so servers written in Perl can use
SASL as Authentication Layer. Synchronize callbacks between Cyrus SASL
v1 and v2.
Many changes in the internal handling of sasl variables.
Documentation inside the XS-file, do motivate myself to write docs
0.07
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Authen/SASL/Perl/ANONYMOUS.pm view on Meta::CPAN
This method implements the client part of the ANONYMOUS SASL algorithm,
as described in RFC 2245 resp. in IETF Draft draft-ietf-sasl-anon-XX.txt.
=head2 CALLBACK
The callbacks used are:
=over 4
=item authname
view all matches for this distribution