view release on metacpan or search on metacpan
lib/HTML/CTPP2.pm view on Meta::CPAN
* __ODD__ - the number of an odd iteration. For the even one - undefined.
* __COUNTER__ - the number of current iteration.
* __RCOUNTER__ - whole number of the loop iterations minus the number of current iteration.
* __EVEN__ - opposite to the __ODD__ variable.
* __SIZE__ - the whole number of the loop iterations.
* __CONTENT__ - contains value of current iteration
=head2 TMPL_foreach
view all matches for this distribution
view release on metacpan or search on metacpan
- Execute -> object, isa
1.3
---
- restrict number of iterations in search
- make [+ +] configurable [ Christian Gilmore 16.10.99] -> done in 2.0
- "$urlprefix" [Steve Willer 14.2.99]
view all matches for this distribution
view release on metacpan or search on metacpan
--blank-lines-before-packages=0
--iterations=2
--no-outdent-long-comments
-bar
-boc
-ci=4
-i=4
view all matches for this distribution
view release on metacpan or search on metacpan
--blank-lines-before-packages=0
--iterations=2
--no-outdent-long-comments
-b
-bar
-boc
-ci=4
view all matches for this distribution
view release on metacpan or search on metacpan
t/MyTestHelpers.pm view on Meta::CPAN
# uncomment this to run the ### lines
#use Smart::Comments;
@ISA = ('Exporter');
@EXPORT_OK = qw(findrefs
main_iterations
warn_suppress_gtk_icon
glib_gtk_versions
any_signal_connections
nowarnings);
%EXPORT_TAGS = (all => \@EXPORT_OK);
t/MyTestHelpers.pm view on Meta::CPAN
#-----------------------------------------------------------------------------
# Gtk/Glib helpers
# Gtk 2.16 can go into a hard loop on events_pending() / main_iteration_do()
# if dbus is not running, or something like that. In any case limiting the
# iterations is good for test safety.
#
sub main_iterations {
my $count = 0;
if (DEBUG) { MyTestHelpers::diag ("main_iterations() ..."); }
while (Gtk2->events_pending) {
$count++;
Gtk2->main_iteration_do (0);
if ($count >= 500) {
MyTestHelpers::diag ("main_iterations(): oops, bailed out after $count events/iterations");
return;
}
}
MyTestHelpers::diag ("main_iterations(): ran $count events/iterations");
}
# warn_suppress_gtk_icon() is a $SIG{__WARN__} handler which suppresses spam
# from Gtk trying to make you buy the hi-colour icon theme. Eg,
#
t/MyTestHelpers.pm view on Meta::CPAN
while (! $done) {
if (DEBUG >= 2) { MyTestHelpers::diag ("wait_for_event() iteration $count"); }
Gtk2->main_iteration;
$count++;
}
MyTestHelpers::diag ("wait_for_event(): '$signame' ran $count events/iterations\n");
$widget->signal_handler_disconnect ($sig_id);
Glib::Source->remove ($timer_id);
}
view all matches for this distribution
view release on metacpan or search on metacpan
xt/benchmark_collectOpenGraph.pl view on Meta::CPAN
Below is the benchmark.
2. With precompiled XPATH queries. Not much faster than hardcodded arguments
Benchmark: timing 400000 iterations of HARD_XPATH, PRECOMPILED_XPATH, RAW_XPATH...
HARD_XPATH: 20 wallclock secs (20.05 usr + 0.01 sys = 20.06 CPU) @ 19940.18/s (n=400000)
PRECOMPILED_XPATH: 19 wallclock secs (19.14 usr + 0.01 sys = 19.15 CPU) @ 20887.73/s (n=400000)
RAW_XPATH: 20 wallclock secs (20.10 usr + 0.00 sys = 20.10 CPU) @ 19900.50/s (n=400000)
=cut
view all matches for this distribution
view release on metacpan or search on metacpan
global incpath).
=head1 Loops
The <loop> tag and the corresponding HTML::Macro::Loop object provide
for repeated blocks of HTML, with subsequent iterations evaluated in
different contexts. Typically you will want to select rows from a database
(lines from a file, files from a directory, etc), and present each
iteration in succession using identical markup. You do this by creating a
<loop> tag in your template file containing the markup to be repeated, and
by creating a correspondingly named Loop object attached to the HTML::Macro
HTML::Macro::Loop::new_loop for a nested loop). The first argument is
the id of the loop and must match the id attribute of a tag in the
template (the match is case sensitive). The remaining arguments are the
names of loop variables.
Append loop iterations (rows) by calling push_array with an array of
values corresponding to the loop variables declared when the loop was
created.
An alternative is to use push_hash, which is analogous to
HTML::Macro::set_hash; it sets up multiple variable substitutions. If you
use push_hash you don't have to declare the names of the variables when you
create the loop object. This allows them to be taken out of a hash and
bound late, for example by names returned in a database query.
pushall_arrays is a shortcut that allows a number of loop iterations to
be pushed at once. It is typically used in conjunction with
DBI::selectall_arrayref.
is_empty returns a true value iff the loop has at least one row.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/HTML/Microformats/Mixin/Parser.pm view on Meta::CPAN
my $self = shift;
my $root = shift || $self->element;
my $max_include_loops = shift || 2;
# Expand microformat include pattern.
my $incl_iterations = 0;
my $replacements = 1;
while (($incl_iterations < $max_include_loops) && $replacements)
{
$replacements = $self->_expand_include_pattern($root) + $self->_expand_include_pattern_2($root);
$incl_iterations++;
}
# Table cell headers pattern.
$self->_expand_table_header_pattern($root);
view all matches for this distribution
view release on metacpan or search on metacpan
--blank-lines-before-packages=0
--iterations=2
--no-outdent-long-comments
-b
-bar
-boc
-ci=4
view all matches for this distribution
view release on metacpan or search on metacpan
examples/bench.pl view on Meta::CPAN
"case-sensitive=i" => \$CASE_SENSITIVE,
"default-escape=i" => \$default_escape,
"template-size=i" => \$template_size,
"bench=s" => \$bench,
);
my $iterations = shift;
my $ht_file = 'test.htc';
my $htcc_file = $ht_file . 'c';
my $tt_file = "test.tt";
my $tst_file = "test.tst";
my $xslfile = "test.xslate";
examples/bench.pl view on Meta::CPAN
for my $key (keys %args) {
my $new_key = sprintf "%21s", $key;
$args_new{ $new_key } = $args{ $key };
}
if ($bench eq 'timethese') {
timethese ($iterations||-1, {
%args_new
});
}
elsif ($bench eq 'cmpthese') {
cmpthese ($iterations||-1, {
%args_new
});
}
}
__END__
view all matches for this distribution
view release on metacpan or search on metacpan
lib/HTML/Template.pm view on Meta::CPAN
Value that is true for the every iteration of the loop except for the first and last.
=item * __outer__
Value that is true for the first and last iterations of the loop.
=item * __odd__
Value that is true for the every odd iteration of the loop.
view all matches for this distribution
view release on metacpan or search on metacpan
examples/benchmarks.pl view on Meta::CPAN
'HTML::Tiny', => sub{ Bench::HTML::Tiny::modal 'this is my modal' },
'HTML::HTML5::Builder' => sub{ Bench::HTML::HTML5::Builder::modal 'this is my modal' },
'HTML::Untidy' => sub{ Bench::HTML::Untidy::modal 'this is my modal' },
};
Benchmark: timing 10000 iterations of HTML::Builder, HTML::HTML5::Builder, HTML::Tiny, HTML::Untidy...
HTML::Builder: 66 wallclock secs (33.58 usr + 31.68 sys = 65.26 CPU) @ 153.23/s (n=10000)
HTML::HTML5::Builder: 5 wallclock secs ( 5.30 usr + 0.00 sys = 5.30 CPU) @ 1886.79/s (n=10000)
HTML::Tiny: 2 wallclock secs ( 1.38 usr + 0.00 sys = 1.38 CPU) @ 7246.38/s (n=10000)
HTML::Untidy: 1 wallclock secs ( 0.88 usr + 0.00 sys = 0.88 CPU) @ 11363.64/s (n=10000)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/HTML/Zoom/FilterBuilder.pm view on Meta::CPAN
For a given selection, repeat over transformations, typically for the purposes
of populating lists. Takes either an array of anonymous subroutines or a zoom-
able object consisting of transformation.
Example of array reference style (when it doesn't matter that all iterations are
pre-generated)
$zoom->select('table')->repeat([
map {
my $elem = $_;
lib/HTML/Zoom/FilterBuilder.pm view on Meta::CPAN
=item repeat_between [SELECTOR]
Selects object to be repeated between items. In the case of array this object
is put between elements, in case of iterator it is put between results of
subsequent iterations, in the case of streamable it is put between events
(->to_stream->next).
See documentation for L</repeat_content>
=back
view all matches for this distribution
view release on metacpan or search on metacpan
--blank-lines-before-packages=0
--iterations=2
--no-outdent-long-comments
-b
-bar
-boc
-ci=4
view all matches for this distribution
view release on metacpan or search on metacpan
--blank-lines-before-packages=0
--iterations=2
--no-outdent-long-comments
-b
-bar
-boc
-ci=4
view all matches for this distribution
view release on metacpan or search on metacpan
lib/HTTP/Cookies/Chrome.pm view on Meta::CPAN
my $key = do {
state $rc2 = require PBKDF2::Tiny;
my $s = $self->_platform_settings;
my $salt = 'saltysalt';
my $length = 16;
PBKDF2::Tiny::derive( 'SHA-1', $password, $salt, $s->{iterations}, $length );
};
state $rc1 = require Crypt::Rijndael;
my $cipher = Crypt::Rijndael->new( $key, Crypt::Rijndael::MODE_CBC() );
$cipher->set_iv( ' ' x 16 );
lib/HTTP/Cookies/Chrome.pm view on Meta::CPAN
sub _platform_settings {
# https://n8henrie.com/2014/05/decrypt-chrome-cookies-with-python/
# https://github.com/n8henrie/pycookiecheat/issues/12
state $settings = {
darwin => {
iterations => 1003,
},
linux => {
iterations => 1,
},
MSWin32 => {
},
};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/HTTP/Cookies/ChromeMacOS.pm view on Meta::CPAN
my $salt = 'saltysalt';
my $iv = ' ' x 16;
my $salt_len = 16;
my $pass = _get_pass();
my $iterations = 1003;
my $key = derive( 'SHA-1', $pass, $salt, $iterations, $salt_len );
my $cipher = Crypt::CBC->new(
-cipher => 'Crypt::OpenSSL::AES',
-key => $key,
view all matches for this distribution
view release on metacpan or search on metacpan
--blank-lines-before-packages=0
--iterations=2
--no-outdent-long-comments
-b
-bar
-boc
-ci=4
view all matches for this distribution
view release on metacpan or search on metacpan
--blank-lines-before-packages=0
--iterations=2
--no-outdent-long-comments
-b
-bar
-boc
-ci=4
view all matches for this distribution
view release on metacpan or search on metacpan
about 4 times less code than either LWP::UserAgent, or HTTP::Lite), it
is also in my tests significantly faster. Here are my benchmark
results requesting http://localhost/ (the Apache "Successful Install"
page):
Benchmark: timing 1000 iterations of ghttp, lite, lwp...
ghttp: 8 wallclock secs ( 0.96 usr + 1.16 sys = 2.12 CPU)
lite: 21 wallclock secs ( 3.00 usr + 3.44 sys = 6.44 CPU)
lwp: 18 wallclock secs ( 9.76 usr + 1.59 sys = 11.35 CPU)
=cut
view all matches for this distribution
view release on metacpan or search on metacpan
--blank-lines-before-packages=0
--iterations=2
--no-outdent-long-comments
-b
-bar
-boc
-ci=4
view all matches for this distribution
view release on metacpan or search on metacpan
lib/HTTP/Response/Parser.pm view on Meta::CPAN
=head1 BENCHMARK
Compare with HTTP::Response->parse.
parse small_header
Benchmark: timing 20000 iterations of parse, xs...
parse: 11 wallclock secs ( 5.05 usr + 0.01 sys = 5.06 CPU) @ 3952.57/s (n=20000)
xs: 2 wallclock secs ( 0.63 usr + 0.00 sys = 0.63 CPU) @ 31746.03/s (n=20000)
parse large_header
Benchmark: timing 20000 iterations of parse, xs...
parse: 26 wallclock secs (15.33 usr + 0.10 sys = 15.43 CPU) @ 1296.18/s (n=20000)
xs: 2 wallclock secs ( 1.22 usr + 0.00 sys = 1.22 CPU) @ 16393.44/s (n=20000)
=head1 EXPORTS
view all matches for this distribution
view release on metacpan or search on metacpan
tools/bench.pl view on Meta::CPAN
}
sub run_benchmark {
my ($name, $cookie) = @_;
my $iterations = 1e5;
my $bench = Dumbbench->new(
target_rel_precision => 0.005,
initial_runs => 20,
);
$bench->add_instances(
# Dumbbench::Instance::PerlSub->new(
# name => get_name('Cookie::Baker', $name),
# code => sub {
# for(1..$iterations){
# Cookie::Baker::crush_cookie($cookie);
# }
# },
# ),
Dumbbench::Instance::PerlSub->new(
name => get_name('Cookie::Baker::XS', $name),
code => sub {
for(1..$iterations){
Cookie::Baker::XS::crush_cookie($cookie);
}
},
),
Dumbbench::Instance::PerlSub->new(
name => get_name('HTTP::XSCookies', $name),
code => sub {
for(1..$iterations){
HTTP::XSCookies::crush_cookie($cookie);
}
},
),
);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Hailo/Engine/Scored.pm view on Meta::CPAN
after BUILD => sub {
my ($self) = @_;
my %args = $self->arguments;
if (defined $args{iterations} && defined $args{interval}) {
die __PACKAGE__.": You can only specify one of 'iterations' and 'interval'\n";
}
return;
};
sub reply {
lib/Hailo/Engine/Scored.pm view on Meta::CPAN
} keys %$token_cache;
}
my $token_probs = $self->_get_pivot_probabilites(\@token_counts);
my @started = gettimeofday();
my $iterations = 0;
my $done;
my %args = $self->arguments;
if (!defined $args{iterations} && !defined $args{interval}) {
# construct replies for half a second by default
$args{interval} = 0.5;
}
if (defined $args{iterations}) {
$done = sub {
return 1 if $iterations == $args{iterations};
};
}
else {
$done = sub {
my $elapsed = tv_interval(\@started, [gettimeofday]);
lib/Hailo/Engine/Scored.pm view on Meta::CPAN
};
}
my (%link_cache, %expr_cache, $best_score, $best_reply);
while (1) {
$iterations++;
my $reply = $self->_generate_reply($token_probs, \%expr_cache);
return if !defined $reply; # we don't know any expressions yet
my $score = $self->_evaluate_reply(\@input_token_ids, $reply, \%link_cache);
lib/Hailo/Engine/Scored.pm view on Meta::CPAN
=head2 C<engine_args>
This is a hash reference which can have the following keys:
=head3 C<iterations>
The number of replies to generate before returning the best one.
=head3 C<interval>
The time (in seconds) to spend on generating replies before returning the
best one.
You can not specify both C<iterations> and C<interval> at the same time. If
neither is specified, a default C<interval> of 0.5 seconds will be used.
=head1 AUTHORS
Hinrik E<Ouml>rn SigurE<eth>sson, hinrik.sig@gmail.com
view all matches for this distribution
view release on metacpan or search on metacpan
PortScanner.pm view on Meta::CPAN
my ( $databits, $parity, $stopbits, $handshake );
my $setting;
my $device;
my $config = $serial->{SEARCH_PARM} = {};
my $parm_found;
my $read_iterations;
my $iterations;
my $chars = 0;
my ( $bytes_read, $data_read );
my $waited;
$serial->_add_scan_log("Scan Ports Request");
PortScanner.pm view on Meta::CPAN
SETTING => "8N1"
}
);
}
# Figure the number of read iterations is needed
if ( exists( $config->{MAX_WAIT} ) ) {
$serial->_add_scan_log("(Max Wait set at $config->{MAX_WAIT})");
$read_iterations = int( $config->{MAX_WAIT} / ( $serial->{READ_CONST_TIME} / 1000 ) );
$read_iterations = 1 if ( $read_iterations < 1 );
}
else {
# Must always go though the loop once
$read_iterations = 1;
}
# Begin Scan of Com Ports
PORT:
PortScanner.pm view on Meta::CPAN
# Wait a maximum amount of time to get expected output but move on
# if we dont get it in the alloted amount of time. This also protects
# us from a device just spewing data.
for ( $iterations = 1 ; $iterations <= $read_iterations ; $iterations++ ) {
# Read from the port
( $bytes_read, $data_read ) = $PortObj->read(255); # docs say this must be 255 always
$waited += $serial->{READ_CONST_TIME};
view all matches for this distribution
view release on metacpan or search on metacpan
Word/noun.txt view on Meta::CPAN
it,its
italian,italians
italic,italics
itch,itches
item,items
iteration,iterations
itinerant,itinerants
itinerary,itineraries
iud,iuds
ivory,ivories
ivy,ivies
view all matches for this distribution
view release on metacpan or search on metacpan
benchmark/hash_bulk_keycopy.pl view on Meta::CPAN
},
}));
__END__
$ perl -Mblib benchmark/hash_bulk_keycopy.pl
Benchmark: timing 1000000 iterations of PP, XS...
PP: 11 wallclock secs (10.54 usr + 0.01 sys = 10.55 CPU) @ 94786.73/s (n=1000000)
XS: 6 wallclock secs ( 5.26 usr + 0.00 sys = 5.26 CPU) @ 190114.07/s (n=1000000)
Rate PP XS
PP 94787/s -- -50%
XS 190114/s 101% --
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Hash/Map.pm view on Meta::CPAN
...
);
=head2 method each_source, each_target, source_iterator, target_iterator
This methods allows to work with iterations.
while ( my ($key, $value) = $self->each_source ) {
...
}
view all matches for this distribution
view release on metacpan or search on metacpan
my $i = 0;
while (my $mk = each %hmk) {
++$i;
ok(exists $hmk{$mk}, 'each all: scalar context');
}
is(scalar(keys %hmk), $i, 'each all: number of iterations');
foreach (0..$#mk) {
delete $hmk{$mk[$_]};
while (my ($mk, $v) = each %hmk) {
is_deeply($hmk{$mk}, $v, "each $i: @$mk");
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Hash/StoredIterator.pm view on Meta::CPAN
=item Modification of hash during iteration
Just like with the builtin C<each()> modifying the hash between calls to each
is not recommended and can result in undefined behavior. The builtin C<each()>
does allow for deleting the iterations key, however that is B<NOT> supported by
this library.
=item sort() edge case
For some reason C<[sort hkeys %hash]> and C<[sort hkeys(%hash)]> both result in
view all matches for this distribution