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


AnyEvent-Superfeedr

 view release on metacpan or  search on metacpan

lib/AnyEvent/Superfeedr.pm  view on Meta::CPAN


# TODO:
# debug
# tests? worthwhile?
#
# Also, maybe more direct callbacks for sub/unsub

sub new {
    my $class = shift;
    my %param = @_;

 view all matches for this distribution


AnyEvent-Sway

 view release on metacpan or  search on metacpan

lib/AnyEvent/Sway.pm  view on Meta::CPAN

            on_error => sub {
                my ($hdl, $fatal, $msg) = @_;
                delete $self->{ipchdl};
                $hdl->destroy;

                my $cb = $self->{callbacks};

                # Trigger all one-time callbacks with undef
                for my $type (keys %{$cb}) {
                    next if ($type & $event_mask) == $event_mask;
                    $cb->{$type}->();
                    delete $cb->{$type};
                }

lib/AnyEvent/Sway.pm  view on Meta::CPAN


sub _handle_sway_message
{
    my ($self, $type, $payload) = @_;

    return unless defined($self->{callbacks}->{$type});

    my $cb = $self->{callbacks}->{$type};
    $cb->(decode_json $payload);

    return if ($type & $event_mask) == $event_mask;

    # If this was a one-time callback, we delete it
    # (when connection is lost, all one-time callbacks get triggered)
    delete $self->{callbacks}->{$type};
}

=head2 $sway->subscribe(\%callbacks)

Subscribes to the given event types. This function awaits a hashref with the
key being the name of the event and the value being a callback.

    my %callbacks = (
        workspace => sub { say "Workspaces changed" }
    );

    if ($sway->subscribe(\%callbacks)->recv->{success}) {
        say "Successfully subscribed";
    }

The special callback with name C<_error> is called when the connection to Sway
is killed (because of a crash, exit or restart of Sway most likely). You can
use it to print an appropriate message and exit cleanly or to try to reconnect.

    my %callbacks = (
        _error => sub {
            my ($msg) = @_;
            say "I am sorry. I am so sorry: $msg";
            exit 1;
        }
    );

    $sway->subscribe(\%callbacks)->recv;

=cut
sub subscribe
{
    my ($self, $callbacks) = @_;

    # Register callbacks for each message type
    for my $key (keys %{$callbacks}) {
        my $type = $events{$key};
        $self->{callbacks}->{$type} = $callbacks->{$key};
    }

    $self->message(TYPE_SUBSCRIBE, [ keys %{$callbacks} ])
}

=head2 $sway->message($type, $content)

Sends a message of the specified C<type> to Sway, possibly containing the data

lib/AnyEvent/Sway.pm  view on Meta::CPAN


    my $cv = AnyEvent->condvar;

    # We don’t preserve the old callback as it makes no sense to
    # have a callback on message reply types (only on events)
    $self->{callbacks}->{$type} =
        sub {
            my ($reply) = @_;
            $cv->send($reply);
            undef $self->{callbacks}->{$type};
        };

    $cv
}

 view all matches for this distribution


AnyEvent-Task

 view release on metacpan or  search on metacpan

lib/AnyEvent/Task.pm  view on Meta::CPAN


But in an asynchronous program, typically C<hash> would initiate some kind of asynchronous operation and then return immediately, allowing the program to go about other tasks while waiting for the result. Since the error might come back at any time i...

AnyEvent::Task accomplishes this mapping with L<Callback::Frame>.

Callback::Frame lets you preserve error handlers (and C<local> variables) across asynchronous callbacks. Callback::Frame is not tied to AnyEvent::Task, AnyEvent or any other async framework and can be used with almost all callback-based libraries.

However, when using AnyEvent::Task, libraries that you use in the client must be L<AnyEvent> compatible. This restriction obviously does not apply to your server code, that being the main purpose of this module: accessing blocking resources from an a...

As an example usage of Callback::Frame, here is how we would handle errors thrown from a worker process running the C<hash> method in an asychronous client program:

lib/AnyEvent/Task.pm  view on Meta::CPAN

      say "Error is: $@";
      say "Full back-trace: $back_trace";

    })->(); ## <-- frame is created and then immediately executed

