[7912] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1537 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 26 14:07:16 1997

Date: Fri, 26 Dec 97 11:00:59 -0800
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, 26 Dec 1997     Volume: 8 Number: 1537

Today's topics:
     [HELP-URGENT] Binaries for Aix <sparis@ubik.phymath.jussieu.fr>
     [HELP-URGENT] Binaries for Aix <sparis@ccr.jussieu.fr>
     ARGV to read commandline input (Ted Fiedler)
     Copy network file from script <user@msn.com>
     Re: File read/write efficiency (Andrew M. Langmead)
     GDBM and Firstkey tommiy@pronet.net.au
     Re: Help:  uniq utility <jacklam@math.uio.no>
     How do I pass objects from Perl to Javascript? (Neil Burnett)
     Re: How to check files exists and if it does then? (T Kohl)
     How to get unique list value (Chew Keat Yeow)
     Re: How to get unique list value (brian d foy)
     Re: How to get unique list value <rra@stanford.edu>
     How to unimport diagnostics module? <sbekman@iil.intel.com>
     Re: localtime() _is_ year-2000 compliant, right? <twolf@sampo.creighton.edu>
     Re: missing socket.ph <twolf@sampo.creighton.edu>
     Re: Newbie Question about Ctrl-D (Dustin Mollo)
     Newbie Question on Win32::Registry <glennb@matrixtech.com>
     Re: perl <STDOUT> to gnuplot <STDIN> (Ronald L. Parker)
     Re: Perl and Website ON W95 <twolf@sampo.creighton.edu>
     perl XStut and XSUBS tommiy@pronet.net.au
     Re: Rewinding a file back to the first line <twolf@sampo.creighton.edu>
     Re: setuid question (brian d foy)
     Re: Sort a file and pattern match (Tad McClellan)
     Re: Trouble with default CGI-BIN directories under Perl (Ronald L. Parker)
     Win 95 glitch with PERL 32 (Don)
     Re: WWW database (T Kohl)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 26 Dec 1997 19:44:05 +0100
From: Sunny PARIS <sparis@ubik.phymath.jussieu.fr>
Subject: [HELP-URGENT] Binaries for Aix
Message-Id: <34A3FAF5.ED3@ubik.phymath.jussieu.fr>

I need a binary version of Perl For Aix wich can be use with FCGI
module.
So it needs to have been compiled WITH SFIO.

A smit install would be nice.

If someone has an adress ...

Thanks in advance


Sunny


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

Date: Fri, 26 Dec 1997 19:48:54 +0100
From: Sunny PARIS <sparis@ccr.jussieu.fr>
Subject: [HELP-URGENT] Binaries for Aix
Message-Id: <34A3FC16.3EBF@ccr.jussieu.fr>

I need to find a binary version of PERL for AIX.
As i want to use the FCGI module, i need it to be compiled WITH SFIO
support.

If someone has an ftp adress ...

Thanks in advance

Sunny


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

Date: 26 Dec 1997 18:25:32 GMT
From: budo@news.ncx.com (Ted Fiedler)
Subject: ARGV to read commandline input
Message-Id: <32827CA148F87031.1FC76C2D1F9FB570.090A945E821F6A0E@library-proxy.airnews.net>


#!/usr/bin/perl
open (ARGV, $ARGV);
while  (<$ARGV[0]>)  {  
	if (/$ARGV[1]/) {
		print $_;
	}
}
close(ARGV);

ok im using perl 5.003 i want this program to take two commandline arguments
then use the first as the file name and the second as the pattern match
im pretty new and suck at regular expressions/pattern matching...
what am i doing wrong?

                                           thanks in advance
                                            ted


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

Date: Fri, 26 Dec 1997 07:45:20 -0800
From: "Mark Kaplan" <user@msn.com>
Subject: Copy network file from script
Message-Id: <uLzDmVhE9GA.237@upnetnews03>

