Skip to content

Commit

Permalink
Upgrade NEXT to 0.68 from CPAN
Browse files Browse the repository at this point in the history
[DELTA]

0.68 2021-04-19 NEILB
    - Fix for RT#123002, so NEXT works with proxy constants
    - Made testsuite clean under strict & warnings
    - Made testsuite pass if running under perls that are already c3.

0.67_03 2021-04-18 NEILB
    - mro was added in Perl 5.9.5, and it's not dual-life, so Reini's
      patch (in 0.67_01) failed on earlier versions of Perl.
      Have now made its use dependent on version, with "use if".

0.67_02 2021-04-18 NEILB
    - Applied patch from Father C so that NEXT works with proxy constants.
      RT#123002

0.67_01 2021-04-18 NEILB
    - Enforced strict and warnings on testsuite. Thanks to ATOOMIC.
    - Added github CI. Thanks to ATOOMIC.
    - @isa fixes for c3, so tests will pass on perls that use c3 as default
      (for example cperl). Thanks to RURBAN.
  • Loading branch information
toddr committed Apr 20, 2021
1 parent 548d3fb commit ff9a896
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 24 deletions.
3 changes: 1 addition & 2 deletions Porting/Maintainers.pl
Original file line number Diff line number Diff line change
Expand Up @@ -866,10 +866,9 @@ package Maintainers;
},

'NEXT' => {
'DISTRIBUTION' => 'NEILB/NEXT-0.67.tar.gz',
'DISTRIBUTION' => 'NEILB/NEXT-0.68.tar.gz',
'FILES' => q[cpan/NEXT],
'EXCLUDED' => [qr{^demo/}],
'CUSTOMIZED' => [ qw(lib/NEXT.pm t/next.t) ],
},

'Params::Check' => {
Expand Down
2 changes: 1 addition & 1 deletion cpan/NEXT/lib/NEXT.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use strict;
use warnings;
use overload ();

our $VERSION = '0.67_01';
our $VERSION = '0.68';

sub NEXT::ELSEWHERE::ancestors
{
Expand Down
15 changes: 12 additions & 3 deletions cpan/NEXT/t/actual.t
Original file line number Diff line number Diff line change
@@ -1,32 +1,41 @@
use strict;
use warnings;
use Test::More tests => 10;

BEGIN { use_ok('NEXT') };
my $order = 0;

package A;
@ISA = qw/B C D/;
our @ISA = qw/B C D/;
use if $] >= 5.009005, 'mro', 'dfs';


sub test { ++$order; ::ok($order==1,"test A"); $_[0]->NEXT::ACTUAL::test;}

package B;
@ISA = qw/D C/;
our @ISA = qw/D C/;
use if $] >= 5.009005, 'mro', 'dfs';
sub test { ++$order; ::ok($order==2,"test B"); $_[0]->NEXT::ACTUAL::test;}

package C;
@ISA = qw/D/;
our @ISA = qw/D/;
use if $] >= 5.009005, 'mro', 'dfs';

sub test {
++$order; ::ok($order==4||$order==6,"test C");
$_[0]->NEXT::ACTUAL::test;
}

package D;
use if $] >= 5.009005, 'mro', 'dfs';

sub test {
++$order; ::ok($order==3||$order==5||$order==7||$order==8,"test D");
$_[0]->NEXT::ACTUAL::test;
}

package main;
use if $] >= 5.009005, 'mro', 'dfs';

my $foo = {};

Expand Down
15 changes: 12 additions & 3 deletions cpan/NEXT/t/actuns.t
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
use strict;
use warnings;
use Test::More tests => 6;

BEGIN { use_ok('NEXT') };
my $order = 0;

package A;
@ISA = qw/B C D/;

our @ISA = qw/B C D/;
use if $] >= 5.009005, 'mro', 'dfs';


sub test { ::ok(++$order==1,"test A"); $_[0]->NEXT::UNSEEN::ACTUAL::test;}

package B;
@ISA = qw/D C/;
our @ISA = qw/D C/;
use if $] >= 5.009005, 'mro', 'dfs';
sub test { ::ok(++$order==2,"test B"); $_[0]->NEXT::ACTUAL::UNSEEN::test;}

package C;
@ISA = qw/D/;
our @ISA = qw/D/;
use if $] >= 5.009005, 'mro', 'dfs';

sub test { ::ok(++$order==4,"test C"); $_[0]->NEXT::UNSEEN::ACTUAL::test;}

package D;
use if $] >= 5.009005, 'mro', 'dfs';

sub test { ::ok(++$order==3,"test D"); $_[0]->NEXT::ACTUAL::UNSEEN::test;}

Expand Down
2 changes: 2 additions & 0 deletions cpan/NEXT/t/dynamically_scoped_regex_vars.t
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use strict;
use warnings;
use Test::More tests => 7;

BEGIN { use_ok('NEXT') };
Expand Down
22 changes: 13 additions & 9 deletions cpan/NEXT/t/next.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
BEGIN { print "1..27\n"; }

use strict;
use warnings;
use NEXT;

print "1..27\n";
print "ok 1\n";

package A;
Expand All @@ -11,6 +13,7 @@ sub A::evaled { eval { $_[0]->NEXT::evaled(); return 'evaled' } }

