Gossamer Forum
Home : General : Perl Programming :

Can't locate CGI.pm in @INC

Quote Reply
Can't locate CGI.pm in @INC
Yes....I did search and attempt fixes as noted both on this forum and through yahoo search engines. They do NOT appear to work. I do NOT know much in the way of CGI or C programming so I am doing my best to read through this. If anybody could help it would be appreciated.

What I am doing is attempting to get a directory listing. We are running Oracle Apps 11i with the Apache server. I have found this program called dirwrap.cgi (dirwrap_8.3.zip) and it appears to do what I am looking for.

The error I am getting is:

"Can't locate CGI.pm in @INC (@INC contains: /vobs/pdc_perl/bin/Solaris/Opt/lib/5.00503/sun4-solaris /vobs/pdc_perl/bin/Solaris/Opt/lib/5.00503 /vobs/pdc_perl/bin/Solaris/Opt/lib/site_perl/5.005/sun4-solaris /vobs/pdc_perl/bin/Solaris/Opt/lib/site_perl/5.005) at /u01/common/silgcomn/html/bin/dirwrap/dirwrap.cgi line 44.

BEGIN failed--compilation aborted at /u01/common/silgcomn/html/bin/dirwrap/dirwrap.cgi line 44.

[Tue Jul 8 10:48:51 2003] [error] [client 10.10.2.10] Premature end of script headers: /u01/common/silgcomn/html/bin/dirwrap/dirwrap.cgi"

If you look at the code it appears to be having a problem on line 44 according to above:

