Tripod wont find my lib files

J

javatiger

Every time I upload a library file into my cgi bin, tripod refuses to
find it and comes up with an error.

It looks like there was an error:

Your script produced this error:
Can't locate File/Glob.pm in @INC (@INC contains: . / /lib /site_perl)
at msg.pl line 8.
BEGIN failed--compilation aborted at msg.pl line 8.

I get usual scripts to work but just can't get the lib ones too.

Is there something I need to be doing?

Cheers
 
B

Bob Walton

javatiger said:
Every time I upload a library file into my cgi bin, tripod refuses to

-------------------------------------^^^^^^^^^^^^^^^

What's "tripod"?

find it and comes up with an error.

It looks like there was an error:

Your script produced this error:
Can't locate File/Glob.pm in @INC (@INC contains: . / /lib /site_perl)

----------------------------------------------------^^^^^^^^^^^^^^^^^^^

Is your "cgi bin" one of the above directories? (hint: your web server
may not start your CGI routines with the current directory being the
directory in which the CGI routines reside). If not, loading a "library
file" there will do no good, as Perl is only searching the directories
in @INC for library routines. Maybe you should instead load the
"library file" into one of those directories. Or put a "use lib ..."
statement into your program which tells Perl to search the place where
you put the files.

at msg.pl line 8.
BEGIN failed--compilation aborted at msg.pl line 8.
....
 
J

javatiger

What's "tripod"?

Its a free webhosting site with cgi, http://www.tripod.lycos.com/

This is the script that I have loaded into the cgi bin
-------------------------------------------------------------------
#!/usr/bin/perl
require "formparser.lib"; &parseform;
$txt = $formdata{'msg'};
$name = $formdata{'from'};
open( TXT, ">>messages.txt" );
print TXT "Message: $txt - From $name \n";
close(TXT);
open( DATA, "<messages.txt" );
@data = < DATA >;
close( DATA );
print "Content-type:text/html\n\n";
foreach $item(@data){ print "<li>$item"; }