Of course if C<hash> is something like a bcrypt hash function it is unlikely to raise an exception so maybe that's a bad example. On the other hand, maybe it's a really good example: In addition to errors that occur while running your callbacks, L<An...



=head2 Rationale for Callback::Frame

Why not just call the callback but set C<$@> and indicate an error has occurred? This is the approach taken with L<AnyEvent::DBI> for example. I believe the L<Callback::Frame> interface is superior to this method. In a synchronous program, exceptions...

How about having AnyEvent::Task expose an error callback? This is the approach taken by L<AnyEvent::Handle> for example. I believe Callback::Frame is superior to this method also. Although separate callbacks are (sort of) out-of-band, you still have ...

In servers, Callback::Frame helps you maintain the "dynamic state" (error handlers and dynamic variables) installed for a single connection. In other words, any errors that occur while servicing that connection will be able to be caught by an error h...

Callback::Frame provides an error handler stack so you can have a top-level handler as well as nested handlers (similar to nested C<eval>s). This is useful when you wish to have a top-level "bail-out" error handler and also nested error handlers that...

Callback::Frame is designed to be easily used with callback-based libraries that don't know about Callback::Frame. C<fub> is a shortcut for C<frame> with just the C<code> argument. Instead of passing C<sub { ... }> into libraries you can pass in C<fu...

It's important that all callbacks be created with C<fub> (or C<frame>) even if you don't expect them to fail so that the dynamic context is preserved for nested callbacks that may. An exception is the callbacks provided to AnyEvent::Task checkouts: T...

The L<Callback::Frame> documentation explains how this works in much more detail.



 view all matches for this distribution


AnyEvent-Tools

 view release on metacpan or  search on metacpan

lib/AnyEvent/Tools.pm  view on Meta::CPAN

You declare that You want to lock mutex for writing. When it is
possible the mutex will be locked and Your callback will be called.

There may be only one write process that catches the lock.

Both callbacks receive a guard to hold the mutex locked.


=head3 rlock_limit(NUMBER)

Get/Set count limit for rlock. If an rlock request is come and this limit

lib/AnyEvent/Tools.pm  view on Meta::CPAN


=back

=head2 async_for(HASREF|ARRAYREF, CALLBACK [, DONE_CALLBACK ]);

Calls Your callbacks for each array or hash element.

The function returns the guard if it is called in non-void
context. Destroy the guard if You want to cancel iterations.

If You process an array using the function, iteration callback

 view all matches for this distribution


AnyEvent-WebSocket-Client

 view release on metacpan or  search on metacpan

