1#! perl 2 3# Verify that loading Getopt::Long does not load Getopt::Long::Parser 4# until/unless used. 5 6BEGIN { 7 if( $ENV{PERL_CORE} ) { 8 chdir 't'; 9 @INC = ('../lib', 'lib'); 10 } 11 else { 12 unshift @INC, 't/lib'; 13 } 14} 15 16use strict; 17use warnings; 18use Test::More tests => 4; 19 20use_ok("Getopt::Long"); 21 22# Getopt::Long::Parser should not be loaded. 23ok( !defined $Getopt::Long::Parser::VERSION, 24 "Getopt::Long did not load Parser" ); 25 26# Create a parser object. 27my $p = Getopt::Long::Parser->new; 28 29# Getopt::Long::Parser should now be loaded. 30ok( defined $Getopt::Long::Parser::VERSION, 31 "Parser $Getopt::Long::Parser::VERSION loaded" ); 32 33# Verify version match. 34is( $Getopt::Long::VERSION, $Getopt::Long::Parser::VERSION, 35 "Parser version matches" ); 36 37diag( "Testing Getopt::Long $Getopt::Long::VERSION, Perl $], $^X" ); 38