view release on metacpan or search on metacpan
deps/libffi/ltmain.sh view on Meta::CPAN
*)
# Relative path, prepend $cwd.
func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
;;
esac
# Cancel out all the simple stuff to save iterations. We also want
# the path to end with a slash for ease of parsing, so make sure
# there is one (and only one) here.
func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
-e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
while :; do
view all matches for this distribution
view release on metacpan or search on metacpan
1 => { rules => [ 0 => [ 1, sub { $_[0]->done($_[0]->machine->{count} == 3 ) } ] ] },
), "Construct with simple states to run";
is $fsa->run, $fsa, "... Run should return the FSA object";
is $fsa->{count}, 3,
"... And it should have run through the proper number of iterations.";
# Reset and try again.
$fsa->{count} = 0;
is $fsa->done(0), $fsa, "... We should be able to reset done";
ok $state = $fsa->curr_state, "... We should be left in state '0'";
isa_ok $state, 'FSA::State';
view all matches for this distribution
view release on metacpan or search on metacpan
-npro
-nsfs
--blank-lines-before-packages=0
--opening-hash-brace-right
--no-outdent-long-comments
--iterations=2
-wbb="% + - * / x != == >= <= =~ !~ < > | & >= < = **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x="
view all matches for this distribution
view release on metacpan or search on metacpan
-npro
-nsfs
--blank-lines-before-packages=0
--opening-hash-brace-right
--no-outdent-long-comments
--iterations=2
-wbb="% + - * / x != == >= <= =~ !~ < > | & >= < = **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x="
view all matches for this distribution
view release on metacpan or search on metacpan
-npro
-nsfs
--blank-lines-before-packages=0
--opening-hash-brace-right
--no-outdent-long-comments
--iterations=2
-wbb="% + - * / x != == >= <= =~ !~ < > | & >= < = **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x="
view all matches for this distribution
view release on metacpan or search on metacpan
benchmark/simple_digest.pl view on Meta::CPAN
[5, 1_000_000_000],
]);
foreach my $test (@$test_set) {
my ($file, $iter, $size) = @$test;
say "# $iter iterations on ${size}B file";
cmpthese(
$iter,
{
'md5' => sub { $file->digest('MD5') },
'sha1' => sub { $file->digest('SHA-1') },
view all matches for this distribution
view release on metacpan or search on metacpan
eg/benchmark.pl view on Meta::CPAN
use File::KDBX::XS;
use Benchmark qw(:all :hireswallclock);
use Test::More;
my $iterations = shift // 50;
my $rounds = 500_000;
my $key = "\1" x 32;
my $seed = "\1" x 16;
my $expected = pack('H*', '3f7dfb512060cc8be094cd259c7ff03c');
eg/benchmark.pl view on Meta::CPAN
is $r, cryptx(), 'XS transform agrees with CryptX';
is $r, crypt_rijndael(), 'XS transform agrees with Crypt::Rijndael';
done_testing;
my $timings = timethese($iterations, {
crypt_rijndael => \&crypt_rijndael,
cryptx => \&cryptx,
xs => \&xs,
});
cmpthese($timings);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/File/KDBX.pm view on Meta::CPAN
The transform seed I<should> be changed each time the database is saved to file.
=head2 transform_rounds
The number of rounds or iterations used in the key derivation function. Increasing this number makes loading
and saving the database slower in order to make dictionary and brute force attacks more costly.
=head2 encryption_iv
The initialization vector used by the cipher.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/File/Locate/Iterator.pm view on Meta::CPAN
Iterators from this module are stand-alone and don't need any of the Perl
iterator frameworks. But see L<Iterator::Locate>,
L<Iterator::Simple::Locate> and L<MooseX::Iterator::Locate> to inter-operate
with those others. Those frameworks include ways to grep, map and otherwise
manipulate iterations.
=head2 Forks and Threads
If an iterator using a file handle is cloned to a new thread or to a process
level C<fork()> then generally it can be used by the parent or the child but
view all matches for this distribution
view release on metacpan or search on metacpan
t/002-file-callbacks.t view on Meta::CPAN
my $empty = "$tmpdir/empty.txt";
File::Raw::spew($empty, "");
my $count = 0;
File::Raw::each_line($empty, sub { $count++ });
is($count, 0, 'no iterations for empty file');
};
subtest 'each_line nonexistent file' => sub {
my @collected;
File::Raw::each_line("$tmpdir/nonexistent.txt", sub {
view all matches for this distribution
view release on metacpan or search on metacpan
t/02-aurora.t view on Meta::CPAN
Defaults to 0.2. Seconds to sleep between the cration of the initial
files.
=item B<--sleep2=f>
Defaults to 0.1. Seconds to sleep between the iterations of the second
phase.
=item B<--iterations=i>
Defaults to 30. Number of iterations in the second phase.
=back
=head1 DESCRIPTION
t/02-aurora.t view on Meta::CPAN
) or pod2usage(1);
$Opt{cleanup} = 1 unless defined $Opt{cleanup};
$Opt{sleep1} = 0.2 unless defined $Opt{sleep1};
$Opt{sleep2} = 0.1 unless defined $Opt{sleep2};
$Opt{iterations} = 30 unless defined $Opt{iterations};
$Opt{files} = 15 unless defined $Opt{files};
use File::Basename qw(dirname);
use File::Find;
t/02-aurora.t view on Meta::CPAN
my $rfs = $rrr->recentfiles;
for my $rf (@$rfs) {
$rf->sleep_per_connection(0);
}
$rrr->_rmirror_sleep_per_connection(0.001);
for (my $t=0; $t < $Opt{iterations}; $t++) {
$rf0->aggregate;
$rrr->rmirror;
archive;
sleep $Opt{sleep2};
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/File/Sip.pm view on Meta::CPAN
is => 'ro',
default => sub {1},
);
# internal cursor for iterations
has _read_line_position => (
is => 'rw',
default => sub {0},
);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/File/Which/Cached.pm view on Meta::CPAN
which twice for the same executable, it performs twice.
This module will save the result, so that if your code is called to lookup an
executable a thousand times, it takes just as long as one time.
This is desirable in iterations of many calls, etc.
In 2 thousand calls, we save one second.
=head1 SUBS
Not exported by default.
view all matches for this distribution
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
decryption. (This is known as "password-based encryption" (PBE).) The special
value "rand" means that a 32-byte password will be randomly generated using the
random number generator specified by the B<--rng> option.
The key will be derived using the PBKDF2 algorithm defined in PKCS#5 v2.0 (which
is also available as RFC2898). An 8-byte random salt and 2048 iterations are
used. A random initialization vector (IV) is also generated if required. When
encrypting, both the salt and IV are prepended to the ciphertext so that they
may be recovered for use when decrypting.
Alternatively, the key may be specified directly (or randomly generated) using
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/lib/Test/MockBank.pm view on Meta::CPAN
}
$GLOBALSTATE{$key};
}
sub fail_on_iterations {
my $self = shift;
my $iterations = [ @_ ];
$self->globalstate( 'fail', [ $iterations, 0 ] );
}
sub on_page {
my $self = shift;
my $uri = shift;
t/lib/Test/MockBank.pm view on Meta::CPAN
$iteration++;
Test::MockBank->globalstate( 'fail', [ $failures, $iteration ]);
if ( grep {m/^$iteration$/} @{$failures} ) {
diag( "failing per request on iteration $iteration when " . $request->method . "ing " . $request->uri) if $ENV{DEBUG};
my @iterations = grep {!m/^$iteration$/} @{$failures};
if ( !@iterations ) {
Test::MockBank->globalstate( 'fail', 0 );
} else {
Test::MockBank->globalstate( 'fail', [ \@iterations, $iteration ] );
}
$response->code( RC_INTERNAL_SERVER_ERROR );
$response->content( 'FAIL' );
diag( "returning " . $response->code) if $ENV{DEBUG};
return $response;
view all matches for this distribution
view release on metacpan or search on metacpan
CompanyNames/TextSupport.pm view on Meta::CPAN
issuance issuances
istambay istambays
istotype istotypes
ita italian italianate italiani italy
itaconate itaconates itaconic
ital italic italicize italicized italicizes italicizing italics iter iterate iterated iterates iterating iteration iterations iterative iteratively iteratives iterator iterators
italicise italicised
itc itcs
itch itches itchiness itching itchy
ite ites
item itemization itemizations itemize itemized itemizers itemizes itemizing items
CompanyNames/TextSupport.pm view on Meta::CPAN
subimage subimages
subinsurance subinsurers
subinterval subintervals
subinverter subinverters
subirrigated subirrigating subirrigation
subiteration subiterations
subject subjected subjecting subjection subjective subjectively subjectivity subjects
subjugate subjugated subjugating subjugation
sublan sublans
subland sublands
sublanguage sublanguages
CompanyNames/TextSupport.pm view on Meta::CPAN
allied
allies
alligator
alligators
alliteration
alliterations
alliterative
allocatable
allocate
allocated
allocates
CompanyNames/TextSupport.pm view on Meta::CPAN
iterate
iterated
iterates
iterating
iteration
iterations
iterative
iteratively
iterator
iterators
itineraries
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Finance/MICR/GOCR/Check.pm view on Meta::CPAN
}
$self->{crop_sides} ||= 0.15;
return $self->{crop_sides};
}
sub crop_iterations {
my($self,$set) = @_;
if (defined $set){
$self->{crop_iterations} = $set;
$self->{custom_iteration_is_set} =1;
}
$self->{crop_iterations} ||= 12;
return $self->{crop_iterations};
}
sub crop_increment {
my($self,$set) = @_;
if (defined $set){
lib/Finance/MICR/GOCR/Check.pm view on Meta::CPAN
}
$self->{crop_increment} ||= 5;
return $self->{crop_increment};
}
sub scan_iterations_reset {
my $self = shift;
$self->{crop_iterations} = undef;
$self->{custom_iteration_is_set} = undef;
$self->{crop_increment} = undef;
return;
}
# build the increment values and elements
# these are the iterations steps we will try
# stops when we find one that produces valid micr
sub scan_iterations {
my $self = shift;
my @iterations;
if( $self->_custom_iteration_is_set ){
my $i =0;
my $now = 70;
while ( $i != $self->crop_iterations ){
push @iterations, $now;
$now =($now + $self->crop_increment);
$i++;
}
print STDERR "custom iteration is set, steps are [@iterations]\n" if DEBUG;
printf STDERR "step increment is : %s, number of steps: %s\n", $self->crop_increment, $self->crop_iterations if DEBUG;
}
else {
@iterations = qw(70 75 80 85 90 95 100 105 110 115 120 130 140 150 160 170 180 190 200 210 220 230 240 250 300); # aggressive
print STDERR "iterations are default, set to [@iterations]\n" if DEBUG;
}
return \@iterations;
}
sub rescan {
my $self = shift;
$self->{_data}->{_micrdata} = undef;
lib/Finance/MICR/GOCR/Check.pm view on Meta::CPAN
Percentage to crop sides by when iterating, scanning up for MICR line
default is fifteen percent
number should be 0.15 for 15%
=head2 crop_iterations()
argument is number of iterations to do before giving up on searching for micrline scans.. starts from bottom.. does 5 pix increments.
if no argumetn, returns number of iterations set.
If you give 0, it switches to default, which is 12- max is 25
=head2 crop_increment()
argument is pixel increment per iteration
lib/Finance/MICR/GOCR/Check.pm view on Meta::CPAN
If you give 0, it switches to default, which is 5
suggested is min 2, max 8
You must set these values BEFORE you ask for the micr from ocr
=head2 scan_iterations()
returns array ref of what the iterations are set at
dafault are approximately:
70 75 80 85 90 95 100 105 110 115 120 130 140 150 160 170 180 190 200 210 220 230 240 250 300
That means the first image extract is the micr height from 70 pixels from the bottom, then 75, etc.. Until a valid
micr line is found.
=head2 scan_iterations_reset()
will reset crop_sides, crop_increment, crop_iterations to default values.
=head2 found_valid()
will trigger a scan if none was already ran.
lib/Finance/MICR/GOCR/Check.pm view on Meta::CPAN
unless( $c->found_valid ){
$c->s(70); # change the spacing for gocr
$c->d(15); # change the dust size from default of 20 to 15
$c->crop_increment(2); # set more precise iterations, default is 5 or so
$c->crop_iterations(10); # set less iterations to happen
$c->rescan;
if ($c->found_valid){
printf STDERR "worked! found: %s\n", $c->parser->micr_pretty;
lib/Finance/MICR/GOCR/Check.pm view on Meta::CPAN
unless( defined $self->{_data}->{_micrdata} ){
if (DEBUG){
printf STDERR __PACKAGE__ ." _micr defining\n
custom iteration %s
crop iterations %s
crop increment %s
",
$self->_custom_iteration_is_set,
$self->crop_iterations,
$self->crop_increment;
}
my $data = {
lib/Finance/MICR/GOCR/Check.pm view on Meta::CPAN
# it should NOT STOP at first valid.. it should run one more!!! when it gets chopped up it still tries matching!
my $id = time ;# for development purpose.. disregard, names the micrfiles
my $last_one_was_valid =0;
my $stop = 0;
my $iterations = $self->scan_iterations;
for (@$iterations){
if ($last_one_was_valid){ # then do one more just 2px or 4px up
$data->{height} = ($data->{height} + 5);
$stop =1; #force stop
}
lib/Finance/MICR/GOCR/Check.pm view on Meta::CPAN
# if it's not valid try something nuts??
# $last_one_was_valid =0;
# $stop = 0;
my $data2=$data; # copies or .. what?
unless ($data2->{parser}->micr_pretty){
print STDERR "iterations will not match, trying something different\n" if DEBUG;
for (qw(90 95 100 105 110 115)){
# if ($last_one_was_valid){ # then do one more just 2px or 4px up
# $data2->{height} = ($data2->{height} + 5);
lib/Finance/MICR/GOCR/Check.pm view on Meta::CPAN
return $self->_micr->{raw};
}
=head2 abs_micr()
absolute path to micr file what was created.
after the iterations, the one that closest matched is this file.
This is useful to know if you want to build or increment the gocr database.
=head2 gocr_raw()
the raw ocr output for the micrfile that was last made,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Finance/Math/IRR.pm view on Meta::CPAN
#
$ARGS_SECANT{precision} = $precision;
_debug("trying secant method on interval [".$ARGS_SECANT{p0}."-".$ARGS_SECANT{p1}."] with precision ".
$ARGS_SECANT{precision}." and max ".$ARGS_SECANT{max_depth}." iterations");
# try finding the IRR with the secant metho
eval {
$root = $poly->secant(%ARGS_SECANT);
};
lib/Finance/Math/IRR.pm view on Meta::CPAN
$ARGS_BRENT{precision} = $precision;
$ARGS_BRENT{a} = $poly->xneg;
$ARGS_BRENT{b} = $poly->xpos;
_debug("trying Brent's method on interval [".$ARGS_BRENT{a}."-".$ARGS_BRENT{b}."] with precision ".
$ARGS_BRENT{precision}." and max ".$ARGS_BRENT{max_depth}." iterations");
eval {
$root = $poly->brent(%ARGS_BRENT);
};
view all matches for this distribution
view release on metacpan or search on metacpan
}
print "Using Math::FixedPrecision objects (ROR_objects), the ROR is ", ROR_objects(),"\n";
print "Go get a cup of coffee while we time 10000 iterations each of ROR_native and ROR_objects\n";
print "Start: @{[scalar(localtime())]}\n";
cmpthese($count,
{
ROR_native => \&ROR_native,
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
examples/Benchmark.pm view on Meta::CPAN
$t = timeit(10, ' 5 ** $Global ');
Benchmark->debug(0);
=item iters
Returns the number of iterations.
=back
=head2 Standard Exports
examples/Benchmark.pm view on Meta::CPAN
Returns: a Benchmark object.
=item timethis ( COUNT, CODE, [ TITLE, [ STYLE ]] )
Time COUNT iterations of CODE. CODE may be a string to eval or a
code reference; either way the CODE will run in the caller's package.
Results will be printed to STDOUT as TITLE followed by the times.
TITLE defaults to "timethis COUNT" if none is provided. STYLE
determines the format of the output, as described for timestr() below.
examples/Benchmark.pm view on Meta::CPAN
the C<timethese()> result structure. If you want that, just use the two
statement C<timethese>...C<cmpthese> idiom shown above.
Incidentally, note the variance in the result values between the two examples;
this is typical of benchmarking. If this were a real benchmark, you would
probably want to run a lot more iterations.
=item countit(TIME, CODE)
Arguments: TIME is the minimum length of time to run CODE for, and CODE is
the code to run. CODE may be either a code reference or a string to
be eval'd; either way it will be run in the caller's package.
TIME is I<not> negative. countit() will run the loop many times to
calculate the speed of CODE before running it for TIME. The actual
time run for will usually be greater than TIME due to system clock
resolution, so it's best to look at the number of iterations divided
by the times that you are concerned with, not just the iterations.
Returns: a Benchmark object.
=item disablecache ( )
examples/Benchmark.pm view on Meta::CPAN
Real elapsed time "wallclock seconds".
=item iters
Number of iterations run.
=back
The following illustrates use of the Benchmark object:
examples/Benchmark.pm view on Meta::CPAN
my $cache_key = $n . ( ref( $code ) ? 'c' : 's' );
if ($Do_Cache && exists $Cache{$cache_key} ) {
$wn = $Cache{$cache_key};
} else {
$wn = &runloop($n, ref( $code ) ? sub { } : '' );
# Can't let our baseline have any iterations, or they get subtracted
# out of the result.
$wn->[5] = 0;
$Cache{$cache_key} = $wn;
}
examples/Benchmark.pm view on Meta::CPAN
# due to clock granularity and variable CPU speed and load,
# on quick code with a small number of loops, it's possible for
# the empty loop to appear to take longer than the real loop
# (e.g. 1 tick versus 0 ticks). This leads to a negative elapsed
# time. In this case, floor it at zero, to stop bizarre results.
print " (warning: too few iterations for a reliable count)\n";
$t->[$_] = 0 for 1..4;
}
# A conservative warning to spot very silly tests.
# Don't assume that your benchmark is ok simply because
# you don't get this warning!
print " (warning: too few iterations for a reliable count)\n"
if $n < $Min_Count
|| ($t->real < 1 && $n < 1000)
|| $t->cpu_a < $Min_CPU;
$t;
}
examples/Benchmark.pm view on Meta::CPAN
my @names = sort keys %$alt;
$style = "" unless defined $style;
print "Benchmark: " unless $style eq 'none';
if ( $n > 0 ) {
croak "non-integer loopcount $n, stopped" if int($n)<$n;
print "timing $n iterations of" unless $style eq 'none';
} else {
print "running" unless $style eq 'none';
}
print " ", join(', ',@names) unless $style eq 'none';
unless ( $n > 0 ) {
view all matches for this distribution
view release on metacpan or search on metacpan
t/203_prefill.t view on Meta::CPAN
checktest => 'Irish',
name => 'Coffee',
};
# need to create series of tests, several iterations of prefill and then do a plain generate to
# confirm original default/placholder still exist.
my @results1 = (
{ row => 0 , input => q|value="spaghetti"|,
comment => 'prefilled name with value spaghetti is set'},
{ row => 0 , input => q|placeholder="Your Name"|,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Form/Tiny/Form.pm view on Meta::CPAN
foreach my $validator (@{$self->field_defs}) {
my $current_data = Form::Tiny::Utils::_find_field($fields, $validator);
if (defined $current_data) {
my $all_ok = 1;
# This may have multiple iterations only if there's an array
foreach my $path_value (@$current_data) {
next if $path_value->[2];
$path_value->[1] = ($inline_hook->($self, $validator, $path_value->[1]))
if $inline_hook;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Fred/Fish/DBUG/Tutorial.pm view on Meta::CPAN
The interesting part of the B<fish> log:
| <main::some_function - return ([1], [0], [-1])
Notice it was smart enough to return a list of values. And the loop had three
iterations.
********************
while ( some_function ( qw /1 0 -1/ ) ) { ... }
view all matches for this distribution
view release on metacpan or search on metacpan
JS/js/jsdate.c view on Meta::CPAN
/* Use a simple binary search algorithm to find the right
year. This seems like brute force... but the computation
of hi and lo years above lands within one year of the
correct answer for years within a thousand years of
1970; the loop below only requires six iterations
for year 270000. */
while (hi > lo) {
mid = (hi + lo) / 2;
if (TimeFromYear(mid) > t) {
hi = mid - 1;
view all matches for this distribution
view release on metacpan or search on metacpan
t/000_moose_recipes/basics-recipe10.t view on Meta::CPAN
);
}
# Hmm, not sure how to test for random selection of genes since
# I could theoretically run an infinite number of iterations and
# never find proof that a child has inherited a particular gene.
# AUTHOR: Aran Clary Deltac <bluefeet@cpan.org>
# Maybe there is another way to implent this, but for no we have
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Fry/Opt.pm view on Meta::CPAN
A flag type syncs it value with a shell flag. A var type syncs its value with a
variable. A none type gets its value from the attribute value.
action(\&): Given subroutine is called before a command for an active option.
Subroutine is passed the shell object and the options' value set from the
commandline.
stop($): Maintains an option's value for $stop + 1 loop iterations where $stop
is this attribute's value. This gives an active option a timed noreset interval. Used mostly with menu option.
noreset($): If set, the active option can't be reset (except for an overriding flag to &resetOptions).
*default($): Default value that an option starts with and is set to whenever reset. Default value is 0.
=head1 PUBLIC METHODS
view all matches for this distribution
view release on metacpan or search on metacpan
t/040-leak-util-leak.t view on Meta::CPAN
}
# Test for memory leaks
# Run code many times and check memory doesn't grow significantly
sub test_no_leak {
my ($name, $code, $iterations, $threshold_kb) = @_;
$iterations //= 10_000; # Reduced from 100k to avoid SEGV in util
$threshold_kb //= 5_000; # 5MB threshold
# Warmup
$code->() for 1..100;
my $before = get_rss();
$code->() for 1..$iterations;
my $after = get_rss();
my $diff = $after - $before;
my $passed = $diff < $threshold_kb;
view all matches for this distribution