------------------------------------------------------------------------
and ive uploaded the formparser lib
-------------------------------------------------------------------------
sub parseform
{
if( $ENV{'REQUEST_METHOD'} eq 'GET' )
{ @pairs = split( /&/, $ENV{'QUERY_STRING'} ); }
elsif( $ENV{'REQUEST_METHOD'} eq 'POST' )
{
read( STDIN, $buffer, $ENV{'CONTENT_LENGTH'} );
@pairs = split( /&/, $buffer );
if( $ENV{'QUERY_STRING'} )
{ @getpairs = split( /&/, $ENV{'QUERY_STRING'} );
push( @pairs, @getpairs ); }
}
else
{
print "Content-type:text/html\n\n";
print "Unrecognized Method - Use GET or POST.";
}
foreach $pair( @pairs )
{
( $key, $value ) = split( /=/, $pair );
$key =~ tr/+/ /;
$value =~ tr/+/ /;
$key =~ s/%(..)/pack("c", hex($1))/eg;
$value =~ s/%(..)/pack("c", hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g; # ignore SSI
if( $formdata{$key} ){$formdata{$key} .= ", $value";}
else{ $formdata{$key} = $value; }
} }
1;
---------------------------------------------------------------------

But it throws the error.

Could you edit what need to be changed please.

---------------------------------------------------------------------
 
J

John W. Kennedy

Bob said:
-------------------------------------^^^^^^^^^^^^^^^

What's "tripod"?




----------------------------------------------------^^^^^^^^^^^^^^^^^^^

Is your "cgi bin" one of the above directories? (hint: your web server
may not start your CGI routines with the current directory being the
directory in which the CGI routines reside). If not, loading a "library
file" there will do no good, as Perl is only searching the directories
in @INC for library routines. Maybe you should instead load the
"library file" into one of those directories. Or put a "use lib ..."
statement into your program which tells Perl to search the place where
you put the files.

Tripod provides _no_ Perl library modules, requiring everything to be in
the user's cgi-bin directory. They supply an obsolete version of perl5,
an even more obsolete version of CGI.pm, and about four modules of their
own composition. All of these you have to download from them and then
upload into your cgi-bin directory.

File/Glob.pm, of course, would have to put into a subdirectory of
cgi-bin named File.
 
B

Bob Walton

javatiger said:
What's "tripod"?

Its a free webhosting site with cgi, http://www.tripod.lycos.com/

This is the script that I have loaded into the cgi bin


You are missing:

use warnings; #if your Perl is too old to support this, add -w
#to the #! line above
use strict;
use CGI; #when you are dealing with a CGI script, you should
#really make use of the CGI module. Not to do so is
#to invite gobs of errors and make lots and lots of
#additional work for you.

require "formparser.lib"; &parseform;

----------------------------^
Minor pick: You should only use & in front of a sub call if you
want the behaviors it generates. You don't, so use:

parseform();

instead. And, of course, you should really be using the CGI
module to "parse your form".

my %formdata; #used as a global in your sub below

$txt = $formdata{'msg'};

my $txt = ...

$name = $formdata{'from'};

my $name = ...

open( TXT, ">>messages.txt" );
print TXT "Message: $txt - From $name \n";
close(TXT);
open( DATA, "<messages.txt" );

--------^^^^
This is a special filehandle in Perl. You can use it as
you did, but you should really choose a different name.

@data = < DATA >;

-----------^----^
my @data = <DATA>;

Get rid of the spaces in the <...> operator. That
is the source of the call to module File::Glob
which isn't being found. Read the docs on the
<...> operator very carefully to see why this is
the case:

perldoc perlop

particularly the section on I/O operators.

close( DATA );
print "Content-type:text/html\n\n";
foreach $item(@data){ print "<li>$item"; }

my $item(...



my @pairs;

if( $ENV{'REQUEST_METHOD'} eq 'GET' )
{ @pairs = split( /&/, $ENV{'QUERY_STRING'} ); }
elsif( $ENV{'REQUEST_METHOD'} eq 'POST' )
{
read( STDIN, $buffer, $ENV{'CONTENT_LENGTH'} );
@pairs = split( /&/, $buffer );
if( $ENV{'QUERY_STRING'} )
{ @getpairs = split( /&/, $ENV{'QUERY_STRING'} );

my @getpairs = ...

push( @pairs, @getpairs ); }
}
else
{
print "Content-type:text/html\n\n";
print "Unrecognized Method - Use GET or POST.";
}
foreach $pair( @pairs )

my $pair ...

{
( $key, $value ) = split( /=/, $pair );

my($key,$value) = ...

$key =~ tr/+/ /;
$value =~ tr/+/ /;
$key =~ s/%(..)/pack("c", hex($1))/eg;
$value =~ s/%(..)/pack("c", hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g; # ignore SSI
if( $formdata{$key} ){$formdata{$key} .= ", $value";}
else{ $formdata{$key} = $value; }
} }
1;
---------------------------------------------------------------------

But it throws the error.

Could you edit what need to be changed please.
....
 
R

Robin

javatiger said:
Every time I upload a library file into my cgi bin, tripod refuses to
find it and comes up with an error.

It looks like there was an error:

Your script produced this error:
Can't locate File/Glob.pm in @INC (@INC contains: . / /lib /site_perl)
at msg.pl line 8.
BEGIN failed--compilation aborted at msg.pl line 8.

I get usual scripts to work but just can't get the lib ones too.

Is there something I need to be doing?

Cheers

try www.free-webhosts.com - and specify the full path to your library,
you'll probably have to find out from tripod. It might be something like
/usr/home/myuser or something.
-Robin
 
B

Bob Walton

Bob said:
javatiger wrote:
....


Oh yeah, and *always* check your open statements to see if
they succeeded or not, like:

open TXT,">>messages.txt" or
die "Oops, couldn't open messages.txt for append, $!";

print TXT "Message: $txt - From $name \n";


close(TXT);




open DATA,"<messages.txt" or
die "Oops, couldn't open messages.txt for read, $!";


....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,268
Messages
2,571,095
Members
48,773
Latest member
Kaybee

Latest Threads

Top