http://www.perlmonks.org?node_id=496714

QM has asked for the wisdom of the Perl Monks concerning the following question:

I was running my script at Re^2: Script to update your PPM Repositories on my home system (XP Pro), and noticed that:
my $rep_describe = `ppm rep describe $name`;
returns nothing, doesn't cause an error, etc. (at least, as far as I can tell). I looked at it in the debugger, like so:
.main::(C:\Perl\perl\ppm_update_4.pl:36): 36: my $rep_describe = `ppm rep describe $name`; DB<4> p $name ActiveState PPM2 Repository
(I had to change line 17 to invoke the debugger on the system call.)

This was working on my work machine (Win2K). On the other hand, the rest of the "ppm" calls seem to work, so I suspect something weird with XP-Pro, possibly the XP shell, and ppm3-bin (which is what ppm ultimately calls).

Any ideas?

My XP-Pro Perl install is:

C:\>perl -V Summary of my perl5 (revision 5 version 8 subversion 0) configuration: Platform: osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef usethreads=undef use5005threads=undef useithreads=define usemultip +licity=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_DES_FCRYPT -DPERL_IMP LICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX', optimize='-MD -Zi -DNDEBUG -O1', cppflags='-DWIN32' ccversion='', 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 -l +ibpath:"C:\Perl\lib\CORE" -machine:x86' libpth="C:\Perl\lib\CORE" libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib + comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib ver +sion.lib odbc32.lib odbccp32.lib msvcrt.lib perllibs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool +.lib comdlg32.lib advapi32.lib shell32.lib ole32. lib oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib + version.lib odbc32.lib odbccp32.lib msvcrt.lib libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl58.lib gnulibc_version='undef' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -opt: +ref,icf -libpath:"C:\Perl\lib\CORE" -machine:x86 ' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL +_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS Locally applied patches: ActivePerl Build 806 Built under MSWin32 Compiled at Mar 31 2003 00:45:44 @INC: c:/Perl/lib c:/Perl/site/lib .
I'll have to get the Win2K Perl details on Monday.

-QM
--
Quantum Mechanics: The dreams stuff is made of

Replies are listed 'Best First'.
Re: ppm rep describe
by randyk (Parson) on Oct 02, 2005 at 18:52 UTC
    I also find the same problem on XP. What you might try instead is accessing the information directly from PPM::UI:
    use strict; use warnings; use PPM::UI; my $name = q{ActiveState PPM2 Repository}; my $results = PPM::UI::repository_info($name); my $result = $results->{result}; print <<"END"; Name: $result->[0] Location: $result->[1] Type: $result->[2] END
      Thanks! That fixed it.

      I must have run out of steam, because I didn't think to look into how ppm3-bin was doing it.

      You gotta love the fact that PPM::UI doesn't seem to exist on CPAN, or the fact that the file on my local disk doesn't have POD. (Or did I miss something there too?)

      -QM
      --
      Quantum Mechanics: The dreams stuff is made of

        You didn't miss anything - the pod is minimal (non-existent :) for PPM::UI. There is a PPM package on CPAN, but this is only version 2, used in ActivePerl 6xx; the interface to version 3 of ppm, used in 8xx, has changed quite a bit.
Re: ppm rep describe
by planetscape (Chancellor) on Oct 02, 2005 at 09:33 UTC

    Specifically,

    my $rep_describe = `ppm rep describe $name`;

    returns undef:

    .main::(updateWorkingRepositories3.pl:41): 41: my $rep_describe = `ppm rep describe $name`; DB<1> x $name 0 'ActiveState PPM2 Repository' DB<2> x $rep_describe 0 undef

    Although if I type ppm rep describe ActiveState PPM2 Repository manually into a command prompt:

    Describing Active Repository 1: Name: ActiveState PPM2 Repository Location: http://ppm.ActiveState.com/cgibin/PPM/ppmserver-5.8-windows.pl?urn:/PP +MServer Type: PPMServer 2.0

    Details of my WinXP Pro SP2 install:

    Otherwise, as you say, it seems to work just fine...

    HTH,

    planetscape
      Try something like
      # escape shell metachars, search around for something complete $name =~ s/([&"])/^$1/g; my $rep_describe = `ppm rep describe "$name"`;
      See when you use ``, you're subject to the shell (like the pod says).

      MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
      I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
      ** The third rule of perl club is a statement of fact: pod is sexy.