view release on metacpan or search on metacpan
t/MyTestHelpers.pm view on Meta::CPAN
use Exporter;
use vars qw(@ISA @EXPORT_OK %EXPORT_TAGS);
@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 {
require Test::More;
my $count = 0;
if (DEBUG) { Test::More::diag ("main_iterations() ..."); }
while (Gtk2->events_pending) {
$count++;
Gtk2->main_iteration_do (0);
if ($count >= 500) {
Test::More::diag ("main_iterations(): oops, bailed out after $count events/iterations");
return;
}
}
Test::More::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) { Test::More::diag ("wait_for_event() iteration $count"); }
Gtk2->main_iteration;
$count++;
}
Test::More::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
t/MyTestHelpers.pm view on Meta::CPAN
#
# use Exporter;
# use vars qw(@ISA @EXPORT_OK %EXPORT_TAGS);
# @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
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
t/02_CellRenderer.t view on Meta::CPAN
diag ("Running on Gtk version ",
Gtk2::major_version(), ".",
Gtk2::minor_version(), ".",
Gtk2::micro_version(), ".");
sub main_iterations {
my $count = 0;
while (Gtk2->events_pending) {
$count++;
Gtk2->main_iteration_do (0);
}
diag "main_iterations(): ran $count events/iterations\n";
}
#-----------------------------------------------------------------------------
# plain creation
t/02_CellRenderer.t view on Meta::CPAN
($event, $toplevel, "0", $rect, $rect, ['selected']);
isa_ok ($editable, 'Gtk2::CellEditable',
'start_editing return');
$toplevel->add ($editable);
$toplevel->remove ($editable);
main_iterations (); # for idle handler hack
require Scalar::Util;
Scalar::Util::weaken ($editable);
is ($editable, undef, 'editable should be garbage collected when weakened');
view all matches for this distribution
view release on metacpan or search on metacpan
t/MyTestHelpers.pm view on Meta::CPAN
#
# use Exporter;
# use vars qw(@ISA @EXPORT_OK %EXPORT_TAGS);
# @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
t/MyTestHelpers.pm view on Meta::CPAN
#
# use Exporter;
# use vars qw(@ISA @EXPORT_OK %EXPORT_TAGS);
# @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
t/MyTestHelpers.pm view on Meta::CPAN
use Exporter;
use vars qw(@ISA @EXPORT_OK %EXPORT_TAGS);
@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 {
require Test::More;
my $count = 0;
if (DEBUG) { Test::More::diag ("main_iterations() ..."); }
while (Gtk2->events_pending) {
$count++;
Gtk2->main_iteration_do (0);
if ($count >= 500) {
Test::More::diag ("main_iterations(): oops, bailed out after $count events/iterations");
return;
}
}
Test::More::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) { Test::More::diag ("wait_for_event() iteration $count"); }
Gtk2->main_iteration;
$count++;
}
Test::More::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
t/MyTestHelpers.pm view on Meta::CPAN
use Exporter;
use vars qw(@ISA @EXPORT_OK %EXPORT_TAGS);
@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 {
require Test::More;
my $count = 0;
if (DEBUG) { Test::More::diag ("main_iterations() ..."); }
while (Gtk2->events_pending) {
$count++;
Gtk2->main_iteration_do (0);
if ($count >= 500) {
Test::More::diag ("main_iterations(): oops, bailed out after $count events/iterations");
return;
}
}
Test::More::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) { Test::More::diag ("wait_for_event() iteration $count"); }
Gtk2->main_iteration;
$count++;
}
Test::More::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
lib/Test/Weaken/Gtk2.pm view on Meta::CPAN
}
sub destructor_destroy_and_iterate {
my ($ref) = @_;
destructor_destroy ($ref);
_main_iterations();
}
# 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.
#
# FIXME: Not sure how aggressive to be on hitting the maximum count. If
# testing can likely continue then a diagnostic is enough, but maybe a
# count-out means something too broken to continue.
#
# The iterations count actually run is cute to see to check what has gone
# through the main loop. Would it be worth giving that always, or under an
# option, or something?
#
sub _main_iterations {
require Test::More;
my $count = 0;
### _main_iterations() ...
while (Gtk2->events_pending) {
$count++;
Gtk2->main_iteration_do (0);
if ($count >= 1000) {
### _main_iterations() count exceeded: $count
eval {
Test::More::diag ("main_iterations(): oops, bailed out after $count events/iterations");
};
return;
}
}
### _main_iterations() events/iterations: $count
}
#------------------------------------------------------------------------------
sub ignore_default_display {
my ($ref) = @_;
lib/Test/Weaken/Gtk2.pm view on Meta::CPAN
=item C<< Test::Weaken::Gtk2::destructor_destroy_and_iterate ($top) >>
The same as C<destructor_destroy()> above, but in addition run
C<< Gtk2->main_iteration_do() >> for queued main loop actions. There's a
limit on the number of iterations done, so as to protect against a runaway
main loop.
This is good if some finalizations are only done in an idle handler, or
perhaps under a timer which has now expired. Currently queued events from
the X server are run, but there's no read or wait for further events.
view all matches for this distribution
view release on metacpan or search on metacpan
t/MyTestHelpers.pm view on Meta::CPAN
#
# use Exporter;
# use vars qw(@ISA @EXPORT_OK %EXPORT_TAGS);
# @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
devel/cross-ids.pl view on Meta::CPAN
'weaken active - initially no CrossHair data');
$cross->start;
diag explain $cross;
# sync and iterate to make the cross draw and use its gc
$display->sync;
MyTestHelpers::main_iterations();
is_deeply (leftover_fields($widget), [],
'weaken active - initially no CrossHair data');
my $weak_cross = $cross;
Scalar::Util::weaken ($weak_cross);
$cross = undef;
MyTestHelpers::main_iterations();
is ($weak_cross, undef, 'weaken active - destroyed');
is_deeply (leftover_fields($widget), [],
'weaken active - no CrossHair data left behind');
$widget->destroy;
view all matches for this distribution
view release on metacpan or search on metacpan
example/performance.pl view on Meta::CPAN
#!/usr/bin/perl -w
# usage: $0 <want_time> <number_of_buckets=100> <number_of_iterations=10000>
use strict;
use YAML;
use Guard::Stats;
view all matches for this distribution
view release on metacpan or search on metacpan
gzip-zopfli-perl.c view on Meta::CPAN
gz->no_warn = 0;
}
return;
}
if (CMP(key, numiterations)) {
int n;
if (! SvIOK (value)) {
warn ("numiterations requires a number");
}
n = SvIV (value);
// Check values
gz->options.numiterations = n;
return;
}
if (CMP (key, blocksplitting)) {
gz->options.blocksplitting = SvTRUE (value);
return;
view all matches for this distribution
view release on metacpan or search on metacpan
Template.pm view on Meta::CPAN
<a href="http://www.google.com">Google</a>
Following preprocessors are effective for C<foreach>.
C<foreach:sep=SEP> proprocessor specifies separator between outputs of
iterations.
For example,
<{ foreach num foreach:sep=' | '}>
<* iter *>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/HP/Handy.pm view on Meta::CPAN
loop.revindex reverse counter (1-based)
loop.revindex0 reverse counter (0-based)
loop.first true on first iteration
loop.last true on last iteration
loop.length total number of items
loop.odd true on odd iterations
loop.even true on even iterations
Dict iteration:
{% for key, value in mapping %}
{{ key }}: {{ value }}
view all matches for this distribution
view release on metacpan or search on metacpan
t/01.progression.t view on Meta::CPAN
my $t_acid = HTML::Acid->new;
my $t_actual = $t_acid->burn($input);
croak "failed" if $t_actual ne $expected;
});
ok($benchmark->iters > $MINIMUM_ITERS*$REFERENCE_SIZE/$size,
"minimal iterations - $basename");
}
else {
pass('set TEST_AUTHOR=1 for timings');
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
Also, this is done so that round trip ( read and then write back out ) behavior
is consistent.
=item * Nodes named value
Previously iterations of this module had problems with nodes named 'value',
due to the fact that node contents are stored under the 'value' key already.
The current version should parse such files without any problem, although it
may be confusing to see a parsed tree with 'value' pointing to another hash
containing 'value' as well.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/HTML/Bricks/Magick.pm view on Meta::CPAN
our $VERSION = '0.02';
my %LegalArguments = map { $_ => 1 }
qw (adjoin background bordercolor colormap colorspace
colors compress density dispose delay dither
display font format iterations interlace
loop magick mattecolor monochrome page pointsize
preview_type quality scene subimage subrange
size tile texture treedepth undercolor);
my %LegalFilters = map { $_ => 1 }
view all matches for this distribution
view release on metacpan or search on metacpan
require 't/lib.pl';
use strict;
use vars qw($iterations);
BEGIN {
# Suppress warnings -- we do some setting of variables without using them
$^W = 0;
$HTML::CMTemplate::DEBUG=1;
print "1..1\n";
print (test() ? "ok 1\n" : "not ok 1\n");
}
sub test {
$iterations = 0;
my $t = new HTML::CMTemplate();
$t->import_template(
filename => 't/while.ctpl',
return compare_str_to_file( T_while::output(), 't/while.real' );
}
sub next {
return ($iterations++ < 10);
}
view all matches for this distribution
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