Subject: | Avoid collision with system package (B::) |
I submit the patch, because during my test with Test::Builder2, I have issue on Carp 1.25.
So I try to figure out what happen, and they is issue with 'B::' already loaded or not.
I have seen home package, name A/B/C/D, so it's confusing with system package.
I purpose this patch to name it AA/BB/CC/DD instead.
Subject: | avoid-collision-with-system-package.patch |
commit 437da185e6927f825c90dd9abb3a8ebc906ecced
Author: geistteufel <geistteufel@yahoo.fr>
Date: Fri Mar 30 16:14:22 2012 +0200
change A / B / C / D to AA / BB / CC / DD to avoid confusion with system package
diff --git a/t/Carp.t b/t/Carp.t
index 803ec0a..6b1194a 100644
--- a/t/Carp.t
+++ b/t/Carp.t
@@ -103,87 +103,87 @@ eval {
ok !$warning, q/'...::CARP_NOT used only once' warning from Carp/;
# Test the location of error messages.
-like( A::short(), qr/^Error at C/, "Short messages skip carped package" );
+like( AA::short(), qr/^Error at CC/, "Short messages skip carped package" );
{
- local @C::ISA = "D";
- like( A::short(), qr/^Error at B/, "Short messages skip inheritance" );
+ local @CC::ISA = "DD";
+ like( AA::short(), qr/^Error at BB/, "Short messages skip inheritance" );
}
{
- local @D::ISA = "C";
- like( A::short(), qr/^Error at B/, "Short messages skip inheritance" );
+ local @DD::ISA = "CC";
+ like( AA::short(), qr/^Error at BB/, "Short messages skip inheritance" );
}
{
- local @D::ISA = "B";
- local @B::ISA = "C";
- like( A::short(), qr/^Error at A/, "Inheritance is transitive" );
+ local @DD::ISA = "BB";
+ local @BB::ISA = "CC";
+ like( AA::short(), qr/^Error at AA/, "Inheritance is transitive" );
}
{
- local @B::ISA = "D";
- local @C::ISA = "B";
- like( A::short(), qr/^Error at A/, "Inheritance is transitive" );
+ local @BB::ISA = "DD";
+ local @CC::ISA = "BB";
+ like( AA::short(), qr/^Error at AA/, "Inheritance is transitive" );
}
{
- local @C::CARP_NOT = "D";
- like( A::short(), qr/^Error at B/, "Short messages see \@CARP_NOT" );
+ local @CC::CARP_NOT = "DD";
+ like( AA::short(), qr/^Error at BB/, "Short messages see \@CARP_NOT" );
}
{
- local @D::CARP_NOT = "C";
- like( A::short(), qr/^Error at B/, "Short messages see \@CARP_NOT" );
+ local @DD::CARP_NOT = "CC";
+ like( AA::short(), qr/^Error at BB/, "Short messages see \@CARP_NOT" );
}
{
- local @D::CARP_NOT = "B";
- local @B::CARP_NOT = "C";
- like( A::short(), qr/^Error at A/, "\@CARP_NOT is transitive" );
+ local @DD::CARP_NOT = "BB";
+ local @BB::CARP_NOT = "CC";
+ like( AA::short(), qr/^Error at AA/, "\@CARP_NOT is transitive" );
}
{
- local @B::CARP_NOT = "D";
- local @C::CARP_NOT = "B";
- like( A::short(), qr/^Error at A/, "\@CARP_NOT is transitive" );
+ local @BB::CARP_NOT = "DD";
+ local @CC::CARP_NOT = "BB";
+ like( AA::short(), qr/^Error at AA/, "\@CARP_NOT is transitive" );
}
{
- local @D::ISA = "C";
- local @D::CARP_NOT = "B";
- like( A::short(), qr/^Error at C/, "\@CARP_NOT overrides inheritance" );
+ local @DD::ISA = "CC";
+ local @DD::CARP_NOT = "BB";
+ like( AA::short(), qr/^Error at CC/, "\@CARP_NOT overrides inheritance" );
}
{
- local @D::ISA = "B";
- local @D::CARP_NOT = "C";
- like( A::short(), qr/^Error at B/, "\@CARP_NOT overrides inheritance" );
+ local @DD::ISA = "BB";
+ local @DD::CARP_NOT = "CC";
+ like( AA::short(), qr/^Error at BB/, "\@CARP_NOT overrides inheritance" );
}
# %Carp::Internal
{
- local $Carp::Internal{C} = 1;
- like( A::short(), qr/^Error at B/, "Short doesn't report Internal" );
+ local $Carp::Internal{CC} = 1;
+ like( AA::short(), qr/^Error at BB/, "Short doesn't report Internal" );
}
{
- local $Carp::Internal{D} = 1;
- like( A::long(), qr/^Error at C/, "Long doesn't report Internal" );
+ local $Carp::Internal{DD} = 1;
+ like( AA::long(), qr/^Error at CC/, "Long doesn't report Internal" );
}
# %Carp::CarpInternal
{
- local $Carp::CarpInternal{D} = 1;
+ local $Carp::CarpInternal{DD} = 1;
like(
- A::short(), qr/^Error at B/,
+ AA::short(), qr/^Error at BB/,
"Short doesn't report calls to CarpInternal"
);
}
{
- local $Carp::CarpInternal{D} = 1;
- like( A::long(), qr/^Error at C/, "Long doesn't report CarpInternal" );
+ local $Carp::CarpInternal{DD} = 1;
+ like( AA::long(), qr/^Error at CC/, "Long doesn't report CarpInternal" );
}
# tests for global variables
@@ -345,27 +345,27 @@ for my $bodge_job ( 2, 1, 0 ) { SKIP: {
like( $accum, qr/main::fakecaller/,
"test CORE::GLOBAL::caller override in eval" );
$accum = '';
- my $got = A::long(42);
+ my $got = AA::long(42);
like( $accum, qr/main::fakecaller/,
"test CORE::GLOBAL::caller override in Carp" );
- my $package = 'A';
my $where = $bodge_job == 1 ? ' in &main::__ANON__' : '';
my $warning
= $bodge_job
? "\Q** Incomplete caller override detected$where; \@DB::args were not set **\E"
: '';
- for ( 0 .. 2 ) {
- my $previous_package = $package;
- ++$package;
+ my @packages = qw/AA BB CC DD/;
+ for my $idx ( 0 .. 2 ) {
+ my $previous_package = $packages[$idx];
+ my $package = $packages[$idx+1];
like( $got,
qr/${package}::long\($warning\) called at $previous_package line \d+/,
"Correct arguments for $package" );
}
my $arg = $bodge_job ? $warning : 42;
like(
- $got, qr!A::long\($arg\) called at.+\b(?i:carp\.t) line \d+!,
- 'Correct arguments for A'
+ $got, qr!AA::long\($arg\) called at.+\b(?i:carp\.t) line \d+!,
+ 'Correct arguments for AA'
);
} }
@@ -381,12 +381,12 @@ SKIP: {
}
};
- my $got = A::long(42);
+ my $got = AA::long(42);
like(
$got,
- qr!A::long\(\Q** Incomplete caller override detected; \E\@DB::args\Q were not set **\E\) called at.+\b(?i:carp\.t) line \d+!,
- 'Correct arguments for A'
+ qr!AA::long\(\Q** Incomplete caller override detected; \E\@DB::args\Q were not set **\E\) called at.+\b(?i:carp\.t) line \d+!,
+ 'Correct arguments for AA'
);
}
@@ -424,7 +424,7 @@ SKIP:
}
# [perl #96672]
-<D::DATA> for 1..2;
+<DD::DATA> for 1..2;
eval { croak 'heek' };
$@ =~ s/\n.*//; # just check first line
is $@, "heek at ".__FILE__." line ".(__LINE__-2).", <DATA> line 2.\n",
@@ -433,41 +433,41 @@ is $@, "heek at ".__FILE__." line ".(__LINE__-2).", <DATA> line 2.\n",
# New tests go here
-# line 1 "A"
-package A;
+# line 1 "AA"
+package AA;
sub short {
- B::short();
+ BB::short();
}
sub long {
- B::long();
+ BB::long();
}
-# line 1 "B"
-package B;
+# line 1 "BB"
+package BB;
sub short {
- C::short();
+ CC::short();
}
sub long {
- C::long();
+ CC::long();
}
-# line 1 "C"
-package C;
+# line 1 "CC"
+package CC;
sub short {
- D::short();
+ DD::short();
}
sub long {
- D::long();
+ DD::long();
}
-# line 1 "D"
-package D;
+# line 1 "DD"
+package DD;
sub short {
eval { Carp::croak("Error") };