Hi Noah,

You have to load the modules you intend to use prior to calling them using the use statement

        use CPAN::Shell;

and so forth. If you look at the error message

        perhaps you forgot to load "CPAN::Shell

It gives you a hint. Check also:

        % perldoc -f use

for a desciption of use.

        % man perldiag

also holds a description of the error message.

jonasbn
--
AIM: BjonasN      Gtalk: [EMAIL PROTECTED]
ICQ: 62401545   MSN: [EMAIL PROTECTED]


On 12/08/2007, at 19.42, Noah wrote:

Hi,

the CPAN::Shell perl module is installed but when called in a script an
error message advises installing it.

Clues please?



Macintosh-2:~ root# cat ./update.no.version.sh
#!/sw/bin/perl

# install my favorite programs if necessary:
for $mod (qw(Net::FTP MD5 Data::Dumper)){
    my $obj = CPAN::Shell->expand('Module',$mod);
    $obj->install;
}

# list all modules on my disk that have no VERSION number
for $mod (CPAN::Shell->expand("Module","/./")){
    next unless $mod->inst_file;
     # MakeMaker convention for undefined $VERSION:
    next unless $mod->inst_version eq "undef";
    print "No VERSION in ", $mod->id, "\n";
}


Macintosh-2:~ root#     perl -MCPAN -e 'install CPAN::Shell'
Macintosh-2:~ root# ./update.no.version.sh
Can't locate object method "expand" via package "CPAN::Shell" (perhaps
you forgot to load "CPAN::Shell"?) at ./update.no.version.sh line 5.
Macintosh-2:~ root# which perl
/sw/bin/perl
Macintosh-2:~ root# perl -v

This is perl, v5.8.8 built for darwin-thread-multi-2level

Copyright 1987-2006, Larry Wall

Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page.

Macintosh-2:~ root# /sw/bin/perl -v

This is perl, v5.8.8 built for darwin-thread-multi-2level

Copyright 1987-2006, Larry Wall

Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page.

Macintosh-2:~ root# /sw/bin/perl -V
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
  Platform:
    osname=darwin, osvers=8.10.1, archname=darwin-thread-multi-2level
    uname='darwin macintosh-2.local 8.10.1 darwin kernel version
8.10.1: wed may 23 16:33:00 pdt 2007; root:xnu-792.22.5~1release_i386
i386 i386 '
    config_args='-des -Dcc=gcc -Dcpp=gcc -E -Dprefix=/sw
-Dccflags=-I/sw/include -Dldflags=-L/sw/lib -Dperladmin=none
-Uinstallusrbinperl -Dprivlib=/sw/lib/perl5-core/5.8.8
-Darchlib=/sw/lib/perl5-core/5.8.8/darwin-thread-multi-2level
-Dman3dir=/sw/lib/perl5-core/5.8.8/man/man3 -Dman3ext=3pm - Duseithreads
-Dinc_version_list=5.8.8/darwin-thread-multi-2level
5.8.6/darwin-thread-multi-2level 5.8.1 5.8.0 5.6.0
-Adefine:startperl=#!/sw/bin/perl5.8.8'
    hint=recommended, useposix=true, d_sigaction=define
    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='gcc', ccflags ='-I/sw/include -fno-common -DPERL_DARWIN
-no-cpp-precomp -fno-strict-aliasing -pipe -Wdeclaration-after- statement
-I/usr/local/include -I/opt/local/include',
    optimize='-O3',
    cppflags='-no-cpp-precomp -I/sw/include -fno-common -DPERL_DARWIN
-no-cpp-precomp -fno-strict-aliasing -pipe -Wdeclaration-after- statement
-I/usr/local/include -I/opt/local/include'
ccversion='', gccversion='4.0.1 (Apple Computer, Inc. build 5367)',
gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags ='-L/sw/lib
-L/usr/local/lib -L/opt/local/lib'
    libpth=/usr/local/lib /opt/local/lib /usr/lib
    libs=-ldbm -ldl -lm -lc
    perllibs=-ldl -lm -lc