I posted this question once before but maybe didn't phrase it correctly. I'd
like my script running under IIS NT4 to be able to copy files from one
location on the network to another. When I run the application or the copy
command within the script, I get access denied to the directory. I execute
the command like `copy` the same way I run blat. Is there a pm to handle
file transfers across the local network? I've tried giving the local IIS
account admin or domain privaledges but still no go. I believe it's a
security problem but can't seem to solve it. I'm running service pack 3.
The command is $result=`copy \\\\machine1\\dir1\\file1 \\\\machine2\\dir2`.
I'd really appreciate any suggestions.
myleslawrence@msn.com
Myles




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

Date: Fri, 26 Dec 1997 15:24:49 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: File read/write efficiency
Message-Id: <ELsytD.AKu@world.std.com>

"Mark S. Reibert" <reibert@mystech.com> writes:
>In a multitasking OS with a more-or-less contiguous file, it is probably faster to read the entire file at
>once due to disk I/O considerations (read/write latency, etc.). For example, if you are reading line-by-line
>and another process moves the disk head(s) between your reads, your process will have to move them back for
>your next read. This *may* be minimized if you read the entire file at once. Remember, disk I/O is still one
>of the bottle necks of computer systems!

But if you wind up reading enough data, the OS may decide to page some
of your memory to disk, and if the swap partition is on the same disk
as the data that you are reading the heads will perhaps be moving to
wildly different places on the disk anyway.

The input buffering done by c's stdio library, which winds up being
inherited by perl's standard input and output routines is a fairly
decent compromise between disk and memory efficiency.


And to answer the original question on why guestbook scripts often
read the entire file into memory and then write the entire file
out. The answer is probably because the author of the script didn't
know how to use or couldn't use perl's flock() to lock the file from
concurrent access.

-- 
Andrew Langmead


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

Date: Fri, 26 Dec 1997 03:51:03 -0600
From: tommiy@pronet.net.au
Subject: GDBM and Firstkey
Message-Id: <883129331.285147146@dejanews.com>

I am attempting to open a GDBM data base in perl and use the FirstKey
method defined by the GDBM manpage. I can open the db without any
problems but I am lost at how to then implement the firstkey method (or
nextkey for that matter). Can someone help here?

Regards

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Fri, 26 Dec 1997 12:21:47 +0100
From: Peter John Acklam <jacklam@math.uio.no>
Subject: Re: Help:  uniq utility
Message-Id: <34A3934B.F2A@math.uio.no>

Why not check out the section

  How can I extract just the unique elements of an array?

in perlfaq4?

Peter


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

Date: Fri, 26 Dec 1997 14:14:51 GMT
From: spectd@horus.sara.nl (Neil Burnett)
Subject: How do I pass objects from Perl to Javascript?
Message-Id: <34a3ba84.6016140@news.eunet.be>

Seasons Greetings -

I am creating nascent documents from a textbase created using CGI.pm
and wish to transfer the data to Javascript objects in an efficient
way. Does anyone have any suggestions?

I am doing it in a very long-winded fashion at the moment by creating
text strings in Perl which replace placeholders in my html document.
This is fine for a limited application, but I would like to do it in a
more general way by passing a CGI.pm object to the Javascript.

Thanks - Neil


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

Date: 26 Dec 1997 02:46:23 GMT
From: tkohl@csc.albany.edu (T Kohl)
Subject: Re: How to check files exists and if it does then?
Message-Id: <67v5pv$amh@maenad.csc.albany.edu>

In article <3oIg6aAhFun0EwUX@worsdall.demon.co.uk>,
Mark Worsdall  <shadowweb@worsdall.demon.co.uk> wrote:
>Hi, I need to be able to check if a file exists and if it does then
>append an 'a' unless that exists, in which case I will append a 'b'
>unless that exists etc etc etc.
>
>here is the variable:-
>$startloc/Logs/$urlpath/$date
>
>Where $date is the filename that has to be checked if exists and if does
>the the letter appended as described above.
>-- 

The following is a script I called ext and when I run it, I get a new
file called ext.a and when I run it again, it creates a file called
ext.b and if you keep running it you get the same thing, ext.c, ext.d
etc. - You can modify it to suit your purpose.
(It may not be slick but it works!) TIMTOWTDI - Cheers!