lib/AnyEvent/WebSocket/Client.pm  view on Meta::CPAN

 
 $client->connect("ws://localhost:1234/service")->cb(sub {
 
   # make $connection an our variable rather than
   # my so that it will stick around.  Once the
   # connection falls out of scope any callbacks
   # tied to it will be destroyed.
   our $connection = eval { shift->recv };
   if($@) {
     # handle error...
     warn $@;

lib/AnyEvent/WebSocket/Client.pm  view on Meta::CPAN

L<AnyEvent::FAQ#My-program-exits-before-doing-anything-whats-going-on>.

It is probably also a good idea to review the L<AnyEvent> documentation
if you are new to L<AnyEvent> or event-based programming.

=head2 My callbacks aren't being called!

Make sure that the connection object is still in scope.  This often happens
if you use a C<my $connection> variable and don't save it somewhere.  For
example:

lib/AnyEvent/WebSocket/Client.pm  view on Meta::CPAN

 
   ...
 });

Unless C<$connection> is saved somewhere it will get deallocated along with
any associated message callbacks will also get deallocated once the connect
callback is executed.  One way to make sure that the connection doesn't
get deallocated is to make it a C<our> variable (as in the synopsis above)
instead.

=head1 CAVEATS

 view all matches for this distribution


AnyEvent-Worker

 view release on metacpan or  search on metacpan

lib/AnyEvent/Worker.pm  view on Meta::CPAN

		delete $self->{tw};
		delete $self->{rw};
		delete $self->{ww};
		delete $self->{fh};
		
		# for fatal errors call all enqueued callbacks with error
		while (my $req = shift @{$self->{queue}}) {
			@caller = ($req->[1],$req->[2]) unless $caller;
			$caller ||= " after $req->[1] line $req->[2],";
			local $@ = "$error at $req->[1] line $req->[2].\n";
			$req->[0]->($self);

 view all matches for this distribution


AnyEvent-XMLRPC

 view release on metacpan or  search on metacpan

lib/AnyEvent/XMLRPC.pm  view on Meta::CPAN

	# register methods, use Frontier::RPC2 to encode/decode xml
	${$self}{'methods'} = $methods;
	${$self}{'decode'} = new Frontier::RPC2 'use_objects' => $args{'use_objects'};
	
	
	# register AnyEvent(::HTTPD) callbacks
	$self->reg_cb (
		'/RPC2' => sub {
			my ($httpd, $req) = @_;
			
			#~ my $reply = ${$self}{'decode'}->serve(

 view all matches for this distribution


AnyEvent-XMPP

 view release on metacpan or  search on metacpan

lib/AnyEvent/XMPP.pm  view on Meta::CPAN


=item L<Object::Event>

The former L<AnyEvent::XMPP::Event> module has been outsourced to the L<Object::Event>
module to provide a more generic way for more other modules to register and call
event callbacks.

=item L<XML::Writer>

For writing "XML".

 view all matches for this distribution


AnyEvent-XSPromises

 view release on metacpan or  search on metacpan

XSPromises.xs  view on Meta::CPAN

struct xspr_promise_s {
    xspr_promise_state_t state;
    int refs;
    union {
        struct {
            xspr_callback_t** callbacks;
            int callbacks_count;
        } pending;
        struct {
            xspr_result_t *result;
        } finished;
    };

XSPromises.xs  view on Meta::CPAN

        /* Process the callback. This could trigger some Perl code, meaning we
         * could end up with additional queue entries after this */
        xspr_callback_process(aTHX_ cur->callback, cur->origin);

        /* Free-ing the callback structure could theoretically trigger DESTROY subs,
         * enqueueing new callbacks, so we can't assume the loop ends here! */
        MY_CXT.queue_head = cur->next;
        if (cur->next == NULL) {
            MY_CXT.queue_tail = NULL;
        }

XSPromises.xs  view on Meta::CPAN

    int count, i;
    SV* error;
    xspr_result_t* result;

    if (!SvROK(perl_fn)) {
        return xspr_result_from_error(aTHX_ "promise callbacks need to be a CODE reference");
    }

    ENTER;
    SAVETMPS;

XSPromises.xs  view on Meta::CPAN

    for (i = 0; i < input_count; i++) {
        PUSHs(input[i]);
    }
    PUTBACK;

    /* Clear $_ so that callbacks don't end up talking to each other by accident */
    SAVE_DEFSV;
    DEFSV_set(sv_newmortal());

    count = call_sv(perl_fn, G_EVAL|G_ARRAY);

XSPromises.xs  view on Meta::CPAN


/* Transitions a promise from pending to finished, using the given result */
void xspr_promise_finish(pTHX_ xspr_promise_t* promise, xspr_result_t* result)
{
    assert(promise->state == XSPR_STATE_PENDING);
    xspr_callback_t** pending_callbacks = promise->pending.callbacks;
    int count = promise->pending.callbacks_count;

    promise->state = XSPR_STATE_FINISHED;
    promise->finished.result = result;
    xspr_result_incref(aTHX_ promise->finished.result);

    int i;
    for (i = 0; i < count; i++) {
        xspr_queue_add(aTHX_ pending_callbacks[i], promise);
    }
    Safefree(pending_callbacks);
}

/* Create a new xspr_result_t object with the given number of item slots */
xspr_result_t* xspr_result_new(pTHX_ xspr_result_state_t state, int count)
{

XSPromises.xs  view on Meta::CPAN

void xspr_promise_decref(pTHX_ xspr_promise_t *promise)
{
    if (--(promise->refs) == 0) {
        if (promise->state == XSPR_STATE_PENDING) {
            /* XXX: is this a bad thing we should warn for? */
            int count = promise->pending.callbacks_count;
            xspr_callback_t **callbacks = promise->pending.callbacks;
            int i;
            for (i = 0; i < count; i++) {
                xspr_callback_free(aTHX_ callbacks[i]);
            }
            Safefree(callbacks);

        } else if (promise->state == XSPR_STATE_FINISHED) {
            xspr_result_decref(aTHX_ promise->finished.result);

        } else {

XSPromises.xs  view on Meta::CPAN


/* Adds a then to the promise. Takes ownership of the callback */
void xspr_promise_then(pTHX_ xspr_promise_t* promise, xspr_callback_t* callback)
{
    if (promise->state == XSPR_STATE_PENDING) {
        promise->pending.callbacks_count++;
        Renew(promise->pending.callbacks, promise->pending.callbacks_count, xspr_callback_t*);
        promise->pending.callbacks[promise->pending.callbacks_count-1] = callback;

    } else if (promise->state == XSPR_STATE_FINISHED) {
        xspr_queue_add(aTHX_ callback, promise);

    } else {

 view all matches for this distribution


AnyEvent-ZabbixSender

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

1.1  Sat Sep 14 21:42:32 CEST 2019
	- the default on_error handler would not log the actual message.

1.0  Thu Jan 18 17:37:23 CET 2018
	- zabbix of course does not support sub-second timestamps.
        - pass zabbix object to callbacks.
        - fix a bug where values were submitted without waiting for
          the delay time.

0.1  Thu Jan 18 09:26:10 CET 2018
	- mostly untested, pre-alpha.

 view all matches for this distribution


AnyMQ-ZeroMQ

 view release on metacpan or  search on metacpan

lib/AnyMQ/Topic/Trait/ZeroMQ.pm  view on Meta::CPAN

# send events to ZeroMQ server
after 'dispatch_messages' => sub {
    my ($self, @events) = @_;
    
    # if this bus is just listening for events, we don't need to
    # publish the event to the zeromq server, just call callbacks
    return unless $self->bus->publish_address;

    my $pub = $self->bus->_zmq_pub;

    # encode events as JSON and transmit them

 view all matches for this distribution


AnyMQ

 view release on metacpan or  search on metacpan

lib/AnyMQ/Queue.pm  view on Meta::CPAN


Timeout value for this queue.  Default is 55.

=head2 on_error(sub { my ($queue, $error, @msg) = @_; ... })

Sets the error handler invoked when C<poll> or C<poll_once> callbacks
fail.  By default the queue is marked as destroyed.  If you register
this error handler, you should call C<< $queue->destroyed(1) >> should you
wish to mark the queue as destroyed and reclaim resources.

Note that for queues that are currently C<poll>'ed, you may unset the

 view all matches for this distribution


Apache-AxKit-Language-LibXSLTEnhanced

 view release on metacpan or  search on metacpan

lib/Apache/AxKit/Language/LibXSLTEnhanced.pm  view on Meta::CPAN

__END__
# Below is stub documentation for your module. You'd better edit it!

=head1 NAME

Apache::AxKit::Language::LibXSLTEnhanced - AxKit extension to load perl callbacks for XSL

=head1 SYNOPSIS
  
  <Files *.zuml>
      AxAddStyleMap text/xsl Apache::AxKit::Language::LibXSLTEnhanced

 view all matches for this distribution


Apache-DAV

 view release on metacpan or  search on metacpan

xs/Apache/DAV/DynModule/DynModule.xs  view on Meta::CPAN

MODULE = Apache::DAV::DynModule    PACKAGE = Apache::DAV::DynModule 



void
init_callbacks (obj)
    SV *  obj
PREINIT:
    int  n = -1 ;
    int  i ;
    Apache__DAV__DynModule cobj = (Apache__DAV__DynModule)davxs_sv2_Apache__DAV__DynModule(obj) ;

xs/Apache/DAV/DynModule/DynModule.xs  view on Meta::CPAN

                break ;
                }
            }
        
    if (n < 0)
        croak ("Limit for concurrent object callbacks reached for Apache::DAV::DynModule. Limit is 4") ;

    davxs_Apache__DAV__DynModule_obj[n] = ref ;
    cobj -> module_open = davxs_davxs_cb_Apache__DAV__DynModule__module_open_func[n] ;
    cobj -> module_close = davxs_davxs_cb_Apache__DAV__DynModule__module_close_func[n] ;
    cobj -> dir_open = davxs_davxs_cb_Apache__DAV__DynModule__dir_open_func[n] ;

 view all matches for this distribution


Apache-DebugInfo

 view release on metacpan or  search on metacpan

DebugInfo.pm  view on Meta::CPAN

Phase misspellings, like 'PelrInitHandler' pass through without
warning, in case you were wondering where your output went...

The get_handlers and mark_phases methods are incomplete, mainly due to
oversights in the mod_perl API.  Currently (as of mod_perl 1.2401),
they cannot function properly on the following callbacks: 
  PerlInitHandler
As such, they have been disabled until forthcoming corrections to the
API can be implemented.  PerlHeaderParserHandlers and 
PerlPostRequestHandlers function normally.

 view all matches for this distribution


Apache-SdnFw

 view release on metacpan or  search on metacpan

lib/Apache/SdnFw/js/slider.js  view on Meta::CPAN

if (!Control) var Control = { };

// options:
//  axis: 'vertical', or 'horizontal' (default)
//
// callbacks:
//  onChange(value)
//  onSlide(value)
Control.Slider = Class.create({
  initialize: function(handle, track, options) {
    var slider = this;

 view all matches for this distribution


Apache-Session-Wrapper

 view release on metacpan or  search on metacpan

lib/Apache/Session/Wrapper.pm  view on Meta::CPAN

	default => 1,
	descr => 'Resend the cookie on each request?' },

      header_object =>
      { type => OBJECT,
        callbacks =>
        { 'has a method to set headers' =>
          sub { grep { $_[0]->can($_) } @HeaderMethods } },
        optional => 1,
        descr => 'An object that can be used to send cookies with' },

 view all matches for this distribution


Apache-Test

 view release on metacpan or  search on metacpan

lib/Apache/TestClient.pm  view on Meta::CPAN

#this module provides some fallback for when libwww-perl is not installed
#it is by no means an LWP replacement, just enough for very simple requests

#this module does not and will never support certain features such as:
#file upload, http/1.1 (byteranges, keepalive, etc.), following redirects,
#authentication, GET body callbacks, SSL, etc.

use strict;
use warnings FATAL => 'all';

use Apache::TestRequest ();

 view all matches for this distribution


Apache-UploadMeter

 view release on metacpan or  search on metacpan

lib/Apache/UploadMeter/Resources/JavaScript.pm  view on Meta::CPAN


    // Constructor - Parameters are:
    //               el: Outer div to bind widget to
    //               meter: uploadmeter id
    //               url: uploadmeter ajax url
    //               options: additional callbacks, etc
    initialize: function(el, meter, url, options) {
        this.url = url;
        this.meter = meter;
        this.main = $(el);
        Object.extend(this.options, options || {});

 view all matches for this distribution


Apache-Voodoo

 view release on metacpan or  search on metacpan

lib/Apache/Voodoo/Table.pm  view on Meta::CPAN


sub add_insert_callback {
	my $self    = shift;
	my $sub_ref = shift;

	push(@{$self->{'insert_callbacks'}},$sub_ref);
}

sub add_update_callback {
	my $self    = shift;
	my $sub_ref = shift;

	push(@{$self->{'update_callbacks'}},$sub_ref);
}

sub list_param_parser {
	my $self    = shift;
	my $sub_ref = shift;

lib/Apache/Voodoo/Table.pm  view on Meta::CPAN

	my $dbh    = $p->{'dbh'};
	my $params = $p->{'params'};

	my $errors = {};

	# call each of the insert callbacks
	foreach (@{$self->{'insert_callbacks'}}) {
		my $callback_errors = $_->($dbh,$params);
		@{$errors}{keys %{$callback_errors}} = values %{$callback_errors};
	}

	# do all the normal parameter checking

lib/Apache/Voodoo/Table.pm  view on Meta::CPAN

	unless ($params->{$self->{'pkey'}} =~ /$self->{'pkey_regexp'}/) {
		return $self->display_error("Invalid ID");
	}

	my $errors = {};
	# call each of the update callbacks
	foreach (@{$self->{'update_callbacks'}}) {
		# call back should return a list of error strings
		my $callback_errors = $_->($dbh,$params);
		@{$errors}{keys %{$callback_errors}} = values %{$callback_errors};
	}

 view all matches for this distribution


Apache2-AutoIndex-XSLT

 view release on metacpan or  search on metacpan

lib/Apache2/AutoIndex/XSLT.pm  view on Meta::CPAN

# Used for writing to Apache logs
use Apache2::Log qw();

# Used for parsing Apache configuration directives
use Apache2::Module qw();
use Apache2::CmdParms qw(); # Needed for use with Apache2::Module callbacks

# Used to get the main server Apache2::ServerRec (not the virtual ServerRec)
use Apache2::ServerUtil qw();

# Used for Apache2::Util::ht_time time formatting

 view all matches for this distribution


Apache2-Filter-GoogleAnalytics

 view release on metacpan or  search on metacpan

lib/Apache2/Filter/GoogleAnalytics.pm  view on Meta::CPAN

	my $parser = new HTML::Parser (
		api_version => 3,
		end_h => [\&end_handler, 'self, tagname, text'],
		default_h => [\&default_handler, 'self, text'],
	);
	# This is opaque structure passed to callbacks
	$parser->{filter} = $filter;

	# If the GA ID is present, format the GA Code
	# Only for HTML resources
	my $config = Apache2::Module::get_config (__PACKAGE__,

 view all matches for this distribution


Apache2-HTML-Detergent

 view release on metacpan or  search on metacpan

lib/Apache2/HTML/Detergent.pm  view on Meta::CPAN


    my ($type, $content) = @$ctx;

    # this is where we hack the content

    # set up the input callbacks with subreq voodoo
    my $icb = $config->callback;
    $icb->register_callbacks([
        sub {
            # MATCH
            return $_[0] =~ m!^/!;
        },
        sub {

 view all matches for this distribution


Apache2-ModXml2

 view release on metacpan or  search on metacpan

lib/Apache2/ModXml2.pm  view on Meta::CPAN

end bucket. Even so the start node continues to exist until
the end node is reached, modifying it may be pointless if it 
has been passed to the filter again. The node may have been sent
over the network.

C<Apache2::ModXml2> also offers XPath callbacks, that get called
on matches of (very) simple XPath selectors. Unlike the simpler
ModXml2 functions these can do DOM tree manipulation since the
matches get passed in as trees.

=head1 FUNCTIONS

 view all matches for this distribution


Apache2-Protocol-ESMTP

 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


Apache2-Protocol

 view release on metacpan or  search on metacpan

lib/Apache2/Protocol.pm  view on Meta::CPAN

    my $cb    = shift;
    my $tag   = shift  || 'DEFAULT';

    $self->{regexdispatch}{$tag}{$regex} = $cb;
    unless(exists $self->{enabled_tags}{$tag}) {
	$self->enable_callbacks($tag);
    }
}

sub enable_callbacks {
    my $self = shift;
    my $tag  = shift || 'DEFAULT';
    $self->{enabled_tags}{$tag} = 1;
}

sub disable_callbacks {
    my $self = shift;
    my $tag  = shift || 'DEFAULT';
    $self->{enabled_tags}{$tag} = 0;
}

 view all matches for this distribution


ApacheLog-Compressor

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

	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


App-Alice

 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


App-CPAN2Pkg

 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


App-CamelPKI

 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


( run in 0.389 second using v1.01-cache-2.11-cpan-9b1e4054eb1 )