libc=/usr/lib/libc.dylib, so=dylib, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-L/sw/lib -bundle -undefined
dynamic_lookup -L/usr/local/lib -L/opt/local/lib'


Characteristics of this binary (from libperl):
  Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT
                        PERL_MALLOC_WRAP USE_ITHREADS USE_LARGE_FILES
                        USE_PERLIO USE_REENTRANT_API
  Built under darwin
  Compiled at Aug  9 2007 21:52:20
  @INC:
    /sw/lib/perl5-core/5.8.8/darwin-thread-multi-2level
    /sw/lib/perl5-core/5.8.8
    /sw/lib/perl5/site_perl/5.8.8/darwin-thread-multi-2level
    /sw/lib/perl5/site_perl/5.8.8
    /sw/lib/perl5/site_perl/5.8.8/darwin-thread-multi-2level
    /sw/lib/perl5/site_perl
    .
Macintosh-2:~ root# which perl
/sw/bin/perl
Macintosh-2:~ root# ./update.no.version.sh
Can't locate object method "expand" via package "CPAN::Shell" (perhaps
you forgot to load "CPAN::Shell"?) at ./update.no.version.sh line 5.
Macintosh-2:~ root# /sw/bin/perl -V | less
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
  Platform:
    osname=darwin, osvers=8.10.1, archname=darwin-thread-multi-2level
    uname='darwin macintosh-2.local 8.10.1 darwin kernel version
8.10.1: wed may 23
 16:33:00 pdt 2007; root:xnu-792.22.5~1release_i386 i386 i386 '
    config_args='-des -Dcc=gcc -Dcpp=gcc -E -Dprefix=/sw
-Dccflags=-I/sw/include -D
ldflags=-L/sw/lib -Dperladmin=none -Uinstallusrbinperl
-Dprivlib=/sw/lib/perl5-core
/5.8.8 -Darchlib=/sw/lib/perl5-core/5.8.8/darwin-thread-multi-2level
-Dman3dir=/sw/
lib/perl5-core/5.8.8/man/man3 -Dman3ext=3pm -Duseithreads
-Dinc_version_list=5.8.8/
darwin-thread-multi-2level 5.8.6/darwin-thread-multi-2level 5.8.1 5.8.0
5.6.0 -Adef
ine:startperl=#!/sw/bin/perl5.8.8'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define
usemultiplicity=defin
e
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='gcc', ccflags ='-I/sw/include -fno-common -DPERL_DARWIN
-no-cpp-precomp -fn
o-strict-aliasing -pipe -Wdeclaration-after-statement
-I/usr/local/include -I/opt/l
ocal/include',
    optimize='-O3',
    cppflags='-no-cpp-precomp -I/sw/include -fno-common -DPERL_DARWIN
-no-cpp-preco
mp -fno-strict-aliasing -pipe -Wdeclaration-after-statement
-I/usr/local/include -I
/opt/local/include'
ccversion='', gccversion='4.0.1 (Apple Computer, Inc. build 5367)',
gccosandver
s=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags ='-L/sw/lib
-L/usr/local/lib
 -L/opt/local/lib'
    libpth=/usr/local/lib /opt/local/lib /usr/lib
    libs=-ldbm -ldl -lm -lc
    perllibs=-ldl -lm -lc
libc=/usr/lib/libc.dylib, so=dylib, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-L/sw/lib -bundle -undefined
dynamic_lookup -L/usr/l
ocal/lib -L/opt/local/lib'


Characteristics of this binary (from libperl):
  Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT
                        PERL_MALLOC_WRAP USE_ITHREADS USE_LARGE_FILES
                        USE_PERLIO USE_REENTRANT_API
  Built under darwin
  Compiled at Aug  9 2007 21:52:20
  @INC:
    /sw/lib/perl5-core/5.8.8/darwin-thread-multi-2level
    /sw/lib/perl5-core/5.8.8
    /sw/lib/perl5/site_perl/5.8.8/darwin-thread-multi-2level
    /sw/lib/perl5/site_perl/5.8.8
    /sw/lib/perl5/site_perl/5.8.8/darwin-thread-multi-2level
    /sw/lib/perl5/site_perl
    .


Reply via email to