view release on metacpan or search on metacpan
lib/Algorithm/Diff/Apply.pm view on Meta::CPAN
}
return \@hdiff;
}
# Calls the specified optimisation callbacks, returning a list of discrete
# alternative blocks in a format that __apply_alternatives() can handle.
sub __optimise_conflicts
{
my %args = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Diff/Callback.pm view on Meta::CPAN
package Algorithm::Diff::Callback;
# ABSTRACT: Use callbacks on computed differences
$Algorithm::Diff::Callback::VERSION = '0.111';
use strict;
use warnings;
use parent 'Exporter';
lib/Algorithm/Diff/Callback.pm view on Meta::CPAN
=encoding UTF-8
=head1 NAME
Algorithm::Diff::Callback - Use callbacks on computed differences
=head1 VERSION
version 0.111
=head1 SYNOPSIS
Use callbacks in your diff process to get better control over what will happen.
use Algorithm::Diff::Callback 'diff_arrays';
diff_arrays(
\@old_family_members,
lib/Algorithm/Diff/Callback.pm view on Meta::CPAN
just the values that changes (but neglect to mention how each changed) and some
(such as L<Algorithm::Diff>) give you way too much information that you now have
to skim over and write long complex loops for.
L<Algorithm::Diff::Callback> let's you pick what you're going to diff (Arrays or
Hashes) and set callbacks for the diff process.
=head1 EXPORT
You'll need to declare to explicitly export these functions.
lib/Algorithm/Diff/Callback.pm view on Meta::CPAN
use Algorithm::Diff::Callback qw<diff_arrays diff_hashes>;
=head1 SUBROUTINES/METHODS
=head2 diff_arrays(\@old, \@new, %callbacks)
The first two parameters are array references to compare.
The rest of the parameters are keys for the type of callback you want and the
corresponding callback. You can provide multiple callbacks. Supported keys are:
=over 4
=item * added
lib/Algorithm/Diff/Callback.pm view on Meta::CPAN
}
);
=back
=head2 diff_hashes(\%old, \%new, %callbacks)
The first two parameters are hash references to compare.
The rest of the parameters are keys for the type of callback you want and the
corresponding callback. You can provide multiple callbacks. Supported keys are:
=over 4
=item * added
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Diff.pm view on Meta::CPAN
sub traverse_sequences
{
my $a = shift; # array ref
my $b = shift; # array ref
my $callbacks = shift || {};
my $keyGen = shift;
my $matchCallback = $callbacks->{'MATCH'} || sub { };
my $discardACallback = $callbacks->{'DISCARD_A'} || sub { };
my $finishedACallback = $callbacks->{'A_FINISHED'};
my $discardBCallback = $callbacks->{'DISCARD_B'} || sub { };
my $finishedBCallback = $callbacks->{'B_FINISHED'};
my $matchVector = _longestCommonSubsequence( $a, $b, 0, $keyGen, @_ );
# Process all the lines in @$matchVector
my $lastA = $#$a;
my $lastB = $#$b;
lib/Algorithm/Diff.pm view on Meta::CPAN
sub traverse_balanced
{
my $a = shift; # array ref
my $b = shift; # array ref
my $callbacks = shift || {};
my $keyGen = shift;
my $matchCallback = $callbacks->{'MATCH'} || sub { };
my $discardACallback = $callbacks->{'DISCARD_A'} || sub { };
my $discardBCallback = $callbacks->{'DISCARD_B'} || sub { };
my $changeCallback = $callbacks->{'CHANGE'};
my $matchVector = _longestCommonSubsequence( $a, $b, 0, $keyGen, @_ );
# Process all the lines in match vector
my $lastA = $#$a;
my $lastB = $#$b;
lib/Algorithm/Diff.pm view on Meta::CPAN
is a CODE reference to a key generation function. See L</KEY GENERATION
FUNCTIONS>.
Additional parameters, if any, will be passed to the key generation function.
If you want to pass additional parameters to your callbacks, but don't
need a custom key generation function, you can get the default by
passing undef:
traverse_sequences(
\@seq1, \@seq2,
lib/Algorithm/Diff.pm view on Meta::CPAN
computed LCS. Instead of sticking to one side and showing element changes
as insertions and deletions only, it will jump back and forth between
the two sequences and report I<changes> occurring as deletions on one
side followed immediately by an insertion on the other side.
In addition to the C<DISCARD_A>, C<DISCARD_B>, and C<MATCH> callbacks
supported by C<traverse_sequences>, C<traverse_balanced> supports
a C<CHANGE> callback indicating that one element got C<replaced> by another:
traverse_balanced(
\@seq1, \@seq2,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Gutter.pm view on Meta::CPAN
The cells are held in an array reference (the B<gutter>); the caller may
need to fiddle around with the cells directly simulate various effects.
Various methods may throw errors, for example if a cell lacks an update
callback function. Such callbacks are not mandatory to give the caller
flexibility in wiring up the gutter in fancy ways.
=head1 FIELDS
=over 4
view all matches for this distribution
view release on metacpan or search on metacpan
sub traverse_sequences3 {
my $adoc = shift; # array ref
my $bdoc = shift; # array ref
my $cdoc = shift; # array ref
my $callbacks = shift || {};
my $keyGen = shift;
my $a_diff = $callbacks->{'A_DIFF'} || sub { };
my $b_diff = $callbacks->{'B_DIFF'} || sub { };
my $c_diff = $callbacks->{'C_DIFF'} || sub { };
my $no_change = $callbacks->{'NO_CHANGE'} || sub { };
my $conflict = $callbacks->{'CONFLICT'} || sub { };
my $b_len = scalar(@{$bdoc});
my $c_len = scalar(@{$cdoc});
my $target_len = $b_len < $c_len ? $b_len : $c_len;
my $bc_different_lengths = $b_len != $c_len;
# make these into traverse_sequences calls
my($left, $right);
my %diffs;
my $ts_callbacks = {
DISCARD_A => sub { # discard left
push @{$diffs{$left}}, $_[0];
},
DISCARD_B => sub { # discard right
push @{$diffs{$right}}, $_[1];
},
};
@diffs{(AB_A, AB_B)} = ([], []);
$left = AB_A; $right = AB_B;
Algorithm::Diff::traverse_sequences( $adoc, $bdoc, $ts_callbacks, $keyGen, @_);
@diffs{(AC_A, AC_C)} = ([], []);
$left = AC_A; $right = AC_C;
Algorithm::Diff::traverse_sequences( $adoc, $cdoc, $ts_callbacks, $keyGen, @_);
if($bc_different_lengths) {
@diffs{(CB_C, CB_B)} = ([], []);
$left = CB_C; $right = CB_B;
Algorithm::Diff::traverse_sequences( $cdoc, $bdoc, $ts_callbacks, $keyGen, @_);
@diffs{(BC_B, BC_C)} = ([], []);
$left = BC_B; $right = BC_C;
Algorithm::Diff::traverse_sequences( $bdoc, $cdoc, $ts_callbacks, $keyGen, @_);
if(join(",", @{$diffs{&CB_B}}) ne join(",", @{$diffs{&BC_B}}) ||
join(",", @{$diffs{&CB_C}}) ne join(",", @{$diffs{&BC_C}}))
{
@bdoc_save = splice @{$bdoc}, $target_len;
carp "Algorithm::Diff::diff is not symmetric for second and third sequences - results might not be correct";
}
@diffs{(BC_B, BC_C)} = ([], []);
$left = BC_B; $right = BC_C;
Algorithm::Diff::traverse_sequences( $bdoc, $cdoc, $ts_callbacks, $keyGen, @_);
if(scalar(@bdoc_save) || scalar(@cdoc_save)) {
push @{$diffs{&BC_B}}, ($target_len .. $b_len) if $target_len < $b_len;
push @{$diffs{&BC_C}}, ($target_len .. $c_len) if $target_len < $c_len;
}
}
else {
@diffs{(BC_B, BC_C)} = ([], []);
$left = BC_B; $right = BC_C;
Algorithm::Diff::traverse_sequences( $bdoc, $cdoc, $ts_callbacks, $keyGen, @_);
}
my @pos;
@pos[A, B, C] = (0, 0, 0);
sub merge {
my $pivot = shift; # array ref
my $doca = shift; # array ref
my $docb = shift; # array ref
my $callbacks = shift || {};
my $keyGen = shift;
my $conflictCallback = $callbacks -> {'CONFLICT'} || sub ($$) { (
q{<!-- ------ START CONFLICT ------ -->},
(@{$_[0]}),
q{<!-- ---------------------------- -->},
(@{$_[1]}),
q{<!-- ------ END CONFLICT ------ -->},
$diff = diff3(\@ancestor, \@a, \@b);
$diff = diff3(\@ancestor, \@a, \@b, $key_generation_function);
@trav = traverse_sequences3(\@ancestor, \@a, \@b, {
# callbacks
});
@trav = traverse_sequences3(\@ancestor, \@a, \@b, {
# callbacks
}, $key_generation_function);
$trav = traverse_sequences3(\@ancestor, \@a, \@b, {
# callbacks
});
$trav = traverse_sequences3(\@ancestor, \@a, \@b, {
# callbacks
}, $key_generation_function);
=head1 USAGE
=head2 traverse_sequences3
This is the workhorse function that goes through the three sequences
and calls the callback functions.
The following callbacks are supported.
=over 4
=item NO_CHANGE
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/NeedlemanWunsch.pm view on Meta::CPAN
}
return $cb;
}
sub _canonicalize_callbacks {
my $cb;
if (@_) {
$cb = $_[0];
} else {
$cb = { };
lib/Algorithm/NeedlemanWunsch.pm view on Meta::CPAN
my $self = shift;
my $a = shift;
my $b = shift;
$self->{callbacks} = _canonicalize_callbacks(@_);
if (!exists($self->{gap_open_penalty})) {
if (exists($self->{gap_extend_penalty})) {
croak "gap_open_penalty must be defined together with gap_extend_penalty";
}
lib/Algorithm/NeedlemanWunsch.pm view on Meta::CPAN
my $cur = [ $i, $j ];
my $move;
if (@alt == 1) {
$move = $self->_simple_trace_back($cur, $alt[0],
$self->{callbacks});
} else {
$move = $self->_trace_back($cur, \@alt);
}
if ($move eq 'align') {
lib/Algorithm/NeedlemanWunsch.pm view on Meta::CPAN
my $cur = [ $i, $j ];
my $move;
if (@alt == 1) {
$move = $self->_simple_trace_back($cur, $alt[0],
$self->{callbacks});
} else {
$move = $self->_trace_back($cur, \@alt);
}
if ($move eq 'align') {
lib/Algorithm/NeedlemanWunsch.pm view on Meta::CPAN
die "internal error";
}
}
my $move;
my $cb = $self->{callbacks};
if (exists($cb->{select_align})) {
$move = &{$cb->{select_align}}($arg);
if (!exists($arg->{$move})) {
die "select_align callback returned invalid selection $move.";
}
lib/Algorithm/NeedlemanWunsch.pm view on Meta::CPAN
called with 2 arguments, which are items from the first and second
sequence, respectively, passed to
C<Algorithm::NeedlemanWunsch::align>. Note that the sub must be pure,
i.e. always return the same value when called with the same arguments.
=head3 align(\@a, \@b [, \%callbacks ])
The core of the algorithm. Creates a bottom-up dynamic programming
matrix, fills it with alignment scores and then traces back to find an
optimal alignment, informing the application about its items by
invoking the callbacks passed to the method.
The first 2 arguments of C<align> are array references to the aligned
sequences, the third a hash reference with user-supplied
callbacks. The callbacks are identified by the hash keys, which are as
follows:
=over
=item align
lib/Algorithm/NeedlemanWunsch.pm view on Meta::CPAN
callback must select one of the possibilities by returning one of the
keys.
=back
All callbacks are optional. When there is just one way to make the
optimal alignment, the C<Algorithm::NeedlemanWunsch> object prefers
calling the specific callbacks, but will call C<select_align> if it's
defined and the specific callback isn't.
Note that C<select_align> is called I<instead> of the specific
callbacks, not in addition to them - users defining both
C<select_align> and other callbacks should probably call the specific
callback explicitly from their C<select_align>, once it decides which
one to prefer.
Also note that the passed positions move backwards, from the sequence
ends to zero - if you're building the alignment in your callbacks, add
items to the front.
=head2 Extensions
In addition to the standard Needleman-Wunsch algorithm, this module
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/TokenBucket.pm view on Meta::CPAN
=item state()
Returns the state of the bucket as a list. Use it for storing purposes.
Buckets also natively support freezing and thawing with L<Storable> by
providing C<STORABLE_*> callbacks.
=cut
sub state {
my Algorithm::TokenBucket $self = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Alice/Test/MockIRC.pm view on Meta::CPAN
$self->cbs->{disconnect}->();
}
sub enable_ping {}
sub reg_cb {
my ($self, %callbacks) = @_;
for (keys %callbacks) {
$self->cbs->{$_} = $callbacks{$_};
}
}
sub is_channel_name {
my ($self, $name) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
xt/author/pod_spelling_system.t view on Meta::CPAN
TODO
filename
filenames
login
callback
callbacks
standalone
VMS
hostname
hostnames
TCP
view all matches for this distribution
view release on metacpan or search on metacpan
xt/author/pod_spelling_system.t view on Meta::CPAN
TODO
filename
filenames
login
callback
callbacks
standalone
VMS
hostname
hostnames
TCP
view all matches for this distribution
view release on metacpan or search on metacpan
xt/author/pod_spelling_system.t view on Meta::CPAN
TODO
filename
filenames
login
callback
callbacks
standalone
VMS
hostname
hostnames
TCP
view all matches for this distribution
view release on metacpan or search on metacpan
xt/author/pod_spelling_system.t view on Meta::CPAN
TODO
filename
filenames
login
callback
callbacks
standalone
VMS
hostname
hostnames
TCP
view all matches for this distribution
view release on metacpan or search on metacpan
xt/author/pod_spelling_system.t view on Meta::CPAN
TODO
filename
filenames
login
callback
callbacks
standalone
VMS
hostname
hostnames
TCP
view all matches for this distribution
view release on metacpan or search on metacpan
xt/author/pod_spelling_system.t view on Meta::CPAN
TODO
filename
filenames
login
callback
callbacks
standalone
VMS
hostname
hostnames
TCP
view all matches for this distribution
view release on metacpan or search on metacpan
xt/author/pod_spelling_system.t view on Meta::CPAN
TODO
filename
filenames
login
callback
callbacks
standalone
VMS
hostname
hostnames
TCP
view all matches for this distribution
view release on metacpan or search on metacpan
xt/author/pod_spelling_system.t view on Meta::CPAN
TODO
filename
filenames
login
callback
callbacks
standalone
VMS
hostname
hostnames
TCP
view all matches for this distribution
view release on metacpan or search on metacpan
xt/author/pod_spelling_system.t view on Meta::CPAN
TODO
filename
filenames
login
callback
callbacks
standalone
VMS
hostname
hostnames
TCP
view all matches for this distribution
view release on metacpan or search on metacpan
xt/author/pod_spelling_system.t view on Meta::CPAN
TODO
filename
filenames
login
callback
callbacks
standalone
VMS
hostname
hostnames
TCP
view all matches for this distribution
view release on metacpan or search on metacpan
xt/author/pod_spelling_system.t view on Meta::CPAN
TODO
filename
filenames
login
callback
callbacks
standalone
VMS
hostname
hostnames
TCP
view all matches for this distribution
view release on metacpan or search on metacpan
xt/author/pod_spelling_system.t view on Meta::CPAN
TODO
filename
filenames
login
callback
callbacks
standalone
VMS
hostname
hostnames
TCP
view all matches for this distribution
view release on metacpan or search on metacpan
xt/author/pod_spelling_system.t view on Meta::CPAN
TODO
filename
filenames
login
callback
callbacks
standalone
VMS
hostname
hostnames
TCP
view all matches for this distribution
view release on metacpan or search on metacpan
xt/author/pod_spelling_system.t view on Meta::CPAN
TODO
filename
filenames
login
callback
callbacks
standalone
VMS
hostname
hostnames
TCP
view all matches for this distribution
view release on metacpan or search on metacpan
xt/author/pod_spelling_system.t view on Meta::CPAN
TODO
filename
filenames
login
callback
callbacks
standalone
VMS
hostname
hostnames
TCP
view all matches for this distribution
view release on metacpan or search on metacpan
xt/author/pod_spelling_system.t view on Meta::CPAN
TODO
filename
filenames
login
callback
callbacks
standalone
VMS
hostname
hostnames
TCP
view all matches for this distribution
view release on metacpan or search on metacpan
xt/author/pod_spelling_system.t view on Meta::CPAN
TODO
filename
filenames
login
callback
callbacks
standalone
VMS
hostname
hostnames
TCP
view all matches for this distribution
view release on metacpan or search on metacpan
xt/author/pod_spelling_system.t view on Meta::CPAN
TODO
filename
filenames
login
callback
callbacks
standalone
VMS
hostname
hostnames
TCP
view all matches for this distribution
view release on metacpan or search on metacpan
xt/author/pod_spelling_system.t view on Meta::CPAN
TODO
filename
filenames
login
callback
callbacks
standalone
VMS
hostname
hostnames
TCP
view all matches for this distribution
view release on metacpan or search on metacpan
xt/author/pod_spelling_system.t view on Meta::CPAN
TODO
filename
filenames
login
callback
callbacks
standalone
VMS
hostname
hostnames
TCP
view all matches for this distribution
view release on metacpan or search on metacpan
corpus/vcpkg/r2/installed/vcpkg/info/openssl-windows_1.1.1d-1_x64-windows.list view on Meta::CPAN
x64-windows/debug/html/man3/RAND_DRBG_instantiate.html
x64-windows/debug/html/man3/RAND_DRBG_new.html
x64-windows/debug/html/man3/RAND_DRBG_reseed.html
x64-windows/debug/html/man3/RAND_DRBG_secure_new.html
x64-windows/debug/html/man3/RAND_DRBG_set.html
x64-windows/debug/html/man3/RAND_DRBG_set_callbacks.html
x64-windows/debug/html/man3/RAND_DRBG_set_defaults.html
x64-windows/debug/html/man3/RAND_DRBG_set_ex_data.html
x64-windows/debug/html/man3/RAND_DRBG_set_reseed_defaults.html
x64-windows/debug/html/man3/RAND_DRBG_set_reseed_interval.html
x64-windows/debug/html/man3/RAND_DRBG_set_reseed_time_interval.html
corpus/vcpkg/r2/installed/vcpkg/info/openssl-windows_1.1.1d-1_x64-windows.list view on Meta::CPAN
x64-windows/html/man3/RAND_DRBG_instantiate.html
x64-windows/html/man3/RAND_DRBG_new.html
x64-windows/html/man3/RAND_DRBG_reseed.html
x64-windows/html/man3/RAND_DRBG_secure_new.html
x64-windows/html/man3/RAND_DRBG_set.html
x64-windows/html/man3/RAND_DRBG_set_callbacks.html
x64-windows/html/man3/RAND_DRBG_set_defaults.html
x64-windows/html/man3/RAND_DRBG_set_ex_data.html
x64-windows/html/man3/RAND_DRBG_set_reseed_defaults.html
x64-windows/html/man3/RAND_DRBG_set_reseed_interval.html
x64-windows/html/man3/RAND_DRBG_set_reseed_time_interval.html
view all matches for this distribution
view release on metacpan or search on metacpan
xt/author/pod_spelling_system.t view on Meta::CPAN
TODO
filename
filenames
login
callback
callbacks
standalone
VMS
hostname
hostnames
TCP
view all matches for this distribution