Skip Menu |

This queue is for tickets about the AppConfig CPAN distribution.

Report information
The Basics
Id: 19053
Status: open
Priority: 0/
Queue: AppConfig

People
Owner: Nobody in particular
Requestors: ggoebel [...] goebel.ws
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 1.56
Fixed in: (no value)



Subject: AppConfig 1.56 make test failure in t/file
AppConfig 1.56 make test fails on perl 5.8.8 compiled with Visual C++ Toolkit 2003. Let me know if there's anything I can do to help. cheers, Garrett [- make test results -] Running make test Microsoft (R) Program Maintenance Utility Version 7.00.8882 Copyright (C) Microsoft Corp 1988-2000. All rights reserved. C:\perl\5.8.8\bin\MSWin32-x86-multi-thread\perl.exe "-MExtUtils::Command::MM" "-e" "test_har ness(0, 'blib\lib', 'blib\arch')" t/*.t t/appconfig....ok t/args.........ok t/block........ok t/cgi..........ok t/compact......ok t/const........ok t/default......ok t/file.........ok 1/43Usage: POSIX::getpwuid(uid) at lib/AppConfig/File.pm line 410 # Looks like you planned 43 tests but only ran 3. # Looks like your test died just after 3. t/file.........dubious Test returned status 255 (wstat 65280, 0xff00) DIED. FAILED tests 4-43 Failed 40/43 tests, 6.98% okay [- perl -V results -] Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Platform: osname=MSWin32, osvers=5.1, archname=MSWin32-x86-multi-thread uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cl', ccflags ='-nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DE S_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX', optimize='-MD -Zi -DNDEBUG -O1', cppflags='-DWIN32' ccversion='13.10.3077', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf -libpath:"c:\perl\5.8.8\lib\MSWi n32-x86-multi-thread\CORE" -machine:x86' libpth="C:\progra~1\Micros~2\lib" libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib sh ell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib od bc32.lib odbccp32.lib msvcrt.lib perllibs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.li b shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.li b odbc32.lib odbccp32.lib msvcrt.lib libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl58.lib gnulibc_version='' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -opt:ref,icf -libpath:"c:\perl\5.8 .8\lib\MSWin32-x86-multi-thread\CORE" -machine:x86' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS PERL_MALLOC_WRAP PL_OP_SLAB_ALLOC USE_ITHREADS USE_LARGE_FILES USE_PERLIO Built under MSWin32 Compiled at Apr 25 2006 03:25:10 @INC: c:/perl/5.8.8/lib/MSWin32-x86-multi-thread c:/perl/5.8.8/lib c:/perl/site/5.8.8/lib/MSWin32-x86-multi-thread c:/perl/site/5.8.8/lib .
From: Andrew Melo
I'm not sure how to diff the files properly (my first bugfix :), but changing these two files worked out well. in AppConfig::Sys the getpwuid call for win32 is replaced with getlogin(). That's strange, because the module is extracting out a home directory, and getlogin() provides the user name. I replaced that with the function from File::HomeDir which should let this snippet work accross all platforms. There was a small testing error in file.t that I changed too. There is a test to see if "~/" was the same as $ENV{HOME}. Problem is, a lot of times under windows, $ENV{HOME} is unset, so even if the substitution worked out properly, the test failed. I added a skip case if $ENV{HOME} was undefined. thanks- Andrew andrew.melo@gmail.com On Wed May 03 10:15:22 2006, guest wrote: Show quoted text
> AppConfig 1.56 make test fails on perl 5.8.8 compiled with Visual C++ > Toolkit 2003. > > Let me know if there's anything I can do to help. > > cheers, > > Garrett > > > [- make test results -] > > Running make test > > Microsoft (R) Program Maintenance Utility Version 7.00.8882 > Copyright (C) Microsoft Corp 1988-2000. All rights reserved. > > C:\perl\5.8.8\bin\MSWin32-x86-multi-thread\perl.exe > "-MExtUtils::Command::MM" "-e" "test_har > ness(0, 'blib\lib', 'blib\arch')" t/*.t > t/appconfig....ok > t/args.........ok > t/block........ok > t/cgi..........ok > t/compact......ok > t/const........ok > t/default......ok > t/file.........ok 1/43Usage: POSIX::getpwuid(uid) at > lib/AppConfig/File.pm line 410 > # Looks like you planned 43 tests but only ran 3. > # Looks like your test died just after 3. > t/file.........dubious > Test returned status 255 (wstat 65280, 0xff00) > DIED. FAILED tests 4-43 > Failed 40/43 tests, 6.98% okay > > > [- perl -V results -] > Summary of my perl5 (revision 5 version 8 subversion 8) configuration: > Platform: > osname=MSWin32, osvers=5.1, archname=MSWin32-x86-multi-thread > uname='' > config_args='undef' > hint=recommended, useposix=true, d_sigaction=undef > usethreads=define use5005threads=undef useithreads=define > usemultiplicity=define > useperlio=define d_sfio=undef uselargefiles=define usesocks=undef > use64bitint=undef use64bitall=undef uselongdouble=undef > usemymalloc=n, bincompat5005=undef > Compiler: > cc='cl', ccflags ='-nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 > -D_CONSOLE -DNO_STRICT -DHAVE_DE > S_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO > -DPERL_MSVCRT_READFIX', > optimize='-MD -Zi -DNDEBUG -O1', > cppflags='-DWIN32' > ccversion='13.10.3077', gccversion='', gccosandvers='' > intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 > d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10 > ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', > lseeksize=8 > alignbytes=8, prototype=define > Linker and Libraries: > ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf > -libpath:"c:\perl\5.8.8\lib\MSWi > n32-x86-multi-thread\CORE" -machine:x86' > libpth="C:\progra~1\Micros~2\lib" > libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib > comdlg32.lib advapi32.lib sh > ell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib > mpr.lib winmm.lib version.lib od > bc32.lib odbccp32.lib msvcrt.lib > perllibs= oldnames.lib kernel32.lib user32.lib gdi32.lib > winspool.lib comdlg32.lib advapi32.li > b shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib > mpr.lib winmm.lib version.li > b odbc32.lib odbccp32.lib msvcrt.lib > libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl58.lib > gnulibc_version='' > Dynamic Linking: > dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' > cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug > -opt:ref,icf -libpath:"c:\perl\5.8 > .8\lib\MSWin32-x86-multi-thread\CORE" -machine:x86' > > > Characteristics of this binary (from libperl): > Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT > PERL_IMPLICIT_SYS PERL_MALLOC_WRAP > PL_OP_SLAB_ALLOC USE_ITHREADS USE_LARGE_FILES > USE_PERLIO > Built under MSWin32 > Compiled at Apr 25 2006 03:25:10 > @INC: > c:/perl/5.8.8/lib/MSWin32-x86-multi-thread > c:/perl/5.8.8/lib > c:/perl/site/5.8.8/lib/MSWin32-x86-multi-thread > c:/perl/site/5.8.8/lib > .
#======================================================================== # # t/file.t # # AppConfig::File test file. # # Written by Andy Wardley <abw@cre.canon.co.uk> # # Copyright (C) 1998 Canon Research Centre Europe Ltd. # All Rights Reserved. # # This is free software; you can redistribute it and/or modify it # under the same terms as Perl itself. # #------------------------------------------------------------------------ # # TODO # # * test PEDANTIC option # # * test EXPAND_WARN option # #======================================================================== use strict; use vars qw($loaded); use lib qw( ../lib ./lib ); use Test::More tests => 43; use warnings; use AppConfig qw(:expand :argcount); use AppConfig::File; ok(1); #------------------------------------------------------------------------ # create new AppConfig::State and AppConfig::File objects #------------------------------------------------------------------------ my $state = AppConfig::State->new({ CREATE => '^(?:define|here)_', GLOBAL => { EXPAND => EXPAND_ALL, ARGCOUNT => ARGCOUNT_ONE, }, }, 'html', 'same', 'split', 'title', 'ident', 'cash' => { EXPAND => EXPAND_NONE }, # ignore '$' in cash 'hdir' => { EXPAND => EXPAND_VAR }, # expand only $vars 'verbose' => { ARGCOUNT => ARGCOUNT_NONE }, # simple flags.. 'cruft' => { ARGCOUNT => ARGCOUNT_NONE, DEFAULT => 1, }, 'debug' => { ARGCOUNT => ARGCOUNT_NONE, DEFAULT => 1, }, 'chance' => { ARGCOUNT => ARGCOUNT_NONE, DEFAULT => 1, }, 'hope' => { ARGCOUNT => ARGCOUNT_NONE, DEFAULT => 1, }, 'drink' => { ARGCOUNT => ARGCOUNT_LIST, }, 'name' => { ARGCOUNT => ARGCOUNT_HASH, }, 'here_empty' => { ARGCOUNT => ARGCOUNT_NONE, }, 'here_hash' => { ARGCOUNT => ARGCOUNT_HASH, }, ); # turn debugging on to trigger debugging in $cfgfile #$state->_debug(1); my $cfgfile = AppConfig::File->new($state); # AppConfig::State can be turned off, AppConfig::File debugging remains on. #$state->_debug(0); ok( defined $state, 'state defined' ); ok( defined $cfgfile, 'cfgfile defined' ); ok( $cfgfile->parse(\*DATA), 'parsed' ); #------------------------------------------------------------------------ # test variable values got set with correct expansion #------------------------------------------------------------------------ # html has no embedded variables ok( $state->html() eq 'public_html' ); # cash should *not* be expanded (EXPAND_NONE) to protect '$' ok( $state->cash() eq 'I won $200!' ); # hdir expands variables ($html) but not uids (~) ok( $state->hdir() eq '~/public_html' ); # see if "[~/$html]" matches "[${HOME}/$html]". It may fail if your # platform doesn't provide getpwuid(). See AppConfig::Sys for details. # --But, if ${HOME} isn't set (win32) then, we should skip it- AMM SKIP: { skip "Home environment variable isn't set", 1 unless (defined $ENV{HOME}); my ($one, $two) = $state->same() =~ / \[ ( [^\]]+ ) \] \s+=>\s+ \[ ( [^\]]+ ) \]/gx; is( $one, $two, 'one is two' ); }; # test that "split" came out the same as "same" is( $state->same(), $state->split(), 'same split' ); # test that "verbose" got set to 1 when no parameter was provided is( $state->verbose(), 1, 'verbose' ); # test that debug got turned off by explicit (debug = 0) ok( ! $state->debug(), 'not debuggin' ); # test that cruft got turned off by "nocruft" ok( ! $state->cruft(), 'not crufty' ); ok( $state->nocruft(), 'nocruft' ); # test that chance got turned on by "nochance = 0" ok( $state->chance(), 'there is a chance' ); ok( ! $state->nochance(), 'there is not no chance' ); # test that hope got turned on by "nohope = off" ok( $state->hope(), 'there is hope' ); ok( ! $state->nohope(), 'there is not no hope' ); # check auto-creation of variables and variable expansion of # [block] variable is( $state->define_user(), 'abw', 'user is abw'); is( $state->define_home(), '/home/abw', 'home is /home/abw' ); is( $state->define_chez(), '/chez/abw', 'chez is /chez/abw' ); is( $state->define_choz(), 'foo#bar', 'choz is set' ); is( $state->define_chuz(), '^#', 'chuz is set' ); #21 - #22: test $state->varlist() without strip option my (%set, $expect, $got); %set = $state->varlist('^define_'); $expect = 'define_chaz=/$chez/#chaz, define_chez=/chez/abw, define_choz=foo#bar, define_chuz=^#, define_home=/home/abw, define_user=abw'; $got = join(', ', map { "$_=$set{$_}" } sort keys %set); is( scalar keys %set, 6, 'five keys' ); is( $expect, $got, 'varlist' ); #23 - #24: test $state->varlist() with strip option %set = $state->varlist('^define_', 1); $expect = 'chaz=/$chez/#chaz, chez=/chez/abw, choz=foo#bar, chuz=^#, home=/home/abw, user=abw'; $got = join(', ', map { "$_=$set{$_}" } sort keys %set); is( scalar keys %set, 6, 'five stripped keys'); is( $expect, $got, 'stripped varlist' ); #25 - #27: test ARGCOUNT_LIST my $drink = $state->drink(); is( $drink->[0], 'coffee', 'coffee'); is( $drink->[1], 'beer', 'beer'); is( $drink->[2], 'water', 'water'); #28 - #31: test ARGCOUNT_HASH my $name = $state->name(); my $crew = join(", ", sort keys %$name); ok( $crew eq "abw, mim, mrp" ); ok( $name->{'abw'} eq 'Andy' ); ok( $name->{'mrp'} eq 'Martin' ); ok( $name->{'mim'} eq 'Man in the Moon' ); #32 - #33: test quoting ok( $state->title eq "Lord of the Rings"); ok( $state->ident eq "Keeper of the Scrolls"); # test \$ and \# suppression is( $state->define_chaz(), '/$chez/#chaz', 'chaz defined' ); # test whitespace required before '#' is( $state->define_choz(), 'foo#bar', 'choz defined' ); is( $state->define_chuz(), '^#', 'chuz defined' ); #39 - #42: test here-doc ok( ! $state->here_empty(), 'empty here-doc'); is( $state->here_linebreaks(), <<HERE, 'line breaks'); white spaces are preserved in here-doc, except the last linebreak. HERE is( $state->here_quote(), '<<NOT_A_HERE_DOC_if_in_quotes', 'heredoc in quotes'); is( $state->here_eof(), "parse() reads to eof if the boundary string is absent.\n", 'heredoc with EOF'); is_deeply( $state->here_hash(), { 'key1' => 'value 1', 'key2' => 'value 2', 'key3' => "multi-line\nvalue 3", '"key 4"' => "<<AA\n recursive here-doc not supported.\nAA", }, 'hash with here-doc values'); #======================================================================== # the rest of the file comprises the sample configuration information # that gets read by parse() #======================================================================== __DATA__ # lines starting with '#' are regarded as comments and are ignored html = public_html cash = I won $200! hdir = ~/$html same = [~/$html] => [${HOME}/$html] verbose debug = 0 nocruft # this next one should turn chance ON (equivalent to "chance = 1") nochance = 0 nohope = off # the next line has a continutation, but should be treated the same split = [~/$html] => \ [${HOME}/$html] # test list definitions drink coffee drink beer drink water # test hash definitions name abw = Andy name mrp = Martin name = mim = "Man in the Moon" # test quoting title = "Lord of the Rings" ident = 'Keeper of the Scrolls' [define] user = abw # this is a comment home = /home/$user chez = /chez/$define_user chaz = /\$chez/\#chaz # this is also a comment choz = foo#bar # this is a comment, but the '# bar' part wasn't chuz = ^# # so is this, nor was that [here] empty = <<BAR BAR linebreaks =<<'BAR' white spaces are preserved in here-doc, except the last linebreak. BAR quote ='<<NOT_A_HERE_DOC_if_in_quotes' hash = key1 =<<--- value 1 --- hash = key2= "value 2" # Putting hash keys in here doc is ugly, not recommended, but supported hash = <<--- key3 = multi-line value 3 --- hash = <<=== "key 4" = <<AA recursive here-doc not supported. AA === eof = <<--- parse() reads to eof if the boundary string is absent.
#============================================================================ # # AppConfig::Sys.pm # # Perl5 module providing platform-specific information and operations as # required by other AppConfig::* modules. # # Written by Andy Wardley <abw@wardley.org> # # Copyright (C) 1997-2003 Andy Wardley. All Rights Reserved. # Copyright (C) 1997,1998 Canon Research Centre Europe Ltd. # # $Id: Sys.pm,v 1.61 2004/02/04 10:11:23 abw Exp $ # #============================================================================ package AppConfig::Sys; require 5.004; use strict; use vars qw( $VERSION $AUTOLOAD $OS %CAN %METHOD); use POSIX qw( getpwnam ); use File::HomeDir; $VERSION = sprintf("%d.%02d", q$Revision: 1.61 $ =~ /(\d+)\.(\d+)/); BEGIN { # define the methods that may be available # changed this to work under windows properly. should also work on other # platforms - AMM $METHOD{ getpwuid } = sub { return wantarray() ? ( (undef) x 7, File::HomeDir->my_home ) : File::HomeDir->my_home; }; # getpwnam doesn't have much of an analog in win32 if($^O =~ m/win32/i) { $METHOD{ getpwnam } = sub { die("Can't getpwnam on win32"); }; } else { $METHOD{ getpwnam } = sub { getpwnam( defined $_[0] ? shift : '' ); }; } # try out each METHOD to see if it's supported on this platform; # it's important we do this before defining AUTOLOAD which would # otherwise catch the unresolved call foreach my $method (keys %METHOD) { eval { &{ $METHOD{ $method } }() }; $CAN{ $method } = ! $@; } } #------------------------------------------------------------------------ # new($os) # # Module constructor. An optional operating system string may be passed # to explicitly define the platform type. # # Returns a reference to a newly created AppConfig::Sys object. #------------------------------------------------------------------------ sub new { my $class = shift; my $self = { METHOD => \%METHOD, CAN => \%CAN, }; bless $self, $class; $self->_configure(@_); return $self; } #------------------------------------------------------------------------ # AUTOLOAD # # Autoload function called whenever an unresolved object method is # called. If the method name relates to a METHODS entry, then it is # called iff the corresponding CAN_$method is set true. If the # method name relates to a CAN_$method value then that is returned. #------------------------------------------------------------------------ sub AUTOLOAD { my $self = shift; my $method; # splat the leading package name ($method = $AUTOLOAD) =~ s/.*:://; # ignore destructor $method eq 'DESTROY' && return; # can_method() if ($method =~ s/^can_//i && exists $self->{ CAN }->{ $method }) { return $self->{ CAN }->{ $method }; } # method() elsif (exists $self->{ METHOD }->{ $method }) { if ($self->{ CAN }->{ $method }) { return &{ $self->{ METHOD }->{ $method } }(@_); } else { return undef; } } # variable elsif (exists $self->{ uc $method }) { return $self->{ uc $method }; } else { warn("AppConfig::Sys->", $method, "(): no such method or variable\n"); } return undef; } #------------------------------------------------------------------------ # _configure($os) # # Uses the first parameter, $os, the package variable $AppConfig::Sys::OS, # the value of $^O, or as a last resort, the value of # $Config::Config('osname') to determine the current operating # system/platform. Sets internal variables accordingly. #------------------------------------------------------------------------ sub _configure { my $self = shift; # operating system may be defined as a parameter or in $OS my $os = shift || $OS; # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # The following was lifted (and adapated slightly) from Lincoln Stein's # CGI.pm module, version 2.36... # # FIGURE OUT THE OS WE'RE RUNNING UNDER # Some systems support the $^O variable. If not # available then require() the Config library unless ($os) { unless ($os = $^O) { require Config; $os = $Config::Config{'osname'}; } } if ($os =~ /win32/i) { $os = 'WINDOWS'; } elsif ($os =~ /vms/i) { $os = 'VMS'; } elsif ($os =~ /mac/i) { $os = 'MACINTOSH'; } elsif ($os =~ /os2/i) { $os = 'OS2'; } else { $os = 'UNIX'; } # The path separator is a slash, backslash or semicolon, depending # on the platform. my $ps = { UNIX => '/', OS2 => '\\', WINDOWS => '\\', MACINTOSH => ':', VMS => '\\' }->{ $os }; # # Thanks Lincoln! # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $self->{ OS } = $os; $self->{ PATHSEP } = $ps; } #------------------------------------------------------------------------ # _dump() # # Dump internals for debugging. #------------------------------------------------------------------------ sub _dump { my $self = shift; print "=" x 71, "\n"; print "Status of AppConfig::Sys (Version $VERSION) object: $self\n"; print " Operating System : ", $self->{ OS }, "\n"; print " Path Separator : ", $self->{ PATHSEP }, "\n"; print " Available methods :\n"; foreach my $can (keys %{ $self->{ CAN } }) { printf "%20s : ", $can; print $self->{ CAN }->{ $can } ? "yes" : "no", "\n"; } print "=" x 71, "\n"; } 1; __END__ =head1 NAME AppConfig::Sys - Perl5 module defining platform-specific information and methods for other AppConfig::* modules. =head1 SYNOPSIS use AppConfig::Sys; my $sys = AppConfig::Sys->new(); @fields = $sys->getpwuid($userid); @fields = $sys->getpwnam($username); =head1 OVERVIEW AppConfig::Sys is a Perl5 module provides platform-specific information and operations as required by other AppConfig::* modules. AppConfig::Sys is distributed as part of the AppConfig bundle. =head1 DESCRIPTION =head2 USING THE AppConfig::Sys MODULE To import and use the AppConfig::Sys module the following line should appear in your Perl script: use AppConfig::Sys; AppConfig::Sys is implemented using object-oriented methods. A new AppConfig::Sys object is created and initialised using the AppConfig::Sys->new() method. This returns a reference to a new AppConfig::Sys object. my $sys = AppConfig::Sys->new(); This will attempt to detect your operating system and create a reference to a new AppConfig::Sys object that is applicable to your platform. You may explicitly specify an operating system name to override this automatic detection: $unix_sys = AppConfig::Sys->new("Unix"); Alternatively, the package variable $AppConfig::Sys::OS can be set to an operating system name. The valid operating system names are: Win32, VMS, Mac, OS2 and Unix. They are not case-specific. =head2 AppConfig::Sys METHODS AppConfig::Sys defines the following methods: =over 4 =item getpwnam() Calls the system function getpwnam() if available and returns the result. Returns undef if not available. The can_getpwnam() method can be called to determine if this function is available. =item getpwuid() Calls the system function getpwuid() if available and returns the result. Returns undef if not available. The can_getpwuid() method can be called to determine if this function is available. =item =head1 AUTHOR Andy Wardley, E<lt>abw@wardley.orgE<gt> =head1 REVISION $Revision: 1.61 $ =head1 COPYRIGHT Copyright (C) 1997-2004 Andy Wardley. All Rights Reserved. Copyright (C) 1997,1998 Canon Research Centre Europe Ltd. This module is free software; you can redistribute it and/or modify it under the term of the Perl Artistic License. =head1 SEE ALSO AppConfig, AppConfig::File =cut
From: Andrew Melo
Okay, I made diffs from the files above against the current rev. Hopefully they work right :) -Andrew On Wed May 03 10:15:22 2006, guest wrote: Show quoted text
> AppConfig 1.56 make test fails on perl 5.8.8 compiled with Visual C++ > Toolkit 2003. > > Let me know if there's anything I can do to help. > > cheers, > > Garrett > > > [- make test results -] > > Running make test > > Microsoft (R) Program Maintenance Utility Version 7.00.8882 > Copyright (C) Microsoft Corp 1988-2000. All rights reserved. > > C:\perl\5.8.8\bin\MSWin32-x86-multi-thread\perl.exe > "-MExtUtils::Command::MM" "-e" "test_har > ness(0, 'blib\lib', 'blib\arch')" t/*.t > t/appconfig....ok > t/args.........ok > t/block........ok > t/cgi..........ok > t/compact......ok > t/const........ok > t/default......ok > t/file.........ok 1/43Usage: POSIX::getpwuid(uid) at > lib/AppConfig/File.pm line 410 > # Looks like you planned 43 tests but only ran 3. > # Looks like your test died just after 3. > t/file.........dubious > Test returned status 255 (wstat 65280, 0xff00) > DIED. FAILED tests 4-43 > Failed 40/43 tests, 6.98% okay > > > [- perl -V results -] > Summary of my perl5 (revision 5 version 8 subversion 8) configuration: > Platform: > osname=MSWin32, osvers=5.1, archname=MSWin32-x86-multi-thread > uname='' > config_args='undef' > hint=recommended, useposix=true, d_sigaction=undef > usethreads=define use5005threads=undef useithreads=define > usemultiplicity=define > useperlio=define d_sfio=undef uselargefiles=define usesocks=undef > use64bitint=undef use64bitall=undef uselongdouble=undef > usemymalloc=n, bincompat5005=undef > Compiler: > cc='cl', ccflags ='-nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 > -D_CONSOLE -DNO_STRICT -DHAVE_DE > S_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO > -DPERL_MSVCRT_READFIX', > optimize='-MD -Zi -DNDEBUG -O1', > cppflags='-DWIN32' > ccversion='13.10.3077', gccversion='', gccosandvers='' > intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 > d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10 > ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', > lseeksize=8 > alignbytes=8, prototype=define > Linker and Libraries: > ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf > -libpath:"c:\perl\5.8.8\lib\MSWi > n32-x86-multi-thread\CORE" -machine:x86' > libpth="C:\progra~1\Micros~2\lib" > libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib > comdlg32.lib advapi32.lib sh > ell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib > mpr.lib winmm.lib version.lib od > bc32.lib odbccp32.lib msvcrt.lib > perllibs= oldnames.lib kernel32.lib user32.lib gdi32.lib > winspool.lib comdlg32.lib advapi32.li > b shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib > mpr.lib winmm.lib version.li > b odbc32.lib odbccp32.lib msvcrt.lib > libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl58.lib > gnulibc_version='' > Dynamic Linking: > dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' > cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug > -opt:ref,icf -libpath:"c:\perl\5.8 > .8\lib\MSWin32-x86-multi-thread\CORE" -machine:x86' > > > Characteristics of this binary (from libperl): > Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT > PERL_IMPLICIT_SYS PERL_MALLOC_WRAP > PL_OP_SLAB_ALLOC USE_ITHREADS USE_LARGE_FILES > USE_PERLIO > Built under MSWin32 > Compiled at Apr 25 2006 03:25:10 > @INC: > c:/perl/5.8.8/lib/MSWin32-x86-multi-thread > c:/perl/5.8.8/lib > c:/perl/site/5.8.8/lib/MSWin32-x86-multi-thread > c:/perl/site/5.8.8/lib > .
22,23c22,23 < use POSIX qw( getpwnam ); < use File::HomeDir; --- > use POSIX qw( getpwnam getpwuid ); > 26c26 < BEGIN { --- > BEGIN { 28,34c28,32 < < # changed this to work under windows properly. should also work on other < # platforms - AMM < $METHOD{ getpwuid } = sub { < return wantarray() < ? ( (undef) x 7, File::HomeDir->my_home ) < : File::HomeDir->my_home; --- > if($^O =~ m/win32/i) { > $METHOD{ getpwuid } = sub { > return wantarray() > ? ( (undef) x 7, getlogin() ) > : getlogin(); 36,37d33 < # getpwnam doesn't have much of an analog in win32 < if($^O =~ m/win32/i) { 41,44c37,45 < } else { < $METHOD{ getpwnam } = sub { < getpwnam( defined $_[0] ? shift : '' ); < }; --- > } > else > { > $METHOD{ getpwuid } = sub { > getpwuid( defined $_[0] ? shift : $< ); > }; > $METHOD{ getpwnam } = sub { > getpwnam( defined $_[0] ? shift : '' ); > };
112,114d111 < # --But, if ${HOME} isn't set (win32) then, we should skip it- AMM < SKIP: { < skip "Home environment variable isn't set", 1 unless (defined $ENV{HOME}); 118c115 < }; --- >