view release on metacpan or search on metacpan
Changelog.ini view on Meta::CPAN
- Fix t/*.t and examples/*.pl to use DBI_DSN, DBI_USER and DBI_PASS
from the environment, if defined, or to default to SQLite.
MySQL is no longer hard-coded anywhere.
- Fix bug where when the constructor call includes both match_data and
start_id, and the id of the match_data is not start_id, then the _do_query()
method would fail to find a record, which meant both the callbacks passed in
to the constructor (method and post_method), if defined, would be called with
an undefined value for $param{item}. This meant the callbacks would be called
one more time that they should have been. This faulty call took place before
any valid call took place.
EOT
[V 1.9]
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/TxnPool.pm view on Meta::CPAN
server does fsync (data flushing to disk) after each statement. It can be very
slow for many updates. The best solution can be to wrap some
insert/delete/update statements in one transaction for example. But this raises
a new problem - deadlocks. If a deadlock occurs a DBI module throws exceptions
and ideal way to repeat SQL statements again. This module helps to make it. It
has a pool inside for data (FIFO buffer) and calls your callbacks for each
pushed item. When your pool to be fed by your data, it wraps data in one
transaction up to the maximum defined size or up to the finish method. If
deadlock occurs a pool repeats your callbacks for every item again. You can
define a second callback which will be executed for every item after wrapped
transaction. For example there can be non-SQL statements, for example a deleting
files, cleanups and etc.
=head1 CONSTRUCTOR
view all matches for this distribution
view release on metacpan or search on metacpan
* documented reconnect() method
* update() and smartUpdate() will now ignore (just return a
true value) when called with empty $data
Version 0.15
* Documented callbacks
Version 0.14
* The data_source argument to connect() can now be a hash
* Unknown method calls will be passed to the underlying DBI
object. So now you can make calls like prepare() which
view all matches for this distribution
view release on metacpan or search on metacpan
glueHTML.pm view on Meta::CPAN
=over 4
=item Future Additions
In a later version, callbacks to add user defined form parameters to
allow state keeping such as password protection etc.
=item B<set_printheader> B<(>I<Callback function address>B<,> I<Print content type header (1/0)>B<);>
sub printheader {
view all matches for this distribution
view release on metacpan or search on metacpan
* Added support to allow DB_File to build with Berkeley DB 4.1.X
* Tightened up the test harness to test that calls to untie don't generate
the "untie attempted while %d inner references still exist" warning.
* added code to guard against calling the callbacks (compare,hash & prefix)
recursively.
* passing undef for the flags and/or mode when opening a database could cause
a "Use of uninitialized value in subroutine entry" warning. Now silenced.
1.0
DB_File has been in use for over a year. To reflect that, the
version number has been incremented to 1.0.
Added complete support for multiple concurrent callbacks.
Using the push method on an empty list didn't work properly. This
has been fixed.
0.3
Added prototype support for multiple btree compare callbacks.
0.2
When DB_File is opening a database file it no longer terminates the
process if dbopen returned an error. This allows file protection
view all matches for this distribution
view release on metacpan or search on metacpan
ddc-tee.perl view on Meta::CPAN
close($fh)
or die("$prog: close failed for $pidfile: $!");
}
##======================================================================
## callbacks
## undef = cb_client($cli_sock)
sub cb_client {
my $csock = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DDG/Test/Spice.pm view on Meta::CPAN
alt_to_test('DDG::Spice::My::Spice', [qw(alt1 alt2 alt3)]);
This would check for the following:
callbacks 'ddg_spice_my_alt[123]'
paths '/js/spice/my/alt[123]/'
=head1 AUTHOR
DuckDuckGo <open@duckduckgo.com>
view all matches for this distribution
view release on metacpan or search on metacpan
demo/lib/DJabberd/Plugin/Demo.pm view on Meta::CPAN
### initialize a logger
our $logger = DJabberd::Log->get_logger();
### register our plugin. we don't need to do any actions now, but we're
### registering two hooks to be called on certain events. Hooks are implemented
### using callbacks. To see which hooks are available, read 'DJabberd::HookDocs'.
### To see how callbacks work, see 'DJabberd::Callback'.
sub register {
my($self, $vhost) = @_;
### when the client asks for the roster, call this hook first. This allows
### us to manipulate the roster before the client sees it.
demo/lib/DJabberd/Plugin/Demo.pm view on Meta::CPAN
### Update the roster to add the bot (as described in $ritem) to the
### client (as described in $jid). Will call callback $rs_cb when done.
$rs->addupdate_roster_item( $rs_cb, $jid, $ritem );
### callbacks have the possiblity to stop the callback chain from
### continuing, by either throwing an error or telling the callback
### mechanism it is done. In our case, we want the chain to continue.
### See DJabberd::HookDocs for details on this.
$cb->decline;
}
view all matches for this distribution
view release on metacpan or search on metacpan
jbuf_puts(j, "\"\n", 2);
jbuf_indent(j, indent);
jbuf_putc(j, '}');
}
/* write_value callbacks â write the inner string of a tagged scalar
* (no surrounding quotes; the caller already wrote them). */
static void wv_bool(jbuf *j, const dms_value *v) {
jbuf_putcstr(j, v->u.b ? "true" : "false");
}
view all matches for this distribution
view release on metacpan or search on metacpan
jbuf_puts(j, "\"\n", 2);
jbuf_indent(j, indent);
jbuf_putc(j, '}');
}
/* write_value callbacks â write the inner string of a tagged scalar
* (no surrounding quotes; the caller already wrote them). */
static void wv_bool(jbuf *j, const dms_value *v) {
jbuf_putcstr(j, v->u.b ? "true" : "false");
}
view all matches for this distribution
view release on metacpan or search on metacpan
sundown/examples/sundown.c view on Meta::CPAN
{
struct buf *ib, *ob;
int ret;
FILE *in = stdin;
struct sd_callbacks callbacks;
struct html_renderopt options;
struct sd_markdown *markdown;
/* opening the file if given from the command line */
if (argc > 1) {
sundown/examples/sundown.c view on Meta::CPAN
fclose(in);
/* performing markdown parsing */
ob = bufnew(OUTPUT_UNIT);
sdhtml_renderer(&callbacks, &options, 0);
markdown = sd_markdown_new(0, 16, &callbacks, &options);
sd_markdown_render(ob, ib->data, ib->size, markdown);
sd_markdown_free(markdown);
/* writing the result to stdout */
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DR/Tarantool/AsyncClient.pm view on Meta::CPAN
}
=head1 Worker methods
All methods accept callbacks which are invoked with the following arguments:
=over
=item status
view all matches for this distribution
view release on metacpan or search on metacpan
CAB/Queue/Server.pm view on Meta::CPAN
## $cli_or_undef = $qs->accept($timeout_secs)
## + accept incoming client connections with optional timeout
## + INHERITED from DTA::CAB::Socket
## $rc = $qs->handleClient($cli)
## $rc = $qs->handleClient($cli, %callbacks)
## + handle a single client request
## + INHERITED from DTA::CAB::Socket
##--------------------------------------------------------------
## Server Methods: Request Handling
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Daemon/Shutdown.pm view on Meta::CPAN
# Validate the config file
%params = validate_with(
params => \%params,
spec => {
config => {
callbacks => {
'File exists' => sub { -f shift }
},
default => '/etc/sdd.conf',
},
},
lib/Daemon/Shutdown.pm view on Meta::CPAN
%params = validate_with(
params => \%params,
spec => {
log_file => {
default => '/var/log/sdd.log',
callbacks => {
'Log file is writable' => sub {
my $filepath = shift;
if ( -f $filepath ) {
return -w $filepath;
} else {
lib/Daemon/Shutdown.pm view on Meta::CPAN
regex => qr/^[1|0]$/,
},
shutdown_binary => {
default => '/sbin/poweroff',
type => SCALAR,
callbacks => {
'Shutdown binary exists' => sub {
-x shift();
},
},
},
view all matches for this distribution
view release on metacpan or search on metacpan
- Documentation improvements. (debug-ito++)
- use Exporter in Daiku.pm instead of manually writing import(). (debug-ito++)
1.001 2014-05-11T12:39:01Z
- pass argv to merged task callbacks
(Shoichi Kaji)
- support multiple suffix rule
(Shoichi Kaji)
- support coredef src in suffix rule
(Songmu)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Daizu/Util.pm view on Meta::CPAN
my $parser = XML::LibXML->new;
$parser->expand_xinclude(1);
my @included_file;
my $input_callbacks = XML::LibXML::InputCallback->new;
$input_callbacks->register_callbacks([
\&_match_uri,
sub { _open_uri($db, $wc_id, \@included_file, @_) },
\&_read_uri,
\&_close_uri,
]);
$parser->input_callbacks($input_callbacks);
my $root = $doc->documentElement;
$root->setAttribute('xml:base' => 'daizu:///' . url_encode($path))
unless $root->hasAttribute('xml:base');
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dancer/Plugin/Async.pm view on Meta::CPAN
EV::loop
=head1 PROBLEMS
In the callbacks (for example of the timer in the C<SYNOPSIS>), you cannot use
many of the normal Dancer keywords such as template, redirect, etc. This is due
to Dancer accessing Dancer::SharedData, which is not available later on. If
anyone has a good idea on how to solve this problem, suggestions/patches are
very welcome.
view all matches for this distribution
view release on metacpan or search on metacpan
0.99_10 2016-02-06T09:36:21+01:00 (77f07bf => abeltje)
- (abeltje, Sat, 6 Feb 2016 09:36:21 +0100) Autocommit for distribution
Dancer::Plugin::RPC 0.99_10 (test)
- (Larion Garaczi, Tue, 22 Mar 2016 13:58:55 +0100) Handle unhandled
exceptions in callbacks
- Runtime exceptions in the 'callback' functions were not caught. Now
we
- handle them the same way as runtime exceptions in the actual
methods.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dancer/Plugin/SimpleCRUD.pm view on Meta::CPAN
##Return results as a downloaded file, instead of generating the HTML table.
return _return_downloadable_query($args, $sth, params->{format});
}
my @custom_callbacks = ();
for my $custom_col_spec (@{ $args->{custom_columns} || [] } ) {
push @custom_callbacks, {
column=>$custom_col_spec->{name},
transform=> ($custom_col_spec->{transform} or sub { return shift;}),
};
}
my $table = HTML::Table::FromDatabase->new(
-sth => $sth,
-border => 1,
-callbacks => [
{
column => 'actions',
transform => sub {
my $id = shift;
my $action_links;
lib/Dancer/Plugin/SimpleCRUD.pm view on Meta::CPAN
}
}
return $action_links;
},
},
@custom_callbacks,
],
-rename_headers => \%columns_sort_options,
-html => 'escape',
-class => $table_class,
);
view all matches for this distribution
view release on metacpan or search on metacpan
carton.lock view on Meta::CPAN
"version" : "1.1902"
},
"B::Hooks::OP::Check" : {
"dist" : "B-Hooks-OP-Check-0.19",
"mymeta" : {
"abstract" : "Wrap OP check callbacks",
"author" : [
"Florian Ragwitz <rafl@debian.org>"
],
"dynamic_config" : 0,
"generated_by" : "Module::Install version 1.01, CPAN::Meta::Converter version 2.120921",
view all matches for this distribution
view release on metacpan or search on metacpan
public/javascripts/typeahead/typeahead-0.11.1.bundle.js view on Meta::CPAN
if (!cb) {
return this;
}
types = types.split(splitter);
cb = context ? bindContext(cb, context) : cb;
this._callbacks = this._callbacks || {};
while (type = types.shift()) {
this._callbacks[type] = this._callbacks[type] || {
sync: [],
async: []
};
this._callbacks[type][method].push(cb);
}
return this;
}
function onAsync(types, cb, context) {
return on.call(this, "async", types, cb, context);
public/javascripts/typeahead/typeahead-0.11.1.bundle.js view on Meta::CPAN
function onSync(types, cb, context) {
return on.call(this, "sync", types, cb, context);
}
function off(types) {
var type;
if (!this._callbacks) {
return this;
}
types = types.split(splitter);
while (type = types.shift()) {
delete this._callbacks[type];
}
return this;
}
function trigger(types) {
var type, callbacks, args, syncFlush, asyncFlush;
if (!this._callbacks) {
return this;
}
types = types.split(splitter);
args = [].slice.call(arguments, 1);
while ((type = types.shift()) && (callbacks = this._callbacks[type])) {
syncFlush = getFlush(callbacks.sync, this, [ type ].concat(args));
asyncFlush = getFlush(callbacks.async, this, [ type ].concat(args));
syncFlush() && nextTick(asyncFlush);
}
return this;
}
function getFlush(callbacks, context, args) {
return flush;
function flush() {
var cancelled;
for (var i = 0, len = callbacks.length; !cancelled && i < len; i += 1) {
cancelled = callbacks[i].apply(context, args) === false;
}
return !cancelled;
}
}
function getNextTick() {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dancer.pm view on Meta::CPAN
if ( $options{'streaming'} ) {
# handle streaming
$resp->streamed( sub {
my ( $status, $headers ) = @_;
my %callbacks = defined $options{'callbacks'} ?
%{ $options{'callbacks'} } :
();
return sub {
my $respond = shift;
exists $callbacks{'override'}
and return $callbacks{'override'}->( $respond, $resp );
# get respond callback and set headers, get writer in return
my $writer = $respond->( [
$status,
$headers,
] );
# get content from original response
my $content = $resp->content;
exists $callbacks{'around'}
and return $callbacks{'around'}->( $writer, $content );
if ( ref $content ) {
my $bytes = $options{'bytes'} || '43008'; # 42K (dams)
my $buf;
while ( ( my $read = sysread $content, $buf, $bytes ) != 0 ) {
if ( exists $callbacks{'around_content'} ) {
$callbacks{'around_content'}->( $writer, $buf );
} else {
$writer->write($buf);
}
}
} else {
lib/Dancer.pm view on Meta::CPAN
get '/download/:file' => sub {
send_file( params->{file}, streaming => 1 );
}
You can control what happens using callbacks.
First, C<around_content> allows you to get the writer object and the chunk of
content read, and then decide what to do with each chunk:
get '/download/:file' => sub {
send_file(
params->{file},
streaming => 1,
callbacks => {
around_content => sub {
my ( $writer, $chunk ) = @_;
$writer->write("* $chunk");
},
},
lib/Dancer.pm view on Meta::CPAN
get '/download/:file' => sub {
send_file(
params->{file},
streaming => 1,
callbacks => {
around => sub {
my ( $writer, $content ) = @_;
# we know it's a text file, so we'll just stream
# line by line
lib/Dancer.pm view on Meta::CPAN
get '/download/:file' => sub {
send_file(
params->{file},
streaming => 1,
callbacks => {
override => sub {
my ( $respond, $response ) = @_;
my $writer = $respond->( [ $newstatus, $newheaders ] );
$writer->write("some line");
view all matches for this distribution
view release on metacpan or search on metacpan
[BUG FIXES]
* Incorrect call to user_password from app not plugin
(Andrew Beverly, GH #53).
* Avoid memory leaks in BUILD by passing weakened ref to plugin into
add_route callbacks (Peter Mottram).
* Call $app->session instead of $app->app->session in _post_login_route
(Peter Mottram).
[MISC]
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dancer2/Plugin/JobScheduler/Client/TheSchwartz.pm view on Meta::CPAN
if ( $self->config->{'databases'} ) {
my $databases = $self->config->{'databases'};
foreach my $key ( keys %{$databases} ) {
my $database = $databases->{$key};
if ( $database->{'dbh_callback'} ) {
my $e = q{Invalid config. } . q{databases->%s has item dbh_callback; database specific callbacks not supported};
$log->errorf( $e, $key );
croak sprintf $e, $key;
}
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/70dancer2.t view on Meta::CPAN
encoder_args => {
croak_on_bless => 0,
# Messages from later versions of Log::Report do not
# serialize cleanly. Therefore use the object's freeze and
# thaw methods.
freeze_callbacks => 1,
},
decoder_args => {
refuse_objects => 0,
},
},
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dancer2/Plugin/Multilang.pm view on Meta::CPAN
The default language that will be used when plugin can't guess desired one (or when desired one is not managed)
=item C<no_lang_prefix> (optional)
Do not add the language path to the route if it has this prefix. Useful for Google or Facebook authentication callbacks.
no_lang_prefix: /auth
=back
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dancer2/Plugin/Swagger2.pm view on Meta::CPAN
=over
=item * C<url>: URL to passed to L<Swagger2> module
=item * C<controller_factory>: custom callback generator/finder that returns callbacks to routes
=item * C<validate_spec>: boolish value (default: true) telling if Swagger2 file shall be validated by official Swagger specification
=item * C<validate_requests>: boolish value (default: same as C<validate_spec>) telling if HTTP requests shall be validated by loaded specification (needs C<validate_spec> to be true)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dancer2/Plugin/WebSocket.pm view on Meta::CPAN
=back
=head1 PLUGIN KEYWORDS
In the various callbacks, the connection object C<$conn>
is a L<Plack::App::WebSocket::Connection> object
augmented with the L<Dancer2::Plugin::WebSocket::Connection> role.
=head2 websocket_on_open sub { ... }
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dancer2/Session/Cookie.pm view on Meta::CPAN
L<Plack::Middleware::Session::Cookie> -- MAC only
=item *
L<Plack::Middleware::Session::SerializedCookie> -- really just a framework and you provide the guts with callbacks
=item *
L<Dancer2::Core::Role::SessionFactory> -- documentation of the base package, some more attributes to configure the cookie
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Danga/Socket.pm view on Meta::CPAN
provides the basic framework for event-driven asynchronous IO,
designed to be fast. Danga::Socket is both a base class for objects,
and an event loop.
Callers subclass Danga::Socket. Danga::Socket's constructor registers
itself with the Danga::Socket event loop, and invokes callbacks on the
object for readability, writability, errors, and other conditions.
Because Danga::Socket uses the "fields" module, your subclasses must
too.
lib/Danga/Socket.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