- 论坛徽章:
- 0
|
程序中使用LWP模块,在win2003上执行没问题,在win7下安装相同的perl解释器就会报错,报错为:- Global symbol "%Config" requires explicit package name at C:/Perl/lib/Time/Local.pm line 36.
- Global symbol "%Config" requires explicit package name at C:/Perl/lib/Time/Local.pm line 39.
- Compilation failed in require at C:/Perl/site/lib/HTTP/Date.pm line 11.
- Compilation failed in require at C:/Perl/lib/LWP/UserAgent.pm line 12.
- BEGIN failed--compilation aborted at C:/Perl/lib/LWP/UserAgent.pm line 12.
- Compilation failed in require at C:/Perl/lib/LWP.pm line 7.
- Compilation failed in require at LWP2.pl line 4.
- BEGIN failed--compilation aborted at LWP2.pl line 4.
复制代码 看了下C:/Perl/lib/Time/Local.pm这个PM包,不明白%Config的用法,请各位指教。- package Time::Local;
- require Exporter;
- use Carp;
- use Config;
- use strict;
- use vars qw( $VERSION @ISA @EXPORT @EXPORT_OK );
- $VERSION = '1.2300';
- @ISA = qw( Exporter );
- @EXPORT = qw( timegm timelocal );
- @EXPORT_OK = qw( timegm_nocheck timelocal_nocheck );
- my @MonthDays = ( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 );
- # Determine breakpoint for rolling century
- my $ThisYear = ( localtime() )[5];
- my $Breakpoint = ( $ThisYear + 50 ) % 100;
- my $NextCentury = $ThisYear - $ThisYear % 100;
- $NextCentury += 100 if $Breakpoint < 50;
- my $Century = $NextCentury - 100;
- my $SecOff = 0;
- my ( %Options, %Cheat );
- use constant SECS_PER_MINUTE => 60;
- use constant SECS_PER_HOUR => 3600;
- use constant SECS_PER_DAY => 86400;
- my $MaxDay;
- if ($] < 5.012000) {
- my $MaxInt;
- if ( $^O eq 'MacOS' ) {
- # time_t is unsigned...
- $MaxInt = ( 1 << ( 8 * $Config{ivsize} ) ) - 1;
- }
- else {
- $MaxInt = ( ( 1 << ( 8 * $Config{ivsize} - 2 ) ) - 1 ) * 2 + 1;
- }
- $MaxDay = int( ( $MaxInt - ( SECS_PER_DAY / 2 ) ) / SECS_PER_DAY ) - 1;
- }
- else {
- # recent localtime()'s limit is the year 2**31
- $MaxDay = 365 * (2**31);
- }
- ......
复制代码 |
|