view release on metacpan or search on metacpan
t/test.data view on Meta::CPAN
power NN B
, , O
but CC O
a DT B
single JJ I
error NN I
on IN O
his PRP$ B
part NN I
could MD O
cost VB O
t/test.data view on Meta::CPAN
hands NNS I
can MD O
become VB O
vehicles NNS B
of IN O
terror NN B
. . O
An DT B
adept JJ I
bicyclist NN I
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/CheckDigits.pm view on Meta::CPAN
=head2 CheckDigits($method)
Returns an object of an appropriate Algorithm::CheckDigits class for the
given algorithm.
Dies with an error message if called with an unknown algorithm.
See below for the available algorithms. Every object understands the following
methods:
=over 4
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Classifier/IsolationForest.pm view on Meta::CPAN
my $flags = $forest->predict($packed, 0.6);
my ($s, $l) = $forest->score_predict_split($packed);
The wrapper has C<n_pts> and C<n_feats> accessors for introspection.
The feature count is matched against the model on every call; passing a
packed dataset built for a different feature count is a fatal error.
=cut
=head2 path_lengths(\@data)
lib/Algorithm/Classifier/IsolationForest.pm view on Meta::CPAN
Validates a hashref of named feature values against the model's stored
C<feature_names> and returns a positional arrayref ready to pass to any
of the scoring or prediction methods.
C<$caller> is a string used in error messages to identify which method
triggered the validation (pass the calling method's name).
my $vec = $forest->tagged_row_to_array(\%row, 'my_method');
# returns e.g. [0.9, 0.4, 0.1] ordered by feature_names
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Classifier/NaiveBayes/App/Command/classify.pm view on Meta::CPAN
sub validate {
my ( $self, $opt, $args ) = @_;
if ( !-f $opt->{'m'} ) {
$self->usage_error( '-m, "' . $opt->{'m'} . '", is not a file or does not exist' );
}
return 1;
}
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/AutoInstall.pm view on Meta::CPAN
return
unless system( 'sudo', $^X, $0, "--config=$config",
"--installdeps=$missing" );
print << ".";
*** The 'sudo' command exited with error! Resuming...
.
}
return _prompt(
qq(
view all matches for this distribution
view release on metacpan or search on metacpan
perl/Cluster.pm view on Meta::CPAN
#------------------------------------------------------
# This function is called by the wrappers for library functions.
# It checks the dimensions of the data, mask and weight parameters.
#
# Return false if any errors are found in the data matrix.
#
# Detect the dimension (nrows x ncols) of the data matrix,
# and set values in the parameter hash.
#
# Also check the mask matrix and weight arrays, and set
# the parameters to default values if we find any errors,
# however, we still return true if we find errors.
#
sub check_matrix_dimensions {
my ($param, $default) = @_;
#----------------------------------
# Check the data matrix
perl/Cluster.pm view on Meta::CPAN
if ($counter[$i]==0) {
module_warn("Optional parameter 'initialid' contains empty clusters");
return;
}
}
# No errors detected
$param->{npass} = 0;
return 1;
}
#-------------------------------------------------------------
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/ClusterPoints.pm view on Meta::CPAN
sub _make_clusters_ix_2 {
my $self = shift;
$self->{dimension} == 2
or croak 'internal error: _make_clusters_ix_2 called but dimension is not 2';
my ($ax, $ay) = $self->_scaled_coords;
@$ax or croak "points have not been added";
my $xmin = min @$ax;
view all matches for this distribution
view release on metacpan or search on metacpan
Combinatorics.pm view on Meta::CPAN
=back
=head2 Errors
The following errors may be thrown:
=over
=item Missing parameter data
view all matches for this distribution
view release on metacpan or search on metacpan
/* fprintf(stderr, "nkeys => %u, replicas => %u\n", nkeys, replicas); */
RETVAL = chash_create(keys, lens, nkeys, replicas);
if (RETVAL == NULL)
croak("Unknown error");
OUTPUT: RETVAL
void
DESTROY(self)
view all matches for this distribution
view release on metacpan or search on metacpan
--diff=program use diff program and options
--compat-version=version provide compatibility with Perl version
--cplusplus accept C++ comments
--quiet don't output anything except fatal errors
--nodiag don't show diagnostics
--nohints don't show hints
--nochanges don't suggest changes
--nofilter don't filter input files
Using this option instructs F<ppport.h> to leave C++
comments untouched.
=head2 --quiet
Be quiet. Don't print anything except fatal errors.
=head2 --nodiag
Don't output any diagnostic messages. Only portability
alerts will be printed.
PL_defgv|5.004050||p
PL_diehook|5.004050||p
PL_dirty|5.004050||p
PL_dowarn|||pn
PL_errgv|5.004050||p
PL_error_count|5.019002||p
PL_expect|5.019002||p
PL_hexdigit|5.005000||p
PL_hints|5.005000||p
PL_in_my_stash|5.019002||p
PL_in_my|5.019002||p
PadnamelistMAX||5.019003|
PerlIO_clearerr||5.007003|
PerlIO_close||5.007003|
PerlIO_context_layers||5.009004|
PerlIO_eof||5.007003|
PerlIO_error||5.007003|
PerlIO_fileno||5.007003|
PerlIO_fill||5.007003|
PerlIO_flush||5.007003|
PerlIO_get_base||5.007003|
PerlIO_get_bufsiz||5.007003|
put_latin1_charclass_innards|||
pv_display|5.006000||p
pv_escape|5.009004||p
pv_pretty|5.009004||p
pv_uni_display||5.007003|
qerror|||
qsortsvu|||
re_compile||5.009005|
re_croak2|||
re_dup_guts|||
re_intuit_start||5.019001|
whichsig_pvn||5.015004|
whichsig_pv||5.015004|
whichsig_sv||5.015004|
whichsig|||
win32_croak_not_implemented|||n
with_queued_errors|||
wrap_op_checker||5.015008|
write_to_stderr|||
xmldump_all_perl|||
xmldump_all|||
xmldump_attr|||
xmldump_sub_perl|||
xmldump_sub|||
xmldump_vindent|||
xs_apiversion_bootcheck|||
xs_version_bootcheck|||
yyerror_pvn|||
yyerror_pv|||
yyerror|||
yylex|||
yyparse|||
yyunlex|||
yywarn|||
);
if ($file{changes}) {
if (exists $opt{copy}) {
my $newfile = "$filename$opt{copy}";
if (-e $newfile) {
error("'$newfile' already exists, refusing to write copy of '$filename'");
}
else {
local *F;
if (open F, ">$newfile") {
info("Writing copy of '$filename' with changes to '$newfile'");
print F $c;
close F;
}
else {
error("Cannot open '$newfile' for writing: $!");
}
}
}
elsif (exists $opt{patch} || $opt{changes}) {
if (exists $opt{patch}) {
unless ($patch_opened) {
if (open PATCH, ">$opt{patch}") {
$patch_opened = 1;
}
else {
error("Cannot open '$opt{patch}' for writing: $!");
delete $opt{patch};
$opt{changes} = 1;
goto fallback;
}
}
if (!defined $diff) {
$diff = run_diff('diff', $file, $str);
}
if (!defined $diff) {
error("Cannot generate a diff. Please install Text::Diff or use --copy.");
return;
}
print F $diff;
}
}
unlink $tmp;
}
else {
error("Cannot open '$tmp' for writing: $!");
}
return undef;
}
{
$opt{quiet} and return;
print "*** ", @_, "\n";
}
sub error
{
print "*** ERROR: ", @_, "\n";
}
my %given_hints;
/* It is very unlikely that anyone will try to use this with Perl 6
(or greater), but who knows.
*/
#if PERL_REVISION != 5
# error ppport.h only works with Perl version 5
#endif /* PERL_REVISION != 5 */
#ifndef dTHR
# define dTHR dNOOP
#endif
#ifndef dTHX
# define PL_defgv defgv
# define PL_diehook diehook
# define PL_dirty dirty
# define PL_dowarn dowarn
# define PL_errgv errgv
# define PL_error_count error_count
# define PL_expect expect
# define PL_hexdigit hexdigit
# define PL_hints hints
# define PL_in_my in_my
# define PL_laststatval laststatval
# define PL_lex_state D_PPP_my_PL_parser_var(lex_state)
# define PL_lex_stuff D_PPP_my_PL_parser_var(lex_stuff)
# define PL_tokenbuf D_PPP_my_PL_parser_var(tokenbuf)
# define PL_in_my D_PPP_my_PL_parser_var(in_my)
# define PL_in_my_stash D_PPP_my_PL_parser_var(in_my_stash)
# define PL_error_count D_PPP_my_PL_parser_var(error_count)
#else
/* ensure that PL_parser != NULL and cannot be dereferenced */
/* Replace perl_eval_pv with eval_pv */
#ifndef eval_pv
#if defined(NEED_eval_pv)
static SV* DPPP_(my_eval_pv)(char *p, I32 croak_on_error);
static
#else
extern SV* DPPP_(my_eval_pv)(char *p, I32 croak_on_error);
#endif
#ifdef eval_pv
# undef eval_pv
#endif
#define Perl_eval_pv DPPP_(my_eval_pv)
#if defined(NEED_eval_pv) || defined(NEED_eval_pv_GLOBAL)
SV*
DPPP_(my_eval_pv)(char *p, I32 croak_on_error)
{
dSP;
SV* sv = newSVpv(p, 0);
PUSHMARK(sp);
SPAGAIN;
sv = POPs;
PUTBACK;
if (croak_on_error && SvTRUE(GvSV(errgv)))
croak(SvPVx(GvSV(errgv), na));
return sv;
}
# define UVuf "u"
# define UVof "o"
# define UVxf "x"
# define UVXf "X"
# else
# error "cannot define IV/UV formats"
# endif
#endif
#ifndef NVef
# if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && \
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
# Whether or not inc::Module::Install is actually loaded, the
# $INC{inc/Module/Install.pm} is what will still get set as long as
# the caller loaded module this in the documented manner.
# If not set, the caller may NOT have loaded the bundled version, and thus
# they may not have a MI version that works with the Makefile.PL. This would
# result in false errors or unexpected behaviour. And we don't want that.
my $file = join( '/', 'inc', split /::/, __PACKAGE__ ) . '.pm';
unless ( $INC{$file} ) { die <<"END_DIE" }
Please invoke ${\__PACKAGE__} with:
inc/Module/Install.pm view on Meta::CPAN
# If the modification time is only slightly in the future,
# sleep briefly to remove the problem.
my $a = $s - time;
if ( $a > 0 and $a < 5 ) { sleep 5 }
# Too far in the future, throw an error.
my $t = time;
if ( $s > $t ) { die <<"END_DIE" }
Your installer $0 has a modification time in the future ($s > $t).
inc/Module/Install.pm view on Meta::CPAN
# I'm still wondering if we should slurp Makefile.PL to
# get some context or not ...
my ($package, $file, $line) = caller;
die <<"EOT";
Unknown function is found at $file line $line.
Execution of $file aborted due to runtime errors.
If you're a contributor to a project, you may need to install
some Module::Install extensions from CPAN (or other repository).
If you're a user of a module, please contact the author.
EOT
view all matches for this distribution
view release on metacpan or search on metacpan
ConstructDFA.xs view on Meta::CPAN
#include "XSUB.h"
}
using namespace std;
// TODO: more error handling when Perl API functions fail
// TODO: use a vector for lookup tables like `successors`
// TODO: exploit that a list rather than a sub can be used
// to identify accepting configurations, the call_sv
// and the associated array copying is a bottleneck
ConstructDFA.xs view on Meta::CPAN
return s2id[v];
}
const vector<State>& id_to_states(StatesId id) {
if (id >= id2s.size()) {
warn("Programmer error looking up %u", id);
}
return id2s[id];
}
};
ConstructDFA.xs view on Meta::CPAN
SV** label_svp = av_fetch(current_av, 1, 0);
SV** null_svp = av_fetch(current_av, 2, 0);
SV** start_svp = av_fetch(current_av, 3, 0);
if (!(vertex_svp && label_svp && null_svp && start_svp))
croak("Internal error");
nullable[SvUV(*vertex_svp)] = SvTRUE(*null_svp);
if (SvOK(*label_svp))
label[SvUV(*vertex_svp)] = SvUV(*label_svp);
ConstructDFA.xs view on Meta::CPAN
for (int k = 4; k <= current_av_len; ++k) {
SV** successor_svp = av_fetch(current_av, k, 0);
if (!successor_svp)
croak("Internal error");
successors[SvUV(*vertex_svp)].push_back(SvUV(*successor_svp));
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/CouponCode.pm view on Meta::CPAN
=item *
The checkdigit algorithm takes into account the position of the part being
keyed. So for example '1K7Q' might be valid in the first part but not in the
second so if a user typed the parts in the wrong boxes then their error could
be highlighted.
=item *
The code generation algorithm avoids 'undesirable' codes. For example any code
lib/Algorithm/CouponCode.pm view on Meta::CPAN
=back
The Algorithm-CouponCode distribution includes a Javascript implementation of
the validator function, in the form of a jQuery plugin. You can include this
in your web application to do client-side validation and highlighting of
errors.
I<Note> the cc_validate function and the Javascript plugin only validate that
the code is 'well-formed' (i.e.: each part has a valid checkdigit). Checking
whether the code is in fact 'valid' is left up to your application and would
typically involve looking for the code in a database. If you use the
Javascript plugin, you might choose to tweak the CSS to keep the red
highlighting of checksum errors but remove the green highlighting which might
imply the code was correct.
=head2 Randomness and Uniqueness
The code returned by C<cc_generate()> is random, but not necessarily unique.
lib/Algorithm/CouponCode.pm view on Meta::CPAN
=back
=head2 cc_validate( options )
Takes a code, cleans it up and validates the checkdigits. Returns the
normalised (and untainted) version of the code on success or undef on error.
The following named parameters may be supplied:
=over 4
=item code
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/CurveFit/Simple.pm view on Meta::CPAN
return $y;
}
=item C<fit(bounds_check =E<gt> 1)>
When set, the implementation will include logic for checking whether the input is out-of-bounds, per the highest and lowest x points in the data used to fit the formula. For implementation languages which support exceptions, an exception will be thr...
For instance, if the highest x in C<$xydata> is 83.0 and the lowest x is 60.0:
my($max_dev, $avg_dev, $src) = fit(xydata => \@xy, bounds_check => 1);
view all matches for this distribution
view release on metacpan or search on metacpan
- POD coverage tests.
- Better META.yml
- etc.
1.01 Tue Sep 13 21:58 2005
- Added additional parameter checks and more helpful error messages.
- Now also accepts Math::Symbolic trees as formulas.
1.00 Mon Apr 25 16:25 2005
- original version as uploaded to CPAN
view all matches for this distribution
view release on metacpan or search on metacpan
t/01-clustering.t view on Meta::CPAN
my $nb_ok = 0;
foreach my $p (@points) {
$nb_ok++ if ($clusters{$cluster_id}->{$p})
}
die "error: [$nb_ok] != [".scalar(keys %{$clusters{$cluster_id}})."]" unless ($nb_ok == scalar(keys %{$clusters{$cluster_id}}));
}
}
die "error: point [$points[0]] not found in any cluster" unless($cluster_found);
}
say "RESULT OK";
return 1;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Damm.pm view on Meta::CPAN
=pod
=head1 NAME
Algorithm::Damm - Calculate the Damm error correction check digit.
=head1 SYNOPSIS
use Algorithm::Damm qw/check_digit is_valid/;
lib/Algorithm/Damm.pm view on Meta::CPAN
Slightly different approach to generating check digits.
=item Wikipedia
L<http://en.wikipedia.org/wiki/Damm_algorithm> - Article explaining
the Damm error correction algorithm.
=back
=head1 REPOSITORY
view all matches for this distribution
view release on metacpan or search on metacpan
ExamplesRandomizedTrees/classify_database_records.pl view on Meta::CPAN
###
### --- It shows for each test sample the class label as calculated by
### RandomizedTreesForBigData and the class label as present in the training
### database.
###
### --- It presents the overall classification error.
###
### --- It presents the confusion matrix that is obtaining by aggregating the
### calculated-class-labels versus the true-class-labels
ExamplesRandomizedTrees/classify_database_records.pl view on Meta::CPAN
$original_classifications{$record_index} = $record_ids_with_class_labels{$record_index};
$classification =~ /=(.+)$/;
$calculated_classifications{$record_index} = $1;
}
my $total_errors = 0;
my @confusion_matrix_row1 = (0,0);
my @confusion_matrix_row2 = (0,0);
print "\n\nCalculating the error rate and the confusion matrix:\n";
foreach my $record_index (sort keys %calculated_classifications) {
$total_errors += 1 if $original_classifications{$record_index} ne $calculated_classifications{$record_index};
if ($original_classifications{$record_index} eq $class_names_used_in_database[1]) {
if ($calculated_classifications{$record_index} eq $class_names_used_in_database[1]) {
$confusion_matrix_row1[0] += 1;
} else {
$confusion_matrix_row1[1] += 1;
ExamplesRandomizedTrees/classify_database_records.pl view on Meta::CPAN
$confusion_matrix_row2[1] += 1;
}
}
}
my $percentage_errors = ($total_errors * 100.0) / scalar keys %calculated_classifications;
print "\n\nClassification error rate: $percentage_errors\n";
print "\nConfusion Matrix:\n\n";
printf("%50s %25s\n", "classified as NOT at risk", "classified as at risk");
printf("Known to be NOT at risk: %10d %35d\n\n", @confusion_matrix_row1); #(G)
printf("Known to be at risk:%15d %35d\n\n", @confusion_matrix_row2); #(H)
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
# Whether or not inc::Module::Install is actually loaded, the
# $INC{inc/Module/Install.pm} is what will still get set as long as
# the caller loaded module this in the documented manner.
# If not set, the caller may NOT have loaded the bundled version, and thus
# they may not have a MI version that works with the Makefile.PL. This would
# result in false errors or unexpected behaviour. And we don't want that.
my $file = join( '/', 'inc', split /::/, __PACKAGE__ ) . '.pm';
unless ( $INC{$file} ) { die <<"END_DIE" }
Please invoke ${\__PACKAGE__} with:
inc/Module/Install.pm view on Meta::CPAN
# If the modification time is only slightly in the future,
# sleep briefly to remove the problem.
my $a = $s - time;
if ( $a > 0 and $a < 5 ) { sleep 5 }
# Too far in the future, throw an error.
my $t = time;
if ( $s > $t ) { die <<"END_DIE" }
Your installer $0 has a modification time in the future ($s > $t).
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Dependency/Objects/Ordered.pm view on Meta::CPAN
sub _order {
my ( $self, @queue ) = @_;
my $selected = Set::Object->new( $self->selected->members );
my $error_marker;
my @schedule;
my %dep_set;
while (@queue){
my $obj = shift @queue;
if ( defined($error_marker) and refaddr($error_marker) == refaddr($obj) ) {
$self->circular_dep($obj, @queue);
}
my $dep_set = $dep_set{refaddr $obj} ||= Set::Object->new( $self->get_deps($obj) );
lib/Algorithm/Dependency/Objects/Ordered.pm view on Meta::CPAN
# put the object back in the queue
push @queue, $obj;
# if we encounter it again without any change
# then a circular dependency is detected
$error_marker = $obj unless defined $error_marker;
} else {
# the dependancies are a subset of the selected objects,
# so they are all resolved.
push @schedule, $obj;
# mark the object as selected
$selected->insert($obj);
# since something changed we can forget about the error marker
undef $error_marker;
}
}
# return the ordered list
@schedule;
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
# Whether or not inc::Module::Install is actually loaded, the
# $INC{inc/Module/Install.pm} is what will still get set as long as
# the caller loaded module this in the documented manner.
# If not set, the caller may NOT have loaded the bundled version, and thus
# they may not have a MI version that works with the Makefile.PL. This would
# result in false errors or unexpected behaviour. And we don't want that.
my $file = join( '/', 'inc', split /::/, __PACKAGE__ ) . '.pm';
unless ( $INC{$file} ) { die <<"END_DIE" }
Please invoke ${\__PACKAGE__} with:
inc/Module/Install.pm view on Meta::CPAN
# If the modification time is only slightly in the future,
# sleep briefly to remove the problem.
my $a = $s - time;
if ( $a > 0 and $a < 5 ) { sleep 5 }
# Too far in the future, throw an error.
my $t = time;
if ( $s > $t ) { die <<"END_DIE" }
Your installer $0 has a modification time in the future ($s > $t).
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Dependency.pm view on Meta::CPAN
#pod in this list, we don't have to include it in the output of the C<schedule> or
#pod C<depends> methods.
#pod
#pod =item ignore_orphans => 1
#pod
#pod Normally, the item source is expected to be largely perfect and error free.
#pod An 'orphan' is an item name that appears as a dependency of another item, but
#pod doesn't exist, or has been deleted.
#pod
#pod By providing the C<ignore_orphans> flag, orphans are simply ignored. Without
#pod the C<ignore_orphans> flag, an error will be returned if an orphan is found.
#pod
#pod =back
#pod
#pod The C<new> constructor returns a new Algorithm::Dependency object on success,
#pod or C<undef> on error.
#pod
#pod =cut
sub new {
my $class = shift;
lib/Algorithm/Dependency.pm view on Meta::CPAN
#pod =pod
#pod
#pod =head2 selected $name
#pod
#pod Given an item name, the C<selected> method will return true if the item is
#pod selected, false is not, or C<undef> if the item does not exist, or an error
#pod occurs.
#pod
#pod =cut
sub selected { $_[0]->{selected}->{$_[1]} }
lib/Algorithm/Dependency.pm view on Meta::CPAN
#pod If multiple item names are provided, the same applies. The list returned
#pod will not contain duplicates.
#pod
#pod The method returns a reference to an array of item names on success, a
#pod reference to an empty array if no other items are needed, or C<undef>
#pod on error.
#pod
#pod NOTE: The result of C<depends> is ordered by an internal C<sort>
#pod irrespective of the ordering provided by the dependency handler. Use
#pod L<Algorithm::Dependency::Ordered> and C<schedule> to use the most
#pod common ordering (process sequence)
lib/Algorithm/Dependency.pm view on Meta::CPAN
#pod If any of the names you provided in the arguments is already selected, it
#pod will not be included in the list.
#pod
#pod The method returns a reference to an array of item names on success, a
#pod reference to an empty array if no items need to be acted upon, or C<undef>
#pod on error.
#pod
#pod =cut
sub schedule {
my $self = shift;
lib/Algorithm/Dependency.pm view on Meta::CPAN
in this list, we don't have to include it in the output of the C<schedule> or
C<depends> methods.
=item ignore_orphans => 1
Normally, the item source is expected to be largely perfect and error free.
An 'orphan' is an item name that appears as a dependency of another item, but
doesn't exist, or has been deleted.
By providing the C<ignore_orphans> flag, orphans are simply ignored. Without
the C<ignore_orphans> flag, an error will be returned if an orphan is found.
=back
The C<new> constructor returns a new Algorithm::Dependency object on success,
or C<undef> on error.
=head2 source
The C<source> method retrieves the L<Algorithm::Dependency::Source> object
for the algorithm context.
lib/Algorithm/Dependency.pm view on Meta::CPAN
the list of the names of the selected items.
=head2 selected $name
Given an item name, the C<selected> method will return true if the item is
selected, false is not, or C<undef> if the item does not exist, or an error
occurs.
=head2 item $name
The C<item> method fetches and returns the item object, as specified by the
lib/Algorithm/Dependency.pm view on Meta::CPAN
If multiple item names are provided, the same applies. The list returned
will not contain duplicates.
The method returns a reference to an array of item names on success, a
reference to an empty array if no other items are needed, or C<undef>
on error.
NOTE: The result of C<depends> is ordered by an internal C<sort>
irrespective of the ordering provided by the dependency handler. Use
L<Algorithm::Dependency::Ordered> and C<schedule> to use the most
common ordering (process sequence)
lib/Algorithm/Dependency.pm view on Meta::CPAN
If any of the names you provided in the arguments is already selected, it
will not be included in the list.
The method returns a reference to an array of item names on success, a
reference to an empty array if no items need to be acted upon, or C<undef>
on error.
=head2 schedule_all;
The C<schedule_all> method acts the same as the C<schedule> method, but
returns a schedule that selected all the so-far unselected items.
view all matches for this distribution
view release on metacpan or search on metacpan
.travis.yml view on Meta::CPAN
branches:
only:
- /^build/
before_install:
# Prevent "Please tell me who you are" errors for certain DZIL configs
- git config --global user.name "lokku"
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Diff/Any.pm view on Meta::CPAN
my $diff = Algorithm::Diff::Any->new( \@seq1, \@seq2 );
# or with options
my $diff = Algorithm::Diff::Any->new( \@seq1, \@seq2, \%opts );
This method will return an appropriate B<Algorithm::Diff::Any> object or
throw an exception on error.
=cut
# Wrappers around the actual methods
sub new {
view all matches for this distribution
view release on metacpan or search on metacpan
my @old = qw( one two );
my @new = qw( one four );
$|++;
eval { diff_arrays( \@old, \@new, added => sub {}, deleted => sub {} ) };
ok( $@, 'Caught error' );
like( $@, qr/Can't recognize change in changeset\: '\*'/, 'Unknown change' );
view all matches for this distribution
view release on metacpan or search on metacpan
t/10_diff.t view on Meta::CPAN
use Algorithm::Diff::HTMLTable;
my $table = Algorithm::Diff::HTMLTable->new;
{
my $error;
eval {
$table->diff();
1;
} or $error = $@;
like $error, qr/need two filenames/, 'no filenames';
}
{
my $error;
eval {
$table->diff('file1');
1;
} or $error = $@;
like $error, qr/need two filenames/, 'one filenames';
}
{
my $error;
eval {
$table->diff('file1', 'file2', 'file3');
1;
} or $error = $@;
like $error, qr/need two filenames/, 'too many arguments';
}
{
my $error;
eval {
$table->diff('file1', 'file2');
1;
} or $error = $@;
like $error, qr/is not a file/, 'is not a file';
}
{
my $error;
eval {
$table->diff( {}, {} );
1;
} or $error = $@;
like $error, qr/Need either filename/, 'Hashref passed';
}
done_testing();
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
# Whether or not inc::Module::Install is actually loaded, the
# $INC{inc/Module/Install.pm} is what will still get set as long as
# the caller loaded module this in the documented manner.
# If not set, the caller may NOT have loaded the bundled version, and thus
# they may not have a MI version that works with the Makefile.PL. This would
# result in false errors or unexpected behaviour. And we don't want that.
my $file = join( '/', 'inc', split /::/, __PACKAGE__ ) . '.pm';
unless ( $INC{$file} ) {
die <<"END_DIE";
Please invoke ${\__PACKAGE__} with:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Diff.pm view on Meta::CPAN
# Check for bogus (non-ref) argument values
if ( !ref($a) || !ref($b) )
{
my @callerInfo = caller(1);
die 'error: must pass array or hash references to ' . $callerInfo[3];
}
# set up code refs
# Note that these are optimized.
if ( !defined($keyGen) ) # optimize for strings
lib/Algorithm/Diff.pm view on Meta::CPAN
$diff->Get('min1') == $diff->Min(1)
$diff->Get('0min2') == $diff->Min(2,0)
Using C<Get> in a scalar context when you've passed in more than one
name is a fatal error (C<die> is called).
=back
=head2 C<prepare>
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
# Whether or not inc::Module::Install is actually loaded, the
# $INC{inc/Module/Install.pm} is what will still get set as long as
# the caller loaded module this in the documented manner.
# If not set, the caller may NOT have loaded the bundled version, and thus
# they may not have a MI version that works with the Makefile.PL. This would
# result in false errors or unexpected behaviour. And we don't want that.
my $file = join( '/', 'inc', split /::/, __PACKAGE__ ) . '.pm';
unless ( $INC{$file} ) {
die <<"END_DIE";
Please invoke ${\__PACKAGE__} with:
view all matches for this distribution
view release on metacpan or search on metacpan
t/000-report-versions.t view on Meta::CPAN
# Create an object from a file
sub read {
my $class = ref $_[0] ? ref shift : shift;
# Check the file
my $file = shift or return $class->_error( 'You did not specify a file name' );
return $class->_error( "File '$file' does not exist" ) unless -e $file;
return $class->_error( "'$file' is a directory, not a file" ) unless -f _;
return $class->_error( "Insufficient permissions to read '$file'" ) unless -r _;
# Slurp in the file
local $/ = undef;
local *CFG;
unless ( open(CFG, $file) ) {
return $class->_error("Failed to open file '$file': $!");
}
my $contents = <CFG>;
unless ( close(CFG) ) {
return $class->_error("Failed to close file '$file': $!");
}
$class->read_string( $contents );
}
t/000-report-versions.t view on Meta::CPAN
sub read_string {
my $class = ref $_[0] ? ref shift : shift;
my $self = bless [], $class;
my $string = $_[0];
unless ( defined $string ) {
return $self->_error("Did not provide a string to load");
}
# Byte order marks
# NOTE: Keeping this here to educate maintainers
# my %BOM = (
t/000-report-versions.t view on Meta::CPAN
# "\377\376" => 'UTF-16LE',
# "\377\376\0\0" => 'UTF-32LE'
# "\0\0\376\377" => 'UTF-32BE',
# );
if ( $string =~ /^(?:\376\377|\377\376|\377\376\0\0|\0\0\376\377)/ ) {
return $self->_error("Stream has a non UTF-8 BOM");
} else {
# Strip UTF-8 bom if found, we'll just ignore it
$string =~ s/^\357\273\277//;
}
t/000-report-versions.t view on Meta::CPAN
utf8::decode($string) if HAVE_UTF8;
# Check for some special cases
return $self unless length $string;
unless ( $string =~ /[\012\015]+\z/ ) {
return $self->_error("Stream does not end with newline character");
}
# Split the file into lines
my @lines = grep { ! /^\s*(?:\#.*)?\z/ }
split /(?:\015{1,2}\012|\015|\012)/, $string;
t/000-report-versions.t view on Meta::CPAN
}
return 1;
}
# Set error
sub _error {
$YAML::Tiny::errstr = $_[1];
undef;
}
# Retrieve error
sub errstr {
$YAML::Tiny::errstr;
}
view all matches for this distribution