[10236] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3829 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 25 23:07:12 1998

Date: Fri, 25 Sep 98 20:00:16 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 25 Sep 1998     Volume: 8 Number: 3829

Today's topics:
        Access ,OLE , images, To link or embed, thats my questi pcake@my-dejanews.com
    Re: cat reese > /dev/null (was Re: Perl & Java - differ (Adam Turoff)
    Re: cat reese > /dev/null (was Re: Perl & Java - differ <zenin@bawdycaste.org>
    Re: cat reese > /dev/null (was Re: Perl & Java - differ <eashton@bbnplanet.com>
    Re: cat reese > /dev/null (was Re: Perl & Java - differ <borg@imaginary.com>
        passing parameters to local file on pc <dstierman@micron.com>
    Re: Perl GMTIME?? (I R A Aggie)
        Perl module for LDAP v3? <bruce.w.mohler@saic.com>
        printing a two column sorted HTML table (Tom Tingdale)
    Re: Problem Joining Lines In Delimited Data (Ronald J Kimball)
    Re: Shell for testing Perl/CGI scripts!? <zenin@bawdycaste.org>
    Re: Shell-scripts and #! ( big dilemma ) ! (CHristoph Rimek)
    Re: Shell-scripts and #! ( big dilemma ) ! <zenin@bawdycaste.org>
        Simple data encryption in Perl (Mark Thompson)
    Re: Simple data encryption in Perl (Larry Rosler)
    Re: Simple data encryption in Perl <zenin@bawdycaste.org>
    Re: Where to put cgi-lib.pl (Ronald J Kimball)
    Re: Where to put cgi-lib.pl <zenin@bawdycaste.org>
    Re: Where to put cgi-lib.pl <zenin@bawdycaste.org>
    Re: Where to put cgi-lib.pl <zenin@bawdycaste.org>
    Re: Where to put cgi-lib.pl <zenin@bawdycaste.org>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Fri, 25 Sep 1998 23:06:34 GMT
From: pcake@my-dejanews.com
Subject: Access ,OLE , images, To link or embed, thats my question
Message-Id: <6uh7lp$e5$1@nnrp1.dejanews.com>

OK, I am new with Access and here is my situation.  I want to include images
in my database.  I know that embedding actually saves the image inside of the
database and linking points to an outside app that will load an image when it
is selected.  But why is the images converted to a bitmap when it is
embedded? If I cut and paste a 30k jpg image into an OLE field in access and
save that record it increases the file size of the database 500k.  What I
really want to do is display the image in that OLE field but as a linked file
not embedded so that my database is not 500mb for every 1000 records. And not
to display the icon of the image file but the actual image itself.  It may
sound like I dont know what Im talking about probably because I dont =] 
If anyone has any insight to what I'm doing please respond or drop me some
e-mail

thanks,
pat

p_harrison@hotmail.com

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


------------------------------

Date: 25 Sep 1998 19:02:35 -0400
From: ziggy@panix.com (Adam Turoff)
Subject: Re: cat reese > /dev/null (was Re: Perl & Java - differences and uses)
Message-Id: <6uh7eb$ovp@panix.com>

John Porter  <jdporter@min.net> wrote:
>George Reese wrote:
>> 
>> I have been programming for just shy of 8 years.  You can play all
>> sort of games with numbers you like, but it won't change the facts.
>
>With all due respect, Georgie boy, you're the one playing games
>with numbers.   Saying 8 is 10.  For crying out loud.

With all due respect, John, I think George is playing the 
'if 6 turned out to be 9' game.

Z.



------------------------------

Date: 25 Sep 1998 23:55:07 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: cat reese > /dev/null (was Re: Perl & Java - differences and uses)
Message-Id: <906767715.82962@thrush.omix.com>

George Reese <borg@imaginary.com> wrote:
: In comp.lang.java.programmer Abigail <abigail@fnx.com> wrote:
	>snip<
: : 1998 - 1992 == 6. Half a decade is a much closer approximation than
: : a decade.
:
: January 1991 to September 1998. Three months shy of 8 years. 

	First it's 10, then it's 8, now it's three months shy of 8...

	And I'm 30, I mean 26, I mean 8 months shy of 26...

-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


------------------------------

Date: Sat, 26 Sep 1998 02:26:58 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: cat reese > /dev/null (was Re: Perl & Java - differences and uses)
Message-Id: <360C4E84.4621A333@bbnplanet.com>

Adam Turoff wrote:

> With all due respect, John, I think George is playing the
> 'if 6 turned out to be 9' game.

Well, darling, men do seem to have an knack for exaggeration ;)
*mwaahahaa*

/me flees

e.

"All of us, all of us, all of us trying to save our immortal souls, some
ways seemingly more round-about and mysterious than others. We're having
a good time here. But hope all will be revealed soon."  R. Carver


------------------------------

Date: Sat, 26 Sep 1998 02:28:30 GMT
From: George Reese <borg@imaginary.com>
Subject: Re: cat reese > /dev/null (was Re: Perl & Java - differences and uses)
Message-Id: <ijYO1.2205$Ge.7107850@ptah.visi.com>

In comp.lang.java.programmer Zenin <zenin@bawdycaste.org> wrote:
: George Reese <borg@imaginary.com> wrote:
: : In comp.lang.java.programmer Abigail <abigail@fnx.com> wrote:
: 	>snip<
: : : 1998 - 1992 == 6. Half a decade is a much closer approximation than
: : : a decade.
: :
: : January 1991 to September 1998. Three months shy of 8 years. 

: 	First it's 10, then it's 8, now it's three months shy of 8...

: 	And I'm 30, I mean 26, I mean 8 months shy of 26...

Do you want me to get it down for you to the exact second?
Millisecond?  

-- 
George Reese (borg@imaginary.com)       http://www.imaginary.com/~borg
PGP Key: http://www.imaginary.com/servlet/Finger?user=borg&verbose=yes
   "Keep Ted Turner and his goddamned Crayolas away from my movie."
			    -Orson Welles


------------------------------

Date: Fri, 25 Sep 1998 16:44:43 -0600
From: Don Stierman <dstierman@micron.com>
Subject: passing parameters to local file on pc
Message-Id: <360C1CDB.6335@micron.com>

I am trying to pass parameters from a web html page to a local perl
script. I have not found a way for the local file to get the parameters.
I have tried using CGI.pm, etc. The html code that I have tried is:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML><HEAD><TITLE>Diemapper</TITLE>
</HEAD><BODY><P>

*** 1st way ***
<FORM METHOD="POST" ACTION="file:/v:/cgi-bin/diemap.pl"
ENCTYPE="multipart/form-data">
<INPUT NAME="file" VALUE="aaaa001Oo.txt"><P><INPUT TYPE="reset"><INPUT
TYPE="submit" NAME="submit" VALUE="Run"><P>

*** 2nd way ***
<A
HREF="file:/v:/username/d/dstierman/cgi-bin/diemap.pl?file=aaaa001Oo.txt">Run
Diemap Editor (cgi)</A><P></BODY>


------------------------------

Date: Thu, 24 Sep 1998 15:40:29 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Perl GMTIME??
Message-Id: <fl_aggie-2409981540290001@aggie.coaps.fsu.edu>

In article <360A98EE.718511C9@hknet.com>, thief <marlboro9@hknet.com> wrote:

+ I'm use matt's guestbook,How Can I put a script into the gbook.pl to get
+ the GMTime??

You mean like:

    gmtime EXPR
    Converts a time as returned by the time function to a 9-element
    array with the time localized for the standard Greenwich time
    zone. Typically used as follows:

        #  0    1    2     3     4    5     6     7     8
        ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
                                                gmtime(time);

James


------------------------------

Date: Fri, 25 Sep 1998 16:03:53 -0700
From: Bruce Mohler <bruce.w.mohler@saic.com>
Subject: Perl module for LDAP v3?
Message-Id: <360C2159.B44472D3@saic.com>

I'm trying to track down a Perl module to communicate with
an LDAP v3 server.

I'm familiar with perl-ldap but that's for LDAP v2.  I'm familiar
with perldap, but I'd prefer a solution that is "pure" Perl (for NT
and UNIX portability) rather than one that is a Perl module making
calls to an external C program.

Anything like this exist?

Thanks, in advance.

Bruce

--
Bruce W. Mohler                619-458-2675 (voice)
SAIC/ITS/Server Support        619-535-7806 (fax)
Sr UNIX system administrator   888-781-5697 (pager)
                               mailto:bruce.w.mohler@saic.com
Of course my password is the same as my pet's name.
My dog's name is Q47pY!3, but I change it every 90 days.




------------------------------

Date: Sat, 26 Sep 1998 01:24:29 GMT
From: tingdale@flash.net (Tom Tingdale)
Subject: printing a two column sorted HTML table
Message-Id: <360c3f68.8382263@news.flash.net>

Has anyone formatted a sorted list into a two column HTML table?
The script below creates a list of files from a directory and prints
the list out into a two column table, however, I want the list to be
in alphabetic order down the first column and then the next. I have
tried splitting the array in the middle to stagger the output, but I
haven't figured it out yet. Any ideas, solutions? Thanks in advance
from your help.

Tom Tingdale
******************************************8
#!/usr/local/bin/perl5 -w
use strict;

my $TARGET_DIR = 'C:\test_dir';
my $file;
my $count = 0;

opendir (DIR, "$TARGET_DIR") || print_message ("<H3>CGI
Error</H3>Cannot open directory : $TARGET_DIR $!<BR>\n");
my @files = readdir(DIR);
@files = sort(@files);

my $html = "<TABLE BORDER=0>\n";
foreach $file (@files) {
    next if ($file eq '.' || $file eq '..'); # ignore UNIX directories
    if (($count % 2) == 0) {
        $html .= "<TR>\n<TD>$file</TD>\n";
    } else {
        $html .= "<TD>$file</TD>\n</TR>\n";
    }
    $count++;
}
# if doesn't end with </TR>
if ($html =~ /<\/TD>$/) {
    $html .= "<TD>&nbsp\;</TD>\n</TR>\n";
}
$html .= "</TABLE>\n";

print_message("<H3>File List</H3>\n$html");

open (OUTFILE, "> A:\sample.html");
print OUTFILE "$html";
close OUTFILE;

#-------------------------------------------
sub print_message {
    my $message = shift;
    print <<"HTML";
<HTML>
<BODY BGCOLOR="#FFFFFF">
   $message
</BODY>
</HTML>
HTML
}



------------------------------

Date: Fri, 25 Sep 1998 19:50:18 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Problem Joining Lines In Delimited Data
Message-Id: <1dfxfpe.1tuvyoxj5nsveN@bay1-150.quincy.ziplink.net>

Ernest Mueller <ernestm@towery.com> wrote:

> one word:two words:three words
> but now:a
> broken
> ass:word field
> 
> I need to join the broken lines into full lines, replacing the newlines
> with spaces or something.  I wrote a script that works for short lines:
> 
> #!/usr/bin/perl
> open (FILE, "dataraw.txt");
> open (NEWFILE, "> datacooked.txt");
> while (<FILE>) {
> chomp;
> $line .= $_;
> if ($line =~ /^.*?\t.*?\t.*?$/) {

Your example uses colons.  Your code uses tabs.  Consistency, please.
:-)

> print NEWFILE "$line\n";
> $line = ""; }
> else {
> $line .= " "; }                             
> }
> close FILE;
> close NEWFILE;
> exit 0;
> 
> But if I use this for the real file (extending the regexp to 28 fields
> instead of the sample 3 above) oooo, it pegs my CPU and works
> super-duper slow, I assume it's just such a hairy regexp that it's a
> problem.  Also, it doesn't work if it's the last field that's split up.
> Not to mention it's not too robust in the face of a bad record.

Your regex is likely the problem.  First off, the non-greediness is
inefficient, and also useless in this case.  This would work much
better:
if ($line =~ /^[^\t]*\t[^\t]*\t[^\t]*$/) {

If you extended that regex out to 28 fields, with non-greedy matching
between each tab...  *shudder*

However, you don't really care about matching the string.  All you are
interested in knowing is whether the string contains 2 tabs:
if ($line =~ tr/\t// == 2) {

But there's one more problem.  What if you have a string that contains
three tabs?  You'll never reset the string - you just keep concatenating
and concatenating.  2 or more is what you really want to check for:
if ($line =~ tr/\t// >= 2) {

Hope that helps!

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


------------------------------

Date: 26 Sep 1998 00:12:28 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Shell for testing Perl/CGI scripts!?
Message-Id: <906768756.267182@thrush.omix.com>

[posted & mailed]

Michael Yevdokimov <flanker@sonnet.ru> wrote:
: Does anyone know any software for testing being written Perl/CGI scripts
: (shell or any more and where to download)?

	perldoc CGI

	Look for the "offline testing" stuff.

	Also, just adding the line to your script:

		use CGI::Carp qw(fatalsToBrowser);

	Can do *wonders*.

-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


------------------------------

Date: 26 Sep 1998 01:39:00 +0100
From: chrimek@rimf.rhein-main.de (CHristoph Rimek)
Subject: Re: Shell-scripts and #! ( big dilemma ) !
Message-Id: <71czJm-Zo$B@rimf.rhein-main.de>

In article <6tr1bu$32ti@soprox-in.bull.fr>, Serge.Noiraud (Serge.Noiraud@bull.net) wrote:

> [...]
> The problem is :
> I have shell-scripts with the #! magic number.
> I can't use #!perl even if my PATH is correct.
> I can't use #! $HOME/local/IRIX5/bin because this shellscript won't
> work on an AIX system. I can't use #! $PREFIX/bin/perl
>
> Do you have any Idea ? Is there one solution ?
>

#!/usr/bin/sh
exec ${PREFIX}/bin/perl $0  .....


-cr
--
Christoph Rimek         Frankfurt/Germany          phone +49-69-75009243


------------------------------

Date: 26 Sep 98 01:16:37 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Shell-scripts and #! ( big dilemma ) !
Message-Id: <906772898.788942@thrush.omix.com>

CHristoph Rimek <chrimek@rimf.rhein-main.de> wrote:
: #!/usr/bin/sh
: exec ${PREFIX}/bin/perl $0  .....

	Just to make that complete:

	#!/bin/sh
	exec ${PREFIX}/bin/perl $0 "$@"

	/bin/sh is always there even if it is only a link.
	/usr/bin/sh may not be.

-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


------------------------------

Date: Fri, 25 Sep 1998 23:14:54 GMT
From: mark-lists@webstylists.com (Mark Thompson)
Subject: Simple data encryption in Perl
Message-Id: <360c2137.36326227@news.supernews.com>

Hi,

I'm looking for a simple encryption routine for perl for information to go
into a dbm file.  The only three requirements are that it doesn't make the
dbm file size too big and that it's really simple to implement (basically, as
long as the data isn't in plain text format in the DBM file, it's alright)
and that the encrypted data and unencrypted data are in a one-to-one
relationship (using the same routine to encrypt the same data would give me
the same encrypted data.

My first choice was pack (and unpack) and converting it to hex but the reason
that was shot down was because it made the database twice the size.  Even a
simple offset routine (where all a's become b's, y's become z's and \47
becomes \48 would be acceptable in the instance we're looking at but I'm not
sure how to go about changing characters in this way (I know how to use tr///
but this is a bit beyond my knowledge.)

Thanks,

Mark Thompson

 




------------------------------

Date: Fri, 25 Sep 1998 16:44:38 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Simple data encryption in Perl
Message-Id: <MPG.1075cac36d1685a59897c5@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and a copy mailed.]

In article <360c2137.36326227@news.supernews.com> on Fri, 25 Sep 1998 
23:14:54 GMT, Mark Thompson <mark-lists@webstylists.com> says...
> I'm looking for a simple encryption routine for perl for information to go
> into a dbm file.  The only three requirements are that it doesn't make the
> dbm file size too big and that it's really simple to implement (basically, as
> long as the data isn't in plain text format in the DBM file, it's alright)
> and that the encrypted data and unencrypted data are in a one-to-one
> relationship (using the same routine to encrypt the same data would give me
> the same encrypted data.
> 
> My first choice was pack (and unpack) and converting it to hex but the reason
> that was shot down was because it made the database twice the size.  Even a
> simple offset routine (where all a's become b's, y's become z's and \47
> becomes \48 would be acceptable in the instance we're looking at but I'm not
> sure how to go about changing characters in this way (I know how to use tr///
> but this is a bit beyond my knowledge.)

It would seem as if tr/// is perfect for what you want.  One of the 
trivial encryption schemes used widely, mostly by juveniles, is the so-
called 'rot13' which translates every ASCII letter into its counterpart 
13 higher or lower.  Clearly the same algorithm can be used to encrypt 
and to decrypt (using those terms in the weakest possible sense, of 
course):

tr/a-zA-Z/N-ZA-Mn-za-m/

Just to make it a tiny bit more cryptic, I interchanged cases.  BFD.

If (as your example seems to indicate) you want to encrypt *all* 
characters, it is a tiny bit more complicated.  For "rot1":

tr/\x00-0xFF/\x01-0xFF\x00/

That isn't symmetrical, but this ("rot128") is:

tr/\x00-0xFF/\x80-0xFF\x00-0x7F/

I will lend you my old Captain Marvel decoder ring to help you figure it 
all out, if it is a bit beyond your knowledge. :-)

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: 26 Sep 1998 00:10:56 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Simple data encryption in Perl
Message-Id: <906768663.650302@thrush.omix.com>

[posted & mailed]

Mark Thompson <mark-lists@webstylists.com> wrote:
: My first choice was pack (and unpack) and converting it to hex but the reason
: that was shot down was because it made the database twice the size.  Even a
: simple offset routine (where all a's become b's, y's become z's and \47
: becomes \48 would be acceptable in the instance we're looking at but I'm not
: sure how to go about changing characters in this way (I know how to use tr///
: but this is a bit beyond my knowledge.)

	How about uuencode?

	$ cat foo.pl
	$foo = "encrypt me!";
	print "$foo\n";

	$bar = pack 'u', $foo;
	print $bar;

	$bar = pack 'u', $foo;
	$foo = unpack 'u', $bar;

	print "$foo\n";

	$ perl foo.pl
	encrypt me!
	+96YC<GEP="!M92$`
	encrypt me!

	It gains a little in space, but not too much.

	You also could use an xor system, which would also allow you
	to have a key to use to decrypt the data.  See the *huge* recent
	thread on xor encryption for details.

-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


------------------------------

Date: Fri, 25 Sep 1998 19:50:20 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Where to put cgi-lib.pl
Message-Id: <1dfxg9y.19hbdpi5j2c61N@bay1-150.quincy.ziplink.net>

Patrick Timmins <ptimmins@netserv.unmc.edu> wrote:

> > Besides, the web server has nothing to do with where Perl looks for
> > an included script.  Perl looks for 'require'd files in the @INC
> > array.  Exclusively.
> 
> Yes, and the current directory (represented by '.') is always in @INC .

What's your point?  It still has nothing to do with the web server, and
everything to do with Perl.  Thus, it is a Perl question and not a CGI
question.

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


------------------------------

Date: 26 Sep 1998 00:02:32 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Where to put cgi-lib.pl
Message-Id: <906768159.852233@thrush.omix.com>

[posted & mailed]


Uri Guttman <uri@camel.fastserv.com> wrote:
: >>>>> "EVZ" == Eric Von Zee <evonzee@tritechnet.com> writes:
:   EVZ> In addition to previous message: Perl acts on data in a BEGIN
:   EVZ> block at compile-time, not run-time.
:   EVZ> For example: (taken straight from the manpages)
:   EVZ>     use Module ();
:   EVZ> is exactly equivalent to
:   EVZ>     BEGIN { require Module }
:
: and it calls import in the module too.

	Actually, as Mark-Jason noted not to long ago in private email,
	it doesn't when your argument list is null ("()").  5.001 did
	call import() for this condition, but it has since been fixed.

	So yes,

		use Module ();

	is exactly functionally equivalent to

		BEGIN { require Module }

	however, it is not the same as

		use Module;

	as this last form will call Module->import(), of course.

-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


------------------------------

Date: 26 Sep 1998 00:48:24 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Where to put cgi-lib.pl
Message-Id: <906770912.197380@thrush.omix.com>

[posted & mailed]

Patrick Timmins <ptimmins@netserv.unmc.edu> wrote:
	>snip<
: ... so answer the question: Where does this 'BEGIN' block go? Why not just
: put the cgi-lib.pl file in the same directory as the perl script that is
: calling it, since the web server already knows where this file is at?

	You are wrong.

	The web server knows where the perl *program* is, but *perl* does
	NOT know where to find any library that is not in its search path,
	and /some/random/path/cgi-bin is *NOT* in @INC by default.

: The web server setup will determine where the server looks for CGI activated
: programs, whether they are Perl scripts or not.

	So?  This question has *nothing* to do with the ability of the
	*web server* to find the program, and *everything* to do with
	*perl's* ability to find the *perl library*.  So what if "." is
	in @INC, THE WEB SERVER WILL *NOT* CHDIR() TO THE LOCATION OF
	YOUR PERL SCRIPT BEFORE RUNNING IT, so "." is meaningless.  Thus
	the requirement to force the cgi-bin or whatever in your path
	with:
		use lib '/my/complete/path/to/cgi-bin';

	Or other BEGIN{}/@INC techniques.

	Maybe this example will make the situation clear to you:

	$ mkdir foo
	$ cd foo
	$ echo 'sub bar {"bar"}' > bar.pl
	$ echo '1;' >> bar.pl
	$ echo 'require "bar.pl";' > foo.pl
	$ echo 'print bar(), "\n";' >> foo.pl
	$ perl foo.pl
	bar
	$ cd ..
	$ perl foo/foo.pl
	Can't locate bar.pl in @INC (@INC contains: /usr/local/lib/perl5/sun4-solaris/5.00404 /usr/local/lib/perl5 /usr/local/lib/perl5/site_perl/sun4-solaris /usr/local/lib/perl5/site_perl.) at foo/foo.pl line 1.

	Your current working directory, and the directory that contains your
	program, are completely and totally unrelated.  Perl only cares
	about your current working directory.  Perl doesn't care where the
	perl script is found.  If you want it to care, read up on the
	FindBin module.

	This *IS* a perl problem.  It has nothing special to do with
	CGI.  Get off your high horse already.

	If I asked, "where do I put my chat.pl library so that my
	perl program can find?", it I would be asking the exact same
	question.

-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


------------------------------

Date: 26 Sep 1998 01:04:13 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Where to put cgi-lib.pl
Message-Id: <906771860.693065@thrush.omix.com>

Patrick Timmins <ptimmins@netserv.unmc.edu> wrote:
	>snip<
: My point, and I think you know this, is that he already has access to the
: cgi-bin (or where ever the web server is looking for cgi programs), since
: he has a cgi script there that is calling cgi-lib.pl.

	And my point, quite simply, is that you are wrong.  Stop harping on
	people for issues that you do not understand.

	>snip<
: > Besides, the web server has nothing to do with where Perl looks for
: > an included script.  Perl looks for 'require'd files in the @INC
: > array.  Exclusively.
:
: Yes, and the current directory (represented by '.') is always in @INC .
: See below.

	Yes, and the current directory is *NEVER* guaranteed, or even
	*expected* to be the same as the directory of your program.  Thus
	the fact that it is in your @INC is meaningless in this instance.

: > > The web server setup will determine where the server looks for CGI activated
: > > programs, whether they are Perl scripts or not. So, as I said before:
: >
: > True, before Perl is invoked.  Once inside Perl, though, Perl alone decides
: > where to find other Perl scripts.
:
: Yes, but Perl always knows to look in the directory it is already in.
: '.' is in @INC, you know! see the @INC documentation in perldoc perlvar,
: or try this:

	"it", being "perl", is typically /usr/local/bin.  I have never seen
	a perl that looked in /usr/local/bin for perl libraries, ever.

	The fact that "." is in your library search path is meaningless to
	this issue.

	See my other post that I cc'd you on for an example.

	"." and dirname($0) are not guaranteed, or even expected to be the
	same, ever, unless you *explicitly* code your program to make this
	so, which is a *very* uncommon and unreliable practice.

: Every web server setup I've seen (albeit, not many: 7 or 8) had
: cgi-lib.pl in the cgi-bin (or where ever the web server looks). Is this
: not, traditionally, the place to put cgi-lib.pl?

	So what if it is?  That still doesn't mean perl can find it without
	help (ie, manually tweaking @INC).

: In any case, he should get away from cgi-lib.pl if he can, and start using
: CGI.pm. Then all of this discussion would be alot more relevant to Perl,

	How are perl modules any more relevant to Perl then perl libraries?

	Please tell us, I'm quite curious.

	If this isn't a Perl question, it's a systems programming question.
	It is not however, a CGI/web question.

: since CGI.pm is a Perl module, and, traditionally, Perl modules are designed
: to be used together, and to know where to find each other.

	Perl modules have no more or less abilities to "find each other"
	then perl libraries, none.  They rely on *exactly* the same location
	systems.

	Please make sure you know what you are talking about before you
	start harping on others for legitimate questions that you do not
	understand.

-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


------------------------------

Date: 26 Sep 1998 01:17:29 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Where to put cgi-lib.pl
Message-Id: <906772656.937335@thrush.omix.com>

Scratchie <upsetter@ziplink.net> wrote:
: It's worked that way on every webserver I've ever used. Which ones doesn't
: this work on??

	NetScape, Bestwwwd, and IIS last I checked.  Current Apache by
	default does do a chdir(), but it is often turned off for
	performance on heavily hit sites.  Also, if your script is
	being fired from a 3rd party cgi_mod type handler it is also
	not guaranteed to chdir(). -Such 3rd party handlers are common
	on large, highly dynamic sites.

	So even if it works now, don't trust it to work next week.

-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


------------------------------

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 3829
**************************************

home help back first fref pref prev next nref lref last post