33 $dirwrap_url = "/OA_CGI/dirwrap/dirwrap.cgi";
34 $image_url = "/images";
35 $default_template = "example";
36 $default_sort = "by_r_date";
37 $sendmail_location = '/usr/lib/sendmail -t';
38 $admin_code = "admin";
39 $allow_dirwrap_links = "yes";
40
41 # exercise some good cgi practices
42 $|= 1;
43 open(CGI, '/u01/appl/silgora/iAS/Apache/perl/lib/5.00503/CGI.pm') or die $!;
44 use CGI qw(:standard);
45 use CGI::Carp qw(fatalsToBrowser);
46 use Fcntl;
47 use strict;
48 use vars qw(
49 $admin_code $admin_email $allow_dirwrap_links $allow_path_parm $base_path
50 $base_url $bgcolor_1 $bgcolor_2 $chk $chkd $color $counts_file $default_sort
51 $default_template $dirwrap_url $download_counter $e1 $e2 $e3 $e4 $e5 $e6 $e7


My perl directory is:

which perl
/u01/appl/silgora/iAS/Apache/perl/bin/perl


The CGI.pm value is located at:

-rwxr-xr-x 1 applsilg dba 190905 Oct 20 2001 CGI.pm
/u01/appl/silgora/iAS/Apache/perl/lib/5.00503


Where is it getting the directory above noted as "(@INC contains: /vobs/pdc_perl/bin/Solaris/Opt/lib/5.00503/sun4-solaris /vobs/pdc_perl/bin/Solaris/Opt/lib/5.00503 /vobs/pdc_perl/bin/Solaris/Opt/lib/site_perl/5.005/sun4-solaris /vobs/pdc_perl/bin/Solaris/Opt/lib/site_perl/5.005) "?????

I have searched the program and anything else I can think of and can not find it.

Also am I calling this program correctly in my URL?


http://server.com:PORT/OA_CGI/dirwrap.cgi

Has anybody else used this program?

Any other programs recommended that would do get me a directory listing?

Last edited by:

Kuberski: Jul 8, 2003, 9:16 AM
Quote Reply
Re: [Kuberski] Can't locate CGI.pm in @INC In reply to
Hi,

Those directories come from when perl is compiled. You could add:

use lib '/u01/appl/silgora/iAS/Apache/perl/lib/5.00503';

before your 'use CGI'. Alternatively you could try downloading FileMan which does not depend on CGI.pm.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Can't locate CGI.pm in @INC In reply to
Sorry...as I said I'm fairly new to PERL. How do I go about recompiling the PERL packages? This was a clone from another box who use to host our Oracle Apps. It is possible that is does have the wrong directory information then if it is stored in a compile version of PERL.
Quote Reply
Re: [Kuberski] Can't locate CGI.pm in @INC In reply to
Hi,

If you do a perl -V, you'll see the inc paths that are compiled in:

Quote:
[root@gossamer root]# perl -V
Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
...
Characteristics of this binary (from libperl):
Compile-time options: USE_LARGE_FILES
Built under linux
Compiled at Apr 22 2003 18:45:28
@INC:
/usr/local/ghost/lib/perl/i686-linux
/usr/local/ghost/lib/perl
/usr/local/ghost/lib/perl/site_perl/i686-linux
/usr/local/ghost/lib/perl/site_perl
/usr/local/ghost/lib/perl/site_perl
/usr/local/ghost/lib/gpanel
/home/admin/.perllib
.
[root@gossamer root]#

To install a new version of perl, you can dowload it from:

http://www.perl.com/CPAN/src/stable.tar.gz

and follow the install instructions.

(By the way it's Perl not PERL when describing the language, and perl when talking about the binary). =)

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Can't locate CGI.pm in @INC In reply to
This is definitely complied with a directory that no longer exist. "/vobs/...." So is this what could be causing my problems?

******************************************

perl -V

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:

Platform:

osname=solaris, osvers=2.6, archname=sun4-solaris

uname='sunos 5.6 generic_105181-14 sun4u sparc sunw,ultra-60 '

hint=recommended, useposix=true, d_sigaction=define

usethreads=undef useperlio=undef d_sfio=undef

Compiler:

cc='cc', optimize=' -xO4 -KPIC', gccversion=

cppflags='-I/usr/local/include'

ccflags ='-I/usr/local/include'

stdchar='unsigned char', d_stdstdio=define, usevfork=false

intsize=4, longsize=4, ptrsize=4, doublesize=8

d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16

alignbytes=8, usemymalloc=y, prototype=define

Linker and Libraries:

ld='cc', ldflags =' -L/usr/local/lib'

libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib

libs=-lsocket -lnsl -ldl -lm -lc -lcrypt

libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a

Dynamic Linking:

dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '

cccdlflags='-KPIC', lddlflags='-G -L/usr/local/lib'



Characteristics of this binary (from libperl):

Built under solaris

Compiled at Sep 20 2000 10:55:44

%ENV:

PERL5LIB="/u01/appl/silgora/iAS/Apache/perl/lib/5.00503:/u01/appl/silgora/iAS/Apache/perl/lib

/site_perl/5.005"

@INC:

/u01/appl/silgora/iAS/Apache/perl/lib/5.00503/sun4-solaris

/u01/appl/silgora/iAS/Apache/perl/lib/5.00503

/u01/appl/silgora/iAS/Apache/perl/lib/site_perl/5.005/sun4-solaris

/u01/appl/silgora/iAS/Apache/perl/lib/site_perl/5.005

/vobs/pdc_perl/bin/Solaris/Opt/lib/5.00503/sun4-solaris

/vobs/pdc_perl/bin/Solaris/Opt/lib/5.00503

/vobs/pdc_perl/bin/Solaris/Opt/lib/site_perl/5.005/sun4-solaris

/vobs/pdc_perl/bin/Solaris/Opt/lib/site_perl/5.005


******************************************

I can NOT upgrade though to a newer version. This is installed to run with the Oracle Apps 11i and Application Server.

Sorry about the spelling....as I said I don't work with Perl (or perl) much....just an Oracle DBA that they want to get a directory listing via the web for a unix directory that will contain reports. The Apache we are running will NOT allow me to index the directory (security feature of the Oracle Apps). Just about ready to program this in Korn shell and run a cronjob to refresh the source html script I would view. Pirate

Came across the dirwrap_8.3 program which is CGI/Perl...having a hard time getting it to work.
Quote Reply
Re: [Kuberski] Can't locate CGI.pm in @INC In reply to
Hi,

Well you could:

1. ln -s /u01/appl/silgora/iAS/Apache/perl /u01/appl/silgora/iAS/Apache/perl

This would make it so perl could find the directories.

or:

2. Add:

use lib '/u01/appl/silgora/iAS/Apache/perl/lib/5.00503';

so that the script can find it's modules.

or:

3. Write it in shell. =)

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Can't locate CGI.pm in @INC In reply to
The link part is working...at least I get a different error and the path_check.cgi returns what is installed.

cd /

mkdir -p /vobs/pdc_perl/bin/Solaris

cd /vobs/pdc_perl/bin/Solaris

ln -s /u01/appl/silgora/iAS/Apache/perl Opt

Software error:

Insecure directory in $ENV{PATH} while running with -T switch at /u01/appl/silgora/iAS/Apache/Apache/cgi-bin/dirwrap/dirwrap.cgi line 1322.
Quote Reply
Re: [Kuberski] Can't locate CGI.pm in @INC In reply to
Hi,

I'm not sure if that script is designed to run under perl's taint mode or not, but you could turn it off taint mode by editing the first line of the script and removing any -T flag to perl. This may or may not be such a good idea, as it removes perl's extra security checks.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Can't locate CGI.pm in @INC In reply to
Got it to work...THANKS!

Cool