The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
__END__

# Error - not predeclaring a sub
Fred 1,2 ;
sub Fred {}
EXPECT
Number found where operator expected at - line 3, near "Fred 1"
	(Do you need to predeclare Fred?)
syntax error at - line 3, near "Fred 1"
Execution of - aborted due to compilation errors.
########

# Error - not predeclaring a sub in time
Fred 1,2 ;
use subs qw( Fred ) ;
sub Fred {}
EXPECT
Number found where operator expected at - line 3, near "Fred 1"
	(Do you need to predeclare Fred?)
syntax error at - line 3, near "Fred 1"
BEGIN not safe after errors--compilation aborted at - line 4.
########

# AOK
use subs qw( Fred) ;
Fred 1,2 ;
sub Fred { print $_[0] + $_[1], "\n" }
EXPECT
3
########

# override a built-in function
use subs qw( open ) ;
open 1,2 ;
sub open { print $_[0] + $_[1], "\n" }
EXPECT
3
########

# override a built-in function, call after definition
use subs qw( open ) ;
sub open { print $_[0] + $_[1], "\n" }
open 1,2 ;
EXPECT
3
########

# override a built-in function, call with ()
use subs qw( open ) ;
open (1,2) ;
sub open { print $_[0] + $_[1], "\n" }
EXPECT
3
########

# override a built-in function, call with () after definition
use subs qw( open ) ;
sub open { print $_[0] + $_[1], "\n" }
open (1,2) ;
EXPECT
3
########

--FILE-- abc
Fred 1,2 ;
1;
--FILE--
use subs qw( Fred ) ;
require "./abc" ;
sub Fred { print $_[0] + $_[1], "\n" }
EXPECT
3
########

# check that it isn't affected by block scope
{
    use subs qw( Fred ) ;
}
Fred 1, 2;
sub Fred { print $_[0] + $_[1], "\n" }
EXPECT
3
########

# Error - not predeclaring a sub
use utf8;
use open qw( :utf8 :std );
Frèd 1,2 ;
sub Frèd {}
EXPECT
Number found where operator expected at - line 5, near "Frèd 1"
	(Do you need to predeclare Frèd?)
syntax error at - line 5, near "Frèd 1"
Execution of - aborted due to compilation errors.
########

# Error - not predeclaring a sub in time
use utf8;
use open qw( :utf8 :std );
ふれど 1,2 ;
use subs qw( ふれど ) ;
sub ふれど {}
EXPECT
Number found where operator expected at - line 5, near "ふれど 1"
	(Do you need to predeclare ふれど?)
syntax error at - line 5, near "ふれど 1"
BEGIN not safe after errors--compilation aborted at - line 6.