/usr/share/perl5/List/Compare/Base/_Auxiliary.pm is in liblist-compare-perl 0.53-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 | package List::Compare::Base::_Auxiliary;
$VERSION = 0.53;
use Carp;
@ISA = qw(Exporter);
@EXPORT_OK = qw|
_validate_2_seenhashes
_validate_seen_hash
_validate_multiple_seenhashes
_calculate_array_seen_only
_calculate_seen_only
_calculate_intermediate
_calculate_union_only
_calculate_union_seen_only
_calculate_sharedref
_subset_subengine
_chart_engine_regular
_chart_engine_multiple
_equivalent_subengine
_index_message1
_index_message2
_index_message3
_index_message4
_prepare_listrefs
_subset_engine_multaccel
_calc_seen
_calc_seen1
_equiv_engine
_argument_checker_0
_argument_checker
_argument_checker_1
_argument_checker_2
_argument_checker_3
_argument_checker_3a
_argument_checker_4
_alt_construct_tester
_alt_construct_tester_1
_alt_construct_tester_2
_alt_construct_tester_3
_alt_construct_tester_4
_alt_construct_tester_5
|;
%EXPORT_TAGS = (
calculate => [ qw(
_calculate_array_seen_only
_calculate_seen_only
_calculate_intermediate
_calculate_union_only
_calculate_union_seen_only
_calculate_sharedref
) ],
checker => [ qw(
_argument_checker_0
_argument_checker
_argument_checker_1
_argument_checker_2
_argument_checker_3
_argument_checker_3a
_argument_checker_4
) ],
tester => [ qw(
_alt_construct_tester
_alt_construct_tester_1
_alt_construct_tester_2
_alt_construct_tester_3
_alt_construct_tester_4
_alt_construct_tester_5
) ],
);
use strict;
local $^W =1;
my $bad_lists_msg = q{If argument is single hash ref, you must have a 'lists' key whose value is an array ref};
sub _validate_2_seenhashes {
my ($refL, $refR) = @_;
my (%seenL, %seenR);
my (%badentriesL, %badentriesR);
foreach (keys %$refL) {
if (${$refL}{$_} =~ /^\d+$/ and ${$refL}{$_} > 0) {
$seenL{$_} = ${$refL}{$_};
} else {
$badentriesL{$_} = ${$refL}{$_};
}
}
foreach (keys %$refR) {
if (${$refR}{$_} =~ /^\d+$/ and ${$refR}{$_} > 0) {
$seenR{$_} = ${$refR}{$_};
} else {
$badentriesR{$_} = ${$refR}{$_};
}
}
my $msg = q{};
if ( (keys %badentriesL) or (keys %badentriesR) ) {
$msg .= "\nValues in a 'seen-hash' may only be positive integers.\n";
$msg .= " These elements have invalid values:\n";
if (keys %badentriesL) {
$msg .= " First hash in arguments:\n";
$msg .= " Key: $_\tValue: $badentriesL{$_}\n"
foreach (sort keys %badentriesL);
}
if (keys %badentriesR) {
$msg .= " Second hash in arguments:\n";
$msg .= " Key: $_\tValue: $badentriesR{$_}\n"
foreach (sort keys %badentriesR);
}
$msg .= "Correct invalid values before proceeding";
croak "$msg: $!";
}
return (\%seenL, \%seenR);
}
sub _validate_seen_hash {
if (@_ > 2) {
_validate_multiple_seenhashes( [@_] );
} else {
my ($l, $r) = @_;
my (%badentriesL, %badentriesR);
foreach (keys %$l) {
$badentriesL{$_} = ${$l}{$_}
unless (${$l}{$_} =~ /^\d+$/ and ${$l}{$_} > 0);
}
foreach (keys %$r) {
$badentriesR{$_} = ${$r}{$_}
unless (${$r}{$_} =~ /^\d+$/ and ${$r}{$_} > 0);
}
my $msg = q{};
if ( (keys %badentriesL) or (keys %badentriesR) ) {
$msg .= "\nValues in a 'seen-hash' must be numeric.\n";
$msg .= " These elements have invalid values:\n";
if (keys %badentriesL) {
$msg .= " First hash in arguments:\n";
$msg .= " Key: $_\tValue: $badentriesL{$_}\n"
foreach (sort keys %badentriesL);
}
if (keys %badentriesR) {
$msg .= " Second hash in arguments:\n";
$msg .= " Key: $_\tValue: $badentriesR{$_}\n"
foreach (sort keys %badentriesR);
}
$msg .= "Correct invalid values before proceeding";
croak "$msg: $!";
}
}
}
sub _validate_multiple_seenhashes {
my $hashrefsref = shift;
my (%badentries);
for (my $i = 0; $i <= $#{$hashrefsref}; $i++) {
foreach my $k (keys %{$hashrefsref->[$i]}) {
unless ($hashrefsref->[$i]->{$k} =~ /^\d+$/ and $hashrefsref->[$i]->{$k} > 0) {
$badentries{$i}{$k} = $hashrefsref->[$i]->{$k};
}
}
}
my $msg = q{};
if (scalar(keys %badentries)) {
$msg .= "\nValues in a 'seen-hash' must be positive integers.\n";
$msg .= " These elements have invalid values:\n\n";
foreach my $b (sort keys %badentries) {
$msg .= " Hash $b:\n";
foreach my $val (sort keys %{$badentries{$b}}) {
$msg .= " Bad key-value pair: $val\t$badentries{$b}->{$val}\n";
}
}
$msg .= "Correct invalid values before proceeding";
croak "$msg: $!";
}
}
sub _list_builder {
my ($aref, $x) = @_;
if (ref(${$aref}[$x]) eq 'HASH') {
return keys %{${$aref}[$x]};
} else {
return @{${$aref}[$x]};
}
}
sub _calculate_array_seen_only {
my $aref = shift;
my (@seen);
for (my $i = 0; $i <= $#{$aref}; $i++) {
my %seenthis = ();
foreach my $el ( _list_builder($aref, $i) ) {
$seenthis{$el}++;
}
push @seen, \%seenthis;
}
return \@seen;
}
sub _calculate_seen_only {
my $aref = shift;
my (%seen);
for (my $i = 0; $i <= $#{$aref}; $i++) {
my %seenthis = ();
foreach my $h ( _list_builder($aref, $i) ) {
$seenthis{$h}++;
}
$seen{$i} = \%seenthis;
}
return \%seen;
}
sub _calculate_intermediate {
my $aref = shift;
my $aseenref = _calculate_array_seen_only($aref);
my @vals = sort { scalar(keys(%{$a})) <=> scalar(keys(%{$b})) } @{$aseenref};
my %intermediate = map { $_ => 1 } keys %{$vals[0]};
for my $l ( 1..$#vals ) {
%intermediate = map { $_ => 1 }
grep { exists $intermediate{$_} }
keys %{$vals[$l]};
}
return \%intermediate;
}
sub _calculate_union_only {
my $aref = shift;
my (%union);
for (my $i = 0; $i <= $#{$aref}; $i++) {
foreach my $h ( _list_builder($aref, $i) ) {
$union{$h}++;
}
}
return \%union;
}
sub _calculate_union_seen_only {
my $aref = shift;
my (%union, %seen);
for (my $i = 0; $i <= $#{$aref}; $i++) {
my %seenthis = ();
foreach my $h ( _list_builder($aref, $i) ) {
$seenthis{$h}++;
$union{$h}++;
}
$seen{$i} = \%seenthis;
}
return (\%union, \%seen);
}
sub _calculate_sharedref {
my $seenrefsref = shift;
my %intermediate = ();
for my $href (@{$seenrefsref}) {
my %this = map { $_ => 1 } keys(%{$href});
for my $k (keys %this) {;
$intermediate{$k}++;
};
}
my $sharedref;
for my $k (keys %intermediate) {
$sharedref->{$k}++ if $intermediate{$k} > 1;
}
return $sharedref;
}
sub _is_list_subset {
my ( $subset, $superset ) = @_;
# return false if the superset value is false
# for any subset value.
# note that this does *not* validate overlap of
# the keys; it validates the truth of supserset
# values.
$superset->{ $_ } or return 0 for keys %$subset;
return 1;
}
sub _subset_subengine {
my $aref = shift;
my (@xsubset);
my %seen = %{_calculate_seen_only($aref)};
foreach my $i (keys %seen) {
foreach my $j (keys %seen) {
if ( $i eq $j ) {
$xsubset[$i][$j] = 1;
}
elsif ( $i gt $j ) {
if ( scalar(keys %{ $seen{$i} }) == scalar(keys %{ $seen{$j} }) ){
$xsubset[$i][$j] = _is_list_subset($seen{$i}, $seen{$j});
$xsubset[$j][$i] = $xsubset[$i][$j];
}
elsif ( scalar(keys %{ $seen{$i} }) < scalar(keys %{ $seen{$j} }) ){
$xsubset[$i][$j] = _is_list_subset($seen{$i}, $seen{$j});
$xsubset[$j][$i] = 0;
}
elsif ( scalar(keys %{ $seen{$i} }) > scalar(keys %{ $seen{$j} }) ){
$xsubset[$j][$i] = _is_list_subset($seen{$j}, $seen{$i});
$xsubset[$i][$j] = 0;
}
}
}
}
return \@xsubset;
}
sub _chart_engine_regular {
my $aref = shift;
my @sub_or_eqv = @$aref;
my $title = shift;
my ($v, $w, $t);
print "\n";
print $title, ' Relationships', "\n\n";
print ' Right: 0 1', "\n\n";
print 'Left: 0: 1 ', $sub_or_eqv[0], "\n\n";
print ' 1: ', $sub_or_eqv[1], ' 1', "\n\n";
}
sub _chart_engine_multiple {
my $aref = shift;
my @sub_or_eqv = @$aref;
my $title = shift;
my ($v, $w, $t);
print "\n";
print $title, ' Relationships', "\n\n";
print ' Right:';
for ($v = 0; $v <= $#sub_or_eqv; $v++) {
print ' ', $v;
}
print "\n\n";
print 'Left: 0:';
my @firstrow = @{$sub_or_eqv[0]};
for ($t = 0; $t <= $#firstrow; $t++) {
print ' ', $firstrow[$t];
}
print "\n\n";
for ($w = 1; $w <= $#sub_or_eqv; $w++) {
my $length_left = length($w);
my $x = '';
print ' ' x (8 - $length_left), $w, ':';
my @row = @{$sub_or_eqv[$w]};
for ($x = 0; $x <= $#row; $x++) {
print ' ', $row[$x];
}
print "\n\n";
}
1; # force return true value
}
sub _equivalent_subengine {
my $aref = shift;
my @xsubset = @{_subset_subengine($aref)};
my (@xequivalent);
for (my $f = 0; $f <= $#xsubset; $f++) {
for (my $g = 0; $g <= $#xsubset; $g++) {
$xequivalent[$f][$g] = 0;
$xequivalent[$f][$g] = 1
if ($xsubset[$f][$g] and $xsubset[$g][$f]);
}
}
return \@xequivalent;
}
sub _index_message1 {
my ($index, $dataref) = @_;
my $method = (caller(1))[3];
croak "Argument to method $method must be the array index of the target list \n in list of arrays passed as arguments to the constructor: $!"
unless (
$index =~ /^\d+$/
and $index <= ${$dataref}{'maxindex'}
);
}
sub _index_message2 {
my $dataref = shift;
my ($index_left, $index_right);
my $method = (caller(1))[3];
croak "Method $method requires 2 arguments: $!"
unless (@_ == 0 || @_ == 2);
if (@_ == 0) {
$index_left = 0;
$index_right = 1;
} else {
($index_left, $index_right) = @_;
foreach ($index_left, $index_right) {
croak "Each argument to method $method must be a valid array index for the target list \n in list of arrays passed as arguments to the constructor: $!"
unless (
$_ =~ /^\d+$/
and $_ <= ${$dataref}{'maxindex'}
);
}
}
return ($index_left, $index_right);
}
sub _index_message3 {
my ($index, $maxindex) = @_;
my $method = (caller(1))[3];
croak "Argument to method $method must be the array index of the target list \n in list of arrays passed as arguments to the constructor: $!"
unless (
$index =~ /^\d+$/
and $index <= $maxindex
);
}
sub _index_message4 {
my $maxindex = shift;
my ($index_left, $index_right);
my $method = (caller(1))[3];
croak "Method $method requires 2 arguments: $!"
unless (@_ == 0 || @_ == 2);
if (@_ == 0) {
$index_left = 0;
$index_right = 1;
} else {
($index_left, $index_right) = @_;
foreach ($index_left, $index_right) {
croak "Each argument to method $method must be a valid array index for the target list \n in list of arrays passed as arguments to the constructor: $!"
unless (
$_ =~ /^\d+$/
and $_ <= $maxindex
);
}
}
return ($index_left, $index_right);
}
sub _prepare_listrefs {
my $dataref = shift;
delete ${$dataref}{'unsort'};
my (@listrefs);
foreach my $lref (sort {$a <=> $b} keys %{$dataref}) {
push(@listrefs, ${$dataref}{$lref});
};
return \@listrefs;
}
sub _subset_engine_multaccel {
my $dataref = shift;
my $aref = _prepare_listrefs($dataref);
my ($index_left, $index_right) = _index_message4($#{$aref}, @_);
my $xsubsetref = _subset_subengine($aref);
return ${$xsubsetref}[$index_left][$index_right];
}
sub _calc_seen {
my ($refL, $refR) = @_;
# We've already guaranteed that args are both array refs or both hash
# refs. So checking the left-hand one is sufficient.
if (ref($refL) eq 'ARRAY') {
my (%seenL, %seenR);
foreach (@$refL) { $seenL{$_}++ }
foreach (@$refR) { $seenR{$_}++ }
return (\%seenL, \%seenR);
} else {
return ($refL, $refR);
}
}
sub _equiv_engine {
my ($hrefL, $hrefR) = @_;
my (%intersection, %Lonly, %Ronly, %LorRonly);
my $LequivalentR_status = 0;
foreach (keys %{$hrefL}) {
exists ${$hrefR}{$_} ? $intersection{$_}++ : $Lonly{$_}++;
}
foreach (keys %{$hrefR}) {
$Ronly{$_}++ unless (exists $intersection{$_});
}
$LorRonly{$_}++ foreach ( (keys %Lonly), (keys %Ronly) );
$LequivalentR_status = 1 if ( (keys %LorRonly) == 0);
return $LequivalentR_status;
}
sub _argument_checker_0 {
my @args = @_;
my $first_ref = ref($args[0]);
my @temp = @args[1..$#args];
my ($testing);
my $condition = 1;
while (defined ($testing = shift(@temp)) ) {
unless (ref($testing) eq $first_ref) {
$condition = 0;
last;
}
}
croak "Arguments must be either all array references or all hash references: $!"
unless $condition;
_validate_seen_hash(@args) if $first_ref eq 'HASH';
return (@args);
}
sub _argument_checker {
my $argref = shift;
croak "'$argref' must be an array ref" unless ref($argref) eq 'ARRAY';
my @args = _argument_checker_0(@{$argref});
return (@args);
}
sub _argument_checker_1 {
my $argref = shift;
my @args = @{$argref};
croak "Subroutine call requires 2 references as arguments: $!"
unless @args == 2;
return (_argument_checker($args[0]), ${$args[1]}[0]);
}
sub _argument_checker_2 {
my $argref = shift;
my @args = @$argref;
croak "Subroutine call requires 2 references as arguments: $!"
unless @args == 2;
return (_argument_checker($args[0]), $args[1]);
}
# _argument_checker_3 is currently set-up to handle either 1 or 2 arguments
# in get_unique and get_complement
# The first argument is an arrayref holding refs to lists ('unsorted' has been
# stripped off).
# The second argument is an arrayref holding a single item (index number of
# item being tested)
# Note: Currently we're only checking for the quantity of arguments -- not
# their types. This should be fixed.
sub _argument_checker_3 {
my $argref = shift;
my @args = @{$argref};
if (@args == 1) {
return (_argument_checker($args[0]), 0);
} elsif (@args == 2) {
return (_argument_checker($args[0]), ${$args[1]}[0]);
} else {
croak "Subroutine call requires 1 or 2 references as arguments: $!";
}
}
sub _argument_checker_3a {
my $argref = shift;
my @args = @{$argref};
if (@args == 1) {
return [ _argument_checker($args[0]) ];
} else {
croak "Subroutine call requires exactly 1 reference as argument: $!";
}
}
sub _argument_checker_4 {
my $argref = shift;
my @args = @{$argref};
if (@args == 1) {
return (_argument_checker($args[0]), [0,1]);
} elsif (@args == 2) {
if (@{$args[1]} == 2) {
my $last_index = $#{$args[0]};
foreach my $i (@{$args[1]}) {
croak "No element in index position $i in list of list references passed as first argument to function: $!"
unless ($i =~ /^\d+$/ and $i <= $last_index);
}
return (_argument_checker($args[0]), $args[1]);
} else {
croak "Must provide index positions corresponding to two lists: $!";
}
} else {
croak "Subroutine call requires 1 or 2 references as arguments: $!";
}
}
sub _calc_seen1 {
my @listrefs = @_;
# _calc_seen1() is applied after _argument_checker(), which checks to make
# sure that the references in its output are either all arrayrefs
# or all seenhashrefs
# hence, _calc_seen1 only needs to determine whether it's dealing with
# arrayrefs or seenhashrefs, then, if arrayrefs, calculate seenhashes
if (ref($listrefs[0]) eq 'ARRAY') {
my (@seenrefs);
foreach my $aref (@listrefs) {
my (%seenthis);
foreach my $j (@{$aref}) {
$seenthis{$j}++;
}
push(@seenrefs, \%seenthis);
}
return \@seenrefs;
} else {
return \@listrefs;
}
}
# _alt_construct_tester prepares for _argument_checker in
# get_union get_intersection get_symmetric_difference get_shared get_nonintersection
sub _alt_construct_tester {
my @args = @_;
my ($argref, $unsorted);
if (@args == 1 and (ref($args[0]) eq 'HASH')) {
my $hashref = shift;
croak "$bad_lists_msg: $!"
unless ( ${$hashref}{'lists'}
and (ref(${$hashref}{'lists'}) eq 'ARRAY') );
$argref = ${$hashref}{'lists'};
$unsorted = ${$hashref}{'unsorted'} ? 1 : '';
} else {
$unsorted = shift(@args)
if ($args[0] eq '-u' or $args[0] eq '--unsorted');
$argref = shift(@args);
}
return ($argref, $unsorted);
}
# _alt_construct_tester_1 prepares for _argument_checker_1 in
# is_member_which is_member_which_ref is_member_any
sub _alt_construct_tester_1 {
my @args = @_;
my ($argref);
if (@args == 1 and (ref($args[0]) eq 'HASH')) {
my (@returns);
my $hashref = $args[0];
croak "$bad_lists_msg: $!"
unless ( ${$hashref}{'lists'}
and (ref(${$hashref}{'lists'}) eq 'ARRAY') );
croak "If argument is single hash ref, you must have an 'item' key: $!"
unless ${$hashref}{'item'};
@returns = ( ${$hashref}{'lists'}, [${$hashref}{'item'}] );
$argref = \@returns;
} else {
$argref = \@args;
}
return $argref;
}
# _alt_construct_tester_2 prepares for _argument_checker_2 in
# are_members_which are_members_any
sub _alt_construct_tester_2 {
my @args = @_;
if (@args == 1 and (ref($args[0]) eq 'HASH')) {
my $hashref = $args[0];
croak "$bad_lists_msg: $!"
unless ( ${$hashref}{'lists'}
and (ref(${$hashref}{'lists'}) eq 'ARRAY') );
croak "If argument is single hash ref, you must have an 'items' key whose value is an array ref: $!"
unless ( ${$hashref}{'items'}
and (ref(${$hashref}{'items'}) eq 'ARRAY') );
return [ (${$hashref}{'lists'}, ${$hashref}{'items'}) ];
} else {
return \@args;
}
}
# _alt_construct_tester_3 prepares for _argument_checker_3 in
# get_unique get_complement
sub _alt_construct_tester_3 {
my @args = @_;
my ($argref, $unsorted);
if (@args == 1 and (ref($args[0]) eq 'HASH')) {
my (@returns);
my $hashref = $args[0];
croak "$bad_lists_msg: $!"
unless ( ${$hashref}{'lists'}
and (ref(${$hashref}{'lists'}) eq 'ARRAY') );
@returns = defined ${$hashref}{'item'}
? (${$hashref}{'lists'}, [${$hashref}{'item'}])
: (${$hashref}{'lists'});
$argref = \@returns;
$unsorted = ${$hashref}{'unsorted'} ? 1 : '';
} else {
$unsorted = shift(@args) if ($args[0] eq '-u' or $args[0] eq '--unsorted');
$argref = \@args;
}
return ($argref, $unsorted);
}
# _alt_construct_tester_4 prepares for _argument_checker_4 in
# is_LsubsetR is_RsubsetL is_LequivalentR is_LdisjointR
sub _alt_construct_tester_4 {
my @args = @_;
my ($argref);
if (@args == 1 and (ref($args[0]) eq 'HASH')) {
my (@returns);
my $hashref = $args[0];
croak "$bad_lists_msg: $!"
unless ( ${$hashref}{'lists'}
and (ref(${$hashref}{'lists'}) eq 'ARRAY') );
@returns = defined ${$hashref}{'pair'}
? (${$hashref}{'lists'}, ${$hashref}{'pair'})
: (${$hashref}{'lists'});
$argref = \@returns;
} else {
$argref = \@args;
}
return $argref;
}
# _alt_construct_tester_5 prepares for _argument_checker in
# print_subset_chart print_equivalence_chart
sub _alt_construct_tester_5 {
my @args = @_;
my ($argref);
if (@args == 1) {
if (ref($args[0]) eq 'HASH') {
my $hashref = shift;
croak "Need to define 'lists' key properly: $!"
unless ( ${$hashref}{'lists'}
and (ref(${$hashref}{'lists'}) eq 'ARRAY') );
$argref = ${$hashref}{'lists'};
} else {
$argref = shift(@args);
}
} else {
croak "Subroutine call requires exactly 1 reference as argument: $!";
}
return $argref;
}
1;
__END__
=head1 NAME
List::Compare::Base::_Auxiliary - Internal use only
=head1 VERSION
This document refers to version 0.53 of List::Compare::Base::_Auxiliary.
This version was released June 07 2015.
=head1 SYNOPSIS
This module contains subroutines used within List::Compare and
List::Compare::Functional. They are not intended to be publicly callable.
=head1 AUTHOR
James E. Keenan (jkeenan@cpan.org). When sending correspondence, please
include 'List::Compare' or 'List-Compare' in your subject line.
Creation date: May 20, 2002. Last modification date: February 25 2015.
Copyright (c) 2002-15 James E. Keenan. United States. All rights reserved.
This is free software and may be distributed under the same terms as Perl
itself.
=cut
|