#!/usr/local/bin/perl
$file = "/home2/f/t/tkohl/ext";
@ext=split(//,"abcdefghijklmnopqrstuvwxyz");
$i=0;
if(-e "$file"){
while(-e $file.".".$ext[$i]){
$i++;
}
}
$newfile = $file.".".$ext[$i];
system("cp $file $newfile");






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

Date: 26 Dec 1997 11:06:29 GMT
From: eng40705@leonis.nus.sg (Chew Keat Yeow)
Subject: How to get unique list value
Message-Id: <68033l$3te@nuscc.nus.sg>


Hi,

I have a list with many item duplicated and I want to create list containing only unique values.
The way I do it is as follows, but I have this feeling that there must be a better way to do it with Perl.


@duplist = sort (@duplist);
$last = '';
foreach (@duplist) {
  push (@uniquelist, $_) if ($_ ne $last);
  $last = $_;
}


Comments anyone?

(Yes, I'm new to perl)


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

Date: Fri, 26 Dec 1997 06:56:05 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: How to get unique list value
Message-Id: <comdog-ya02408000R2612970656050001@news.panix.com>
Keywords: from just another new york perl hacker

In article <68033l$3te@nuscc.nus.sg>, eng40705@leonis.nus.sg (Chew Keat Yeow) wrote:

>I have a list with many item duplicated and I want to create list containing only unique values.

>Comments anyone?
>
>(Yes, I'm new to perl)

you can check the Perl FAQ [1] which answers this question :)

[1] 
find one at <URL:http://www.perl.com>

-- 
brian d foy                                  <comdog@computerdog.com>
Institute For the Organically-Challenged
   <URL:http://computerdog.com/brian/Institute.html>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: 26 Dec 1997 03:36:26 -0800
From: Russ Allbery <rra@stanford.edu>
To: eng40705@leonis.nus.sg (Chew Keat Yeow)
Subject: Re: How to get unique list value
Message-Id: <m390t872v9.fsf@windlord.Stanford.EDU>

[ Posted and mailed. ]

Chew Keat Yeow <eng40705@leonis.nus.sg> writes:

> I have a list with many item duplicated and I want to create list
> containing only unique values.  The way I do it is as follows, but I
> have this feeling that there must be a better way to do it with Perl.

my %seen;
@unique = grep { not $seen{$_}++ } @list;

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Fri, 26 Dec 1997 12:39:57 +0200
From: Bekman Stanislav <sbekman@iil.intel.com>
Subject: How to unimport diagnostics module?
Message-Id: <34A3897D.1CFB@iil.intel.com>

Hi,

I wrote a package which uses
use strict 
use diagnostics
pragmas

The programs that use that package inherit this 'diagnostics' pragma!
Why?

The client programs written in perl4/5 and not clean, so there are so
many warnings , but it's a nightmare to hunt all these uninitialized
vars!
Anyway I'm not going to do this! It worked for a long time 
Now I have learned a lot in Perl and all my new programs have strict on,
but it doesn't mean that I have to go and rewrite all my previous
programs, right?

I thought that this is all relevant for the package only, Isn't it?
When package is left everything should return, to its previous state...

I tried to add at the end
no diagnostics 
but I get :
	 Can't locate object method "unimport" of diagnostics 

Or I don't understand the way to use 'diagnostics' and it should be
removed after the script has been debugged?

Please, help

Thank you!

______________________________________________________________________
Stas Bekman     mailto:sbekman@iil.intel.com [just another webmaster]
Home Page:      http://www.eprotect.com/stas
A must visit: 	http://www.eprotect.com/stas/TULARC (Java,CGI,PC,Linux)
Linux-il Home:  http://www.linux.org.il/


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

Date: Fri, 26 Dec 1997 10:11:31 -0500
From: "Thomas Charron" <twolf@sampo.creighton.edu>
Subject: Re: localtime() _is_ year-2000 compliant, right?
Message-Id: <680hf3$6ie3@biko.telecom.ups.com>

  HeHe, suddenly I just remembered what the rtfm in rtfm.mit.edu stands
for..  <snickers>


brian d foy wrote in message ...
>In article <mbudash-1612971158240001@d39.pm.sonic.net>, mbudash@sonic.net
(Michael Budash) wrote:
>
>>In article <Pine.GSO.3.96.971216114018.23116K-100000@user2.teleport.com>,
>>Tom Phoenix <rootbeer@teleport.com> wrote:
>
>>>> (Or, of course, you could look in the FAQ. :-)
>>
>>Could you please tell me where the FAQ is? Now _that_ would be really
helpful...
>
>
>* the FAQ is included with perl.  you could try `man perlfaq`.  if it
>isn't there, it's time to upgrade :)
>
>* or you could go to <URL:http://www.perl.com>, and investigate from
>there.  almost everything Perl can be found from there.
>
>* searching for "Perl FAQ" in Yahoo leads to many perl FAQs, including
>the official one.  other search engines might be as easy.
>
>* or several other strategies for finding information.
>
>though you might think this sort of message is sarcastic, is it
>designed to help you find information on your own (since it is such
>a simple task).
>
>--
>brian d foy                                  <comdog@computerdog.com>
>NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
>CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>




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

Date: Fri, 26 Dec 1997 10:04:59 -0500
From: "Thomas Charron" <twolf@sampo.creighton.edu>
Subject: Re: missing socket.ph
Message-Id: <680h2t$6ie2@biko.telecom.ups.com>

  The .ph files are created via p2ph.  This merely changes the c .h include
files to .ph perl files.  Usually this is done to get information about
machine specific things, such as socket programming, which COULD be
different on different machines, like edian values and the such..

    Tom Charron

William R. Mattil wrote in message <34966F92.41C6@ix.netcom.com>...
>Hello all,
>
>I recently installed perl 5.004_4 on a risc6k using the smit installable
>archive from www.bull.de. However, the socket.ph file is missing, and
>there may be others. At this point compiling from the sources is not an
>option. Can anyone tell me where I can find this file ??? It doesn't
>apprear to be in the source distribution either.
>
>
>Regards
>Bill
>--
>William R. Mattil | Fred Astaire wasn't so great.
>wrmattil@ix.netcom.com | Ginger had to do it all backwards
>(972) 256-3219 | and... in high heels.




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

Date: 26 Dec 1997 17:14:15 GMT
From: dustin@sonic.net (Dustin Mollo)
Subject: Re: Newbie Question about Ctrl-D
Message-Id: <680ol7$9ud$1@ultra.sonic.net>

Martin Str|mberg (ams@ludd.luth.se) wrote:
: Don (dongood@ibm.net) wrote:
: : Just started learning PERL.  I have gotten to the point where I am
: : reading in array elements and am told in my book that Ctrl-D will send
: : "end of file" to the perl interpreter.  
: : 
: : This doesn't seem to be the case with my version/machine. 32 bit PERL
: : for Win 95.
: 
: Isn't EOF equal to Ctrl-Z in DOZE?

<SNIP>

That's correct.  CTRL-D is EOF in UNIX, and it's CTRL-Z in DOS/Win.

-Dustin


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

Date: Fri, 26 Dec 1997 12:27:15 -0500
From: "Glenn Blinckmann, MCSE" <glennb@matrixtech.com>
Subject: Newbie Question on Win32::Registry
Message-Id: <680pup$j47@bolivia.earthlink.net>

I'm just starting to learn Perl and I am having problems with the following
lines:

TEST:;

$Key = "SYSTEM\CurrentControlSet\Services\MSExchangeDS\Parameters";
$RegistryObj = "$HKEY_LOCAL_MACHINE";

open ($RegistryObj, $Key);

$Name  = "DSA Database file";
$Value = "";
$Type  = "";

Win32::Registry::QueryValue ($Value, $Type, $Name);

print ("RegistryObj: $RegistryObj\n");
print ("Key:         $Key\n");
print ("Value:       $Value\n");
print ("Type:        $Type\n");
print ("Name:        $Name\n");


The books that I have don't give any examples of using the Win32::Registry
function. What am I doing wrong?

--
Glenn Blinckmann, MCSE
Matrix Technologies, Inc.
mailto:glennb@matrixtech.com
http://www.matrixtech.com




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

Date: Fri, 26 Dec 1997 17:33:33 GMT
From: ron@farmworks.com (Ronald L. Parker)
Subject: Re: perl <STDOUT> to gnuplot <STDIN>
Message-Id: <34a4e9d2.5737960@10.0.2.33>

On Tue, 23 Dec 1997 15:33:22 -0800, Tom Phoenix
<rootbeer@teleport.com> wrote:

>On 22 Dec 1997, Michael Kelly - FVC PCD VET ~ wrote:
>> open  PLOT,"|gnuplot";
>
>Even when your script is "just an example" (and perhaps especially in that
>case!) you should _always_ check the return value after opening a file.

That's not a file.  Isn't it documented somewhere that the return from
opening a pipe isn't very useful?  Does the Tom Phoenix 'bot need an
adjustment?




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

Date: Fri, 26 Dec 1997 10:15:47 -0500
From: "Thomas Charron" <twolf@sampo.creighton.edu>
Subject: Re: Perl and Website ON W95
Message-Id: <680hn5$6ie4@biko.telecom.ups.com>

Hrm..  Ok, small question..  Where are you executing the perl cgi script
from?  Merely by double slicking on it in Explorer on your HD?  In order to
see meaningfull output, you should probrably load it up in a web browser..
;-P

    Tom Charron

Gilles Maire wrote in message <349722c2.58484655@news.imaginet.fr>...
>Hi,
>
>I have reinstalled my perl 5004 on my window 95 and when I execute a
>CGI I have a dos window and my script is excuted inside.
>Any idea please ?
>
>Regards
>
>GM
>
>Amicalement
>
>          Gilles.Maire@ungi.com
>|||||||||||||||||||||||||||||| - UNGI - ||||||||||||||||||||||||||||||
>          http://www.ungi.com




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

Date: Fri, 26 Dec 1997 05:21:06 -0600
From: tommiy@pronet.net.au
Subject: perl XStut and XSUBS
Message-Id: <883134988.349634564@dejanews.com>

Can someone please point me in the direction of a XS tutorial that
actually works? If I follow whats in the man pages it doesn't function at
all. In fact it doesn't suceed in even doing the first example and since
the rest are built on it I can't get past step 1. If I do EXACTLY what is
in the man perlxstut pages I get the following when running make on
Mytest.

[tommiy@bored Mytest]$ perl Makefile.PL Checking if your kit is
complete... Looks good Writing Makefile for Mytest [tommiy@bored Mytest]$
make cp Mytest.pm ./blib/lib/Mytest.pm /usr/bin/perl
-I/usr/lib/perl5/i386-linux/5.003 -I/usr/lib/perl5
/usr/lib/perl5/ExtUtils/xsubpp	-typemap /usr/lib/perl5/ExtUtils/typemap
Mytest.xs >Mytest.tc && mv Mytest.tc Mytest.c Please specify prototyping
behavior for Mytest.xs (see perlxs manual) cc -c  -Dbool=char -DHAS_BOOL
-I/usr/local/include -O2  -DVERSION=\"0.01\" -DXS_VERSION=\"0.01\" -fpic
-I/usr/lib/perl5/i386-linux/5.003/CORE	Mytest.c Mytest.c:18: parse error
before `:' Mytest.c:21: initializer element is not constant Mytest.c:21:
register name not specified for `mark' Mytest.c:21: initializer element
is not constant Mytest.c:21: `sp' undeclared here (not in a
function)Mytest.c:22: parse error before `if' Mytest.c:27: conflicting
types for `Perl_stack_sp'
/usr/lib/perl5/i386-linux/5.003/CORE/perl.h:900: previous declaration of
`Perl_stack_sp' Mytest.c:27: warning: initialization makes integer from
pointer without a cast Mytest.c:27: initializer element is not constant
Mytest.c:27: warning: data definition has no type or storage class
Mytest.c:27: parse error before `return' Mytest.c: In function
`boot_Mytest': Mytest.c:35: warning: initialization makes pointer from
integer without a cast Mytest.c:40: `XS_Mytest_hello' undeclared (first
use this function) Mytest.c:40: (Each undeclared identifier is reported
only once Mytest.c:40: for each function it appears in.) Mytest.c:42:
warning: assignment makes integer from pointer without a cast make: ***
[Mytest.o] Error 1

Can anyone help out here? Tell me whats wrong with the man page, or how
to fix what is happening? This is my first foray into perl XS and it
isn't going anywhere!

Thanks

Regards

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Fri, 26 Dec 1997 09:54:25 -0500
From: "Thomas Charron" <twolf@sampo.creighton.edu>
Subject: Re: Rewinding a file back to the first line
Message-Id: <680gf5$6ie1@biko.telecom.ups.com>

  One could also just do this:

seek(MYFILEHANDLE, 0, 0);

  This should set the pointer right back to the beggining of the file..

    Tom Charron

Oliver Much wrote in message <671bbu$pjc@walras.econ.de>...
>Eric Phillips <e.phillips@mindspring.com> wrote:
>
>EP>Hello, I have a script that will check a login and a password.  The
problem
>EP>is, when I try to log in via a form, the script only accepts the login
and
>EP>password on the last line of the file?
>
>EP>How do I take the "$_", or the current line that the script is reading,
back
>EP>to the very first line and character of the file?
>
>a) close and reopen the password-file.
>
>or
>
>b) read the file in an array and use only the array for verifying the
>   login-data.
>
>
>
>
>--
>---
>Oliver Much|@home: UZS7CI@ibm.rhrz.uni-bonn.de     | Sei P ein Punkt Q wir
>           |@work: oliverm@addi.finasto.uni-bonn.de| wollen ihn Z nennen.




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

Date: Fri, 26 Dec 1997 05:22:40 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: setuid question
Message-Id: <comdog-ya02408000R2612970522400001@news.panix.com>
Keywords: from just another new york perl hacker

In article <34A37B21.62C3C0CA@isty-info.uvsq.fr>, Nicolas Pomarede <pomarede@isty-info.uvsq.fr> wrote:

>I have a script which is used to connect to some distant
>machine using a modem. This script needs to be run as root,
>so when you login root and run it, it works perfectly.
>But I'd like to make it easier to use for anyone, so I put
>a setuid bit. But now, it complains when started :
>
>Insecure dependency in `` while running setuid at
>/etc/ppp/nconnect.pl.ttyC1 line 206.
>
>
>where line 206 looks like :
>
>$res = `nslookup $Dest`;

what happens if $Dest is  something like

   somewhere.com; echo "+ +" > .rhosts


>I tried to set $PATH correctly, but it didn't work.
>note that $Dest come from $ARGV[ 1 ], so perhaps it's why it
>doesn't work ?

Perl is helping you out by turning on taint checking.  see the perlsec
man page for more details.

a few other comments:

   * when calling the shell, you should probably use the full path
   to executables.  imagine someone munging the PATH and getting some
   other nslookup to run!  i always set $ENV{'PATH'} = '' in any setuid
   scripts.

   * look in the the get*() family of functions to see if Perl has
   a built-in function that does what you want.

   * do you really need root to accomplish this task?  try for a 
   less priveleged user in any setuid thingy - even if you have
   to make one up (without a login shell, and so on).

   * have you considered a chroot()-ed environment for the script?

good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>
Institute For the Organically-Challenged
   <URL:http://computerdog.com/brian/Institute.html>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Fri, 26 Dec 1997 08:27:22 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Sort a file and pattern match
Message-Id: <ase086.8k.ln@localhost>

Jim Michael (jim.michael@gecm.com) wrote:
: boggiano@venus.it wrote:
: > 
: > i need to reverse the order of the lines in a file,
: > from:

[snip]


: Slurp the file into an array and then use reverse, like so:

: #!/usr/bin/perl -w
                  ^^
                  ^^
This gave a warning didn't it?


: open(IN,"$ARGV[0]") || die("Doh! $!");
: my @files=<IN>;
: print "@files\n";
        ^        ^

Putting the array in double quotes causes perl to use the contents of
the $" special variable (default: space) as a separator between list items.

Makes funny looking output.


: reverse @files;
  ^^^^^^^^^^^^^^

-w says that this is in a void context. It reverses the array elements,
but the reversed list is not saved or output or anything.


: print @files;


   print reverse @files;  # this one actually works  ;-)



: > 
: > Also i need to perform a "patter match" on all files
                                               ^^^^^^^^^
: > in it.(here only doom.txt).
: $one2search=0;
: $pitter="patter";
: if ($files[$one2search]=~ /$pitter/) {
: 	#do something
: }


That only searches one filename.

   foreach $matched (grep /doom\.txt/, @files) {
      #do something with $matched
   }


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Fri, 26 Dec 1997 17:30:04 GMT
From: ron@farmworks.com (Ronald L. Parker)
Subject: Re: Trouble with default CGI-BIN directories under Perl
Message-Id: <34a3e92b.5570590@10.0.2.33>

On Mon, 22 Dec 1997 19:28:33 -0500, slinberg-bitme@crocker.com (Steve
Linberg) wrote:

>How do I configure IIS and/or Perl to set the default directory for a
>script to the directory it is contained in, rather than the cgi-bin root? 
>I don't know whu it's always setting the directory to \cgi-bin, even if
>the script being called is several layers deep.  Nothing in any of the
>documentation I've been able to find has provided a clue to this.

I've had the same problem with O'Reilly WebSite, and I've just taken
to putting this line

chdir(($0=~/(.*)\\/)[0]);

at or near the top of my scripts.



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

Date: Fri, 26 Dec 1997 16:31:05 GMT
From: dongoodwin@usa.net (Don)
Subject: Win 95 glitch with PERL 32
Message-Id: <34a4d9b9.1686087@news3.ibm.net>

I first found that there was a problem(which I thought was mine).
Since then a few others have tried the code and confirmed the strange
occurance with Win 95 and PERL 32.  The code is:

@array = <STDIN>;
print (@array);

When one uses ctrl-z to end the loading of the array.  The next line
of code is not executed.  In the above example, the first element of
the array is not printed in the first print(@array) statement.

I have tried putting a print statement after the offending code and
it confirmed that the next line of code is dropped:

@array = <STDIN>;
print ("hello\n");
print (@array);

This code skips the print("hello\n");

@array = <STDIN>;
print (@array);
print ("hello\n");
print (@array);

This code skips printing the first element of the @array the first
time print(@array); is executed.  The second print(@array); prints
every element properly.  The conclusion is that the array is read
properly but that ctrl-z causes Windows 95 to skip the next line of
code.

Others have confirmed that it is not "build" specific.  Seems to be a
Win 95 problem.

Does this happen with Win NT and PERL 32?

Thanks in advance,
Don


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

Date: 26 Dec 1997 02:26:36 GMT
From: tkohl@csc.albany.edu (T Kohl)
Subject: Re: WWW database
Message-Id: <67v4ks$acj@maenad.csc.albany.edu>

In article <349E598A.597A5F4D@speedy.udg.es>,
Samuel Costa Bendicho  <sc1334@speedy.udg.es> wrote:
>Hi there!
>
>I have to design a web with a little database accessible through CGI
>
>I had in mind using Perl. Do you know what kind of database should I
>use?
>I'd like to know if there exist some kind of perl libraries to work with
>some standard type of database.
>
>Thank you in advance
>
>Please, reply to Centollo@thevortex.com, too
>
>        Sam
>

You might want to try the glimpse search engine in particular, the
package called glimpsehttp which allows you to query a glimpse created
database using CGI. All the scripts (CGI and otherwise) are in Perl and are 
fairly easy to modify if you so desire. The installation is pretty 
straightforward too.

See http://glimpse.cs.arizona.edu for more details.
Cheers!


******************************************************************
* Timothy Kohl                                                   *
* State University of New York at Albany                         *
* Assistant Mananging Editor - New York Journal of Mathematics   *
* http://nyjm.albany.edu:8000                                    *
* tkohl@math.albany.edu                                          *
* -------------------------------------------------------------  *
* "If I were to bequeth to every young man one virtue of quality *
* I would give him the spirit of divine discontent, for without  *
* it the world would stand still." - Charles P. Steinmetz        *
******************************************************************




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

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


Administrivia:

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 1537
**************************************

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