package B;
use base qw( A );
our $AUTOLOAD;
sub B::AUTOLOAD { return ( 9, $_[0]->NEXT::AUTOLOAD() )
if $AUTOLOAD =~ /.*(missing_method|secondary)/ }
sub B::DESTROY { $_[0]->NEXT::DESTROY() }
Expand All @@ -19,17 +22,17 @@ package C;
sub C::DESTROY { print "ok 25\n"; $_[0]->NEXT::DESTROY() }

package D;
@D::ISA = qw( B C E );
our @ISA = qw( B C E );
sub D::method { return ( 2, $_[0]->NEXT::method() ) }
sub D::AUTOLOAD { return ( 8, $_[0]->NEXT::AUTOLOAD() ) }
sub D::DESTROY { print "ok 24\n"; $_[0]->NEXT::DESTROY() }
sub D::oops { $_[0]->NEXT::method() }
sub D::secondary { return ( 17, 18, map { $_+10 } $_[0]->NEXT::secondary() ) }

package E;
@E::ISA = qw( F G );
our @ISA = qw( F G );
sub E::method { return ( 4, $_[0]->NEXT::method(), $_[0]->NEXT::method() ) }
sub E::AUTOLOAD { return ( 10, $_[0]->NEXT::AUTOLOAD() )
sub E::AUTOLOAD { return ( 10, $_[0]->NEXT::AUTOLOAD() )
if $AUTOLOAD =~ /.*(missing_method|secondary)/ }
sub E::DESTROY { print "ok 26\n"; $_[0]->NEXT::DESTROY() }

Expand Down Expand Up @@ -76,7 +79,7 @@ eval {
print "ok 13\n";

# NAMED METHOD CAN'T REDISPATCH TO AUTOLOAD'ED METHOD (ok 14)
eval {
eval {
*C::method = sub{ $_[0]->NEXT::AUTOLOAD() };
*C::method = *C::method;
eval { $obj->method(); } && print "not ";
Expand All @@ -85,11 +88,11 @@ print "ok 14\n";

# BASE CLASS METHODS ONLY REDISPATCHED WITHIN HIERARCHY (ok 15..16)
my $ob2 = bless {}, "B";
@val = $ob2->method();
my @val = $ob2->method();
print "not " unless @val==1 && $val[0]==3;
print "ok 15\n";

@val = $ob2->missing_method();
@val = $ob2->missing_method();
print "not " unless @val==1 && $val[0]==9;
print "ok 16\n";

Expand All @@ -107,12 +110,13 @@ print "ok 22\n";
# TEST WITH CONSTANTS (23)

package Hay;
@ISA = 'Bee';
our @ISA = 'Bee';
sub foo { return shift->NEXT::foo }
package Bee;
use constant foo => 3;
package main;
print "not " unless Hay->foo eq '3';
print "ok 23\n";

# CAN REDISPATCH DESTRUCTORS (ok 24..27)

# CAN REDISPATCH DESTRUCTORS (ok 23..26)
26 changes: 20 additions & 6 deletions cpan/NEXT/t/unseen.t
Original file line number Diff line number Diff line change
@@ -1,26 +1,35 @@
use strict;
use warnings;
use Test::More tests => 7;

BEGIN { use_ok('NEXT') };
my $order = 0;

package A;
@ISA = qw/B C D/;
our @ISA = qw/B C D/;
use if $] >= 5.009005, 'mro', 'dfs';

sub test { ::ok(++$order==1,"test A"); $_[0]->NEXT::UNSEEN::test; 1}

package B;
@ISA = qw/D C/;

our @ISA = qw/D C/;
use if $] >= 5.009005, 'mro', 'dfs';
sub test { ::ok(++$order==2,"test B"); $_[0]->NEXT::UNSEEN::test; 1}

package C;
@ISA = qw/D/;
our @ISA = qw/D/;
use if $] >= 5.009005, 'mro', 'dfs';

sub test { ::ok(++$order==4,"test C"); $_[0]->NEXT::UNSEEN::test; 1}

package D;
use if $] >= 5.009005, 'mro', 'dfs';

sub test { ::ok(++$order==3,"test D"); $_[0]->NEXT::UNSEEN::test; 1}

package main;
use if $] >= 5.009005, 'mro', 'dfs';

my $foo = {};

Expand All @@ -31,16 +40,21 @@ eval{ $foo->test }
: fail("Shouldn't die on missing ancestor");

package Diamond::Base;
use if $] >= 5.009005, 'mro', 'dfs';
my $seen;
sub test {
$seen++ ? ::fail("Can't visit inherited test twice")
: ::pass("First diamond is okay");
shift->NEXT::UNSEEN::test;
}

package Diamond::Left; @ISA = qw[Diamond::Base];
package Diamond::Right; @ISA = qw[Diamond::Base];
package Diamond::Top; @ISA = qw[Diamond::Left Diamond::Right];
package Diamond::Left; our @ISA = qw[Diamond::Base];
use if $] >= 5.009005, 'mro', 'dfs';
package Diamond::Right; our @ISA = qw[Diamond::Base];
use if $] >= 5.009005, 'mro', 'dfs';
package Diamond::Top; our @ISA = qw[Diamond::Left Diamond::Right];
use if $] >= 5.009005, 'mro', 'dfs';


package main;

Expand Down

0 comments on commit ff9a896

Please sign in to comment.