[8709] in Perl-Users-Digest
Perl-Users Digest, Issue: 2326 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 15 07:07:26 1998
Date: Wed, 15 Apr 98 04:00:23 -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 Wed, 15 Apr 1998 Volume: 8 Number: 2326
Today's topics:
[Perl] How to find the Perl FAQ <rootbeer&pfaq*finding*@redcat.com>
Re: Bill Gates should be invited to O'Reilly's "Free So <ben@hayamasa.demon.co.uk>
Email Sender <defaultuser@domain.com>
Help: Parsing the UNIX w command ?? goodwin@cuug.ab.ca
Re: How could I improve my perl script's speed ? <uri@sysarch.com>
Re: Need to find web-based e-mail client in Perl! Tim@netshift.com
Re: Numeric validation <gurun@acc.umu.se>
Perl Compile Syntax Error??? <m.demetriou@cytanet.com.cy>
Re: Perl, HP-UX, and memory ... <qdtcall@esb.ericsson.se>
Re: Perl/CGI - stale scripts Sajjid.Mahmood@iname.com
Re: recursive fuctions <rootbeer@teleport.com>
scanning directories <soetensi@se.bel.alcatel.be>
Re: scanning directories <pidde@uni-koblenz.de>
Re: scanning directories <amar@iss-gmbh.de>
Re: scanning directories <ebohlman@netcom.com>
Wanted: Script to report about a WinNT Policy File greene@gucc.org
WIN32::Process::Create doesn't work in Win 95. Why? Christo@drexel.edu
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 15 Apr 1998 10:24:01 GMT
From: Tom Phoenix <rootbeer&pfaq*finding*@redcat.com>
Subject: [Perl] How to find the Perl FAQ
Message-Id: <5V%Y.1460$076.992345@news2.teleport.com>
Archive-name: perl-faq/finding-perl-faq
Posting-Frequency: weekly
Last-modified: 12 April 1998
[ That "Last-modified:" date above refers to this document, not to the
Perl FAQ itself! The Perl FAQ is modified frequently; the last major
update was in Spring of 1997. ]
For most people, this URL should be all you need in order to find Perl's
Frequently Asked Questions (and answers).
http://cpan.perl.org/doc/FAQs/
Please look over (but never overlook!) the FAQ and related docs before
posting anything to the comp.lang.perl.* family of newsgroups.
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Beginning with Perl version 5.004, the Perl distribution itself includes
the Perl FAQ. If everything is pro-Perl-y installed on your system, the
FAQ will be stored alongside the rest of Perl's documentation, and one
of these commands (or your local equivalents) should let you read the FAQ.
perldoc perlfaq
man perlfaq
If a recent version of Perl is not properly installed on your system,
you should ask your system administrator or local expert to help. If you
find that a recent Perl distribution is lacking the FAQ or other important
documentation, be sure to complain to that distribution's author.
If you have a web connection, the first and foremost source for all things
Perl, including the FAQ, is the Comprehensive Perl Archive Network (CPAN).
CPAN also includes the Perl source code, pre-compiled binaries for many
platforms, and a large collection of freely usable modules, among its
403_662_481 bytes (give or take a little) of super-cool (give or take
a little) Perl resources.
http://cpan.perl.org/
http://www.perl.com/CPAN/
http://cpan.perl.org/doc/FAQs/FAQ/html/perlfaq.html
http://www.perl.com/CPAN/doc/FAQs/FAQ/html/perlfaq.html
You may wish or need to access CPAN via anonymous FTP. (Within CPAN,
you will find the FAQ in the /doc/FAQs/FAQ directory. If none of these
selected FTP sites is especially good for you, a full list of CPAN sites
is in the SITES file within CPAN.)
California ftp://ftp.cdrom.com/pub/perl/CPAN/
Texas ftp://ftp.metronet.com/pub/perl/
South Africa ftp://ftp.is.co.za/programming/perl/CPAN/
Japan ftp://ftp.dti.ad.jp/pub/lang/CPAN/
Australia ftp://cpan.topend.com.au/pub/CPAN/
Netherlands ftp://ftp.cs.ruu.nl/pub/PERL/CPAN/
Switzerland ftp://sunsite.cnlab-switch.ch/mirror/CPAN/
Chile ftp://ftp.ing.puc.cl/pub/unix/perl/CPAN/
If you have no connection to the Internet at all (so sad!) you may wish
to purchase one of the commercial Perl distributions on CD-Rom or other
media. Your local bookstore should be able to help you to find one.
Another possibility is to use one of the FTP-via-email services; for
more information on doing that, send mail to <mail-server@rtfm.mit.edu>
(not to me!) with these lines in the body of the message, flush left:
setdir usenet-by-group/news.announce.newusers
send Anonymous_FTP:_Frequently_Asked_Questions_(FAQ)_List
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Comments and suggestions on the contents of this document
are always welcome. Please send them to the author at
<pfaq&finding*comments*@redcat.com>. Of course, comments on
the docs and FAQs mentioned here should go to their respective
maintainers.
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 15 Apr 1998 08:50:29 +0100
From: Ben Bullock <ben@hayamasa.demon.co.uk>
Subject: Re: Bill Gates should be invited to O'Reilly's "Free Software Summit" (was Re: RMS should be invited to O'Reilly's "Free Software Summit")
Message-Id: <353466C5.27F6EDDD@hayamasa.demon.co.uk>
Nathan V. Patwardhan wrote:
>
> Ben Bullock (ben@hayamasa.demon.co.uk) wrote:
>
> : I do have evidence, but I don't have inconclusive proof, that
> : the X windows books are a major part of O'Reilly's business.
>
> No, you have *opinions* and you're stating them like fact. That's why
> several people are irritated with you.
I don't think so: I think they're annoyed with me because
they disagree with my opinions but they can't get the better of
me in this discussion.
And that's why they try to start fights about trivia like this,
to try to distract attention from the actual issues.
--
Ben Bullock
------------------------------
Date: Wed, 15 Apr 1998 10:12:44 +0100
From: Lixo <defaultuser@domain.com>
Subject: Email Sender
Message-Id: <35347A0C.871FA8B@domain.com>
Hi, I have a script that performs an autentication and then send an
email message, using the comand (under Linux):
system ("mail $email -s \"subject\" < file.txt");
It works but the sender of this message is always "Nobody" that is the
default user for someone who uses it by HTML pages.
The script file belongs to "WWW" user, and I would like it to be the
sender.
Any sugestions?
Thanks.
Paulo Rodrigues
par@etc.pt
------------------------------
Date: Wed, 15 Apr 1998 03:34:58 -0600
From: goodwin@cuug.ab.ca
Subject: Help: Parsing the UNIX w command ??
Message-Id: <6h1rfi$v75$1@nnrp1.dejanews.com>
Hi there,
I'm trying desperately to parse the output of the UNIX w command in
order to output some of its information to a CGI. Is there anyone out
there who has done this successfully.
specifically i am having trouble getting the "what" part of it into a
variable. but getting all parts into there own variables would be
preferable.
this is what i am currently doing but it doesn't work all the time. yes
i am kind of new at this.
-------------
open(WHAT,"w |");
while (<WHAT>) {
chomp;
($pid, $term, $time, $idle, $junk1, $junk2, $junk3) = split;
$key = "$pid" . ":" . "$term";
$what = "$junk1 $junk2 $junk3";
$what =~ s/.*\d//;
# $connect{$key} is defined earlier in the program from parsing the who
# command
if (defined ($connect{$key})) {
($since,$from,$name) = split(/::/,$connect{$key});
$connect{$key} = "$since :: $from :: $name :: $what :: $idle ";
}
}
close(WHAT);
------------
here is an example output of the w command:
-------------
silica$ w
11:08pm up 66 day(s), 21:59, 3 users, load average: 3.07, 3.05, 2.89
User tty login@ idle JCPU PCPU what
root console Thu10pm185days 6:31 13 /usr/dt/bin/dtscreen
-mode worm
rgoodwin pts/9 11:00pm 1 pico -w who.cgi
rgoodwin pts/10 11:08pm w
root pts/4 Thu10pm 3days 2 -sh
root pts/6 Thu10pm 3days 9 -sh
root pts/3 Thu10pm 3days 1 -sh
root pts/2 Thu10pm 3days /sbin/sh
------------
in the above example $what ends up being equal to in each case is:
/usr/dt/bin/dtscreen -mode
-w who.cgi
-sh
-sh
-sh
/sbin/sh
this is close but as you can see it's missing parts of the longer
strings. it also fails on users with very long idle times as root in the
above example. does anybody have a better way to do this? I'm kind of
at a loss with my limitted perl savy. please email me at:
goodrob@shaw.wave.ca
thanks,
rob
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 14 Apr 1998 13:23:06 -0400
From: Uri Guttman <uri@sysarch.com>
To: Denis DORR <dorr@cetrel.lu>
Subject: Re: How could I improve my perl script's speed ?
Message-Id: <x74szwjp1h.fsf@sysarch.com>
>>>>> "DD" == Denis DORR <dorr@cetrel.lu> writes:
DD> Hi, I have to write a script to erase all data on hard disks.
DD> I've written the following one that does the job, but it takes
DD> more than 40 minutes for a 2Gb disk. I think there must be a
DD> one-liner that would do it in a couple of seconds, but I cannot
DD> figure out how.
DD> $repeat=1024 * 1024;
DD> while ( true ) { print CRYPTDD pack ("c64", 33..96) x $repeat ; }
DD> Any suggestion/comment/(constructive)flame is welcome.
sure! your problem is basic loop optimization. your pack and x
expression is a constant and it is being executed in a loop. remove that
from the loop and try it again. also a while modifier is slightly faster
than a while loop.
$data = pack ("c64", 33..96) x ( 1024 * 1024 ) ;
print CRYPTDD $data while 1 ;
hth,
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire ---- 8 Years of Perl Experience, Available Immediately
uri@sysarch.com --------- Resume and Perl Example at http://www.sysarch.com
Use the Best Search Engine on the Net -------- http://www.northernlight.com
------------------------------
Date: Wed, 15 Apr 1998 04:27:57 -0600
From: Tim@netshift.com
Subject: Re: Need to find web-based e-mail client in Perl!
Message-Id: <6h1uit$2p0$1@nnrp1.dejanews.com>
In article <lu7m4t46ln.fsf@asfast.com>,
Lloyd Zusman <ljz@asfast.com> wrote:
>
> abigail@fnx.com (Abigail) writes:
>
> > Elmira Alimova (ea187@columbia.edu) wrote on MDCLXXXVI September MCMXCIII
> > in <URL: news:353227C4.9329DD6B@columbia.edu>:
> > ++ Hello! My school is installing web kiosks for the students. Idea is to
> > ++ enable them to get mail also.
The simplest way to allow mail on kiosks is to use a purpose built front end
such as NetShift - free download available from http://www.netshift.com -
This has all the built in security you need for email reading including
privacy provisions such as not using the hard disk for storage of emails and
instant cache clearing. Any more details please contact me.
regards Tim
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Wed, 15 Apr 1998 11:46:57 +0200
From: N i c l a s O l o f s s o n <gurun@acc.umu.se>
Subject: Re: Numeric validation
Message-Id: <35348211.D5C30316@acc.umu.se>
Craig Berry wrote:
> OK, here's an opportunity to contribute to the Perl community.
Thanks Craig. I'm afraid I'm still new to Perl so I couldn't contribute
with that much, BUT, one problem I do have.
Pipes and forks. I've been programming C/C++ in Unix earlier but found
that for text parsing (among other things) there is no language like
Perl. Lately I have been working on a search engine that forks off x
number of children. What I want to do is to pipe STDOUT of _all_
children to the parent.
Thus I've been digging pretty deep into the manuals and been searching
for some reference on pipes but I can't find it.
I know how they work (C-style && unix theory) but can't get it working
in Perl. This is IMO mostly because the lack of manuals of my lack of
finding it. I've seen it object oriented, but that's not how I do
Perl...
Put that in and I would be happy.
> : Also suggests some of you go to comp.lang.vrml and take a course in news
> : communication done the way it should be done.
> Just went over there and it looked a touch more chaotic (!) but still
> quite similar to c.l.p.m -- what aspect of c.l.v do you find superior?
Well, the part that say's
"actually it's in the spec, but since you asked here you probably never
heard of it so I'll give you an answer to you question and a pointer for
future reference. BTW, welcome to the VRML community ..." :)
Mostly this is because of a few very talanted people devoting their time
and efforts to make VRML count. Bashing on newbies won't make that
happen, and they now it.
--
Niclas Olofsson Umee University, Sweden
Pedagoggrdnd 1A-210 Student, Dep. of Computing Science
907 30 Umee mailto:gurun@acc.umu.se
http://www.acc.umu.se/~gurun
--
"En seglare ber inte om medvind, han ldr sig segla"
------------------------------
Date: Wed, 15 Apr 1998 06:25:05 +0000
From: Demetris <m.demetriou@cytanet.com.cy>
Subject: Perl Compile Syntax Error???
Message-Id: <353452C1.BD390F4C@cytanet.com.cy>
This is a multi-part message in MIME format.
--------------242D8586410103A5DA81F254
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
I tried to compile perl5.004_04 on my linux box and got a syntax error
while compiling
I include a file with the errors occured (perl_compile_error) and also
myconfig file.
I use redhat5 on an i486 DX4/100mhz, 16 mb Ram, Laptop, Kernel 2.0.32
Thnx m.demetriou@cytanet.com.cy
--------------242D8586410103A5DA81F254
Content-Type: text/plain; charset=us-ascii; name="perl_compile_error"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="perl_compile_error"
[root@localhost perl5.004_04]# make
`sh cflags libperl.a pp_sys.o` pp_sys.c
CCCMD = gcc -DPERL_CORE -c -Dbool=char -DHAS_BOOL -O2
In file included from /usr/include/sys/select.h:31,
from pp_sys.c:45:
/usr/include/selectbits.h:31: warning: `__FD_ZERO' redefined
/usr/include/asm/posix_types.h:61: warning: this is the location of the previous definition
/usr/include/selectbits.h:36: warning: `__FD_SET' redefined
/usr/include/asm/posix_types.h:41: warning: this is the location of the previous definition
/usr/include/selectbits.h:41: warning: `__FD_CLR' redefined
/usr/include/asm/posix_types.h:46: warning: this is the location of the previous definition
/usr/include/selectbits.h:50: warning: `__FD_ISSET' redefined
/usr/include/asm/posix_types.h:54: warning: this is the location of the previous definition
In file included from pp_sys.c:45:
/usr/include/sys/select.h:60: warning: `FD_SET' redefined
/usr/include/linux/time.h:30: warning: this is the location of the previous definition
/usr/include/sys/select.h:61: warning: `FD_CLR' redefined
/usr/include/linux/time.h:31: warning: this is the location of the previous definition
/usr/include/sys/select.h:62: warning: `FD_ISSET' redefined
/usr/include/linux/time.h:32: warning: this is the location of the previous definition
/usr/include/sys/select.h:63: warning: `FD_ZERO' redefined
/usr/include/linux/time.h:33: warning: this is the location of the previous definition
In file included from pp_sys.c:45:
/usr/include/sys/select.h:45: syntax error before `fd_mask'
/usr/include/sys/select.h:45: warning: empty declaration
/usr/include/sys/select.h:48: conflicting types for `fd_set'
/usr/include/linux/types.h:9: previous declaration of `fd_set'
/usr/include/sys/select.h:73: conflicting types for `__select'
/usr/include/sys/time.h:55: previous declaration of `__select'
/usr/include/sys/select.h:76: conflicting types for `select'
/usr/include/sys/time.h:58: previous declaration of `select'
pp_sys.c: In function `Perl_pp_sselect':
pp_sys.c:804: warning: passing arg 2 of `select' from incompatible pointer type
pp_sys.c:804: warning: passing arg 3 of `select' from incompatible pointer type
pp_sys.c:804: warning: passing arg 4 of `select' from incompatible pointer type
make: *** [pp_sys.o] Error 1
--------------242D8586410103A5DA81F254
Content-Type: text/plain; charset=us-ascii; name="myconfig"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="myconfig"
#!/bin/sh
# This script is designed to provide a handy summary of the configuration
# information being used to build perl. This is especially useful if you
# are requesting help from comp.lang.perl.misc on usenet or via mail.
if test -f config.sh; then TOP=.;
elif test -f ../config.sh; then TOP=..;
elif test -f ../../config.sh; then TOP=../..;
elif test -f ../../../config.sh; then TOP=../../..;
elif test -f ../../../../config.sh; then TOP=../../../..;
else
echo "Can't find the perl config.sh file produced by Configure"; exit 1
fi
. $TOP/config.sh
# Note that the text lines /^Summary of/ .. /^\s*$/ are copied into Config.pm.
# XXX Add d_sigaction (?) once it's defined.
$spitshell <<!GROK!THIS!
Summary of my $package ($baserev patchlevel $PATCHLEVEL subversion $SUBVERSION) configuration:
Platform:
osname=$osname, osvers=$osvers, archname=$archname
uname='$myuname'
hint=$hint, useposix=$useposix, d_sigaction=$d_sigaction
bincompat3=$bincompat3 useperlio=$useperlio d_sfio=$d_sfio
Compiler:
cc='$cc', optimize='$optimize', gccversion=$gccversion
cppflags='$cppflags'
ccflags ='$ccflags'
stdchar='$stdchar', d_stdstdio=$d_stdstdio, usevfork=$usevfork
voidflags=$voidflags, castflags=$castflags, d_casti32=$d_casti32, d_castneg=$d_castneg
intsize=$intsize, alignbytes=$alignbytes, usemymalloc=$usemymalloc, prototype=$prototype
Linker and Libraries:
ld='$ld', ldflags ='$ldflags'
libpth=$libpth
libs=$libs
libc=$libc, so=$so
useshrplib=$useshrplib, libperl=$libperl
Dynamic Linking:
dlsrc=$dlsrc, dlext=$dlext, d_dlsymun=$d_dlsymun, ccdlflags='$ccdlflags'
cccdlflags='$cccdlflags', lddlflags='$lddlflags'
!GROK!THIS!
--------------242D8586410103A5DA81F254--
------------------------------
Date: 15 Apr 1998 10:02:40 +0200
From: Calle Dybedahl <qdtcall@esb.ericsson.se>
Subject: Re: Perl, HP-UX, and memory ...
Message-Id: <iswwcrecm7.fsf@godzilla.kiere.ericsson.se>
gold_bag@yahoo.com writes:
> You say Linux on HP's PA-RISC?? Is linux ported to PA-RISC??
MkLinux is, yes.
--
Calle Dybedahl, UNIX Sysadmin
qdtcall@esavionics.se http://www.lysator.liu.se/~calle/
------------------------------
Date: Wed, 15 Apr 1998 03:37:45 -0600
From: Sajjid.Mahmood@iname.com
Subject: Re: Perl/CGI - stale scripts
Message-Id: <6h1rkp$vcl$1@nnrp1.dejanews.com>
In article <35339DB6.3B4756E8@styx.or.fedex.com>,
Igor Vulfson <igorv@styx.or.fedex.com> wrote:
>
> I have a problem with a Perl/CGI script:
>
> It seems that if there are many users hitting the same script
> at the same time (it takes about 2 seconds for the script to run),
> there are processes being left running even after the script
> completes. I tried enabling and disabling output buffering ($|)
> but it seems to have little or no affect.
>
> Is there a way to have a perl script timeout and exit if it's been
> running for more than N seconds? Is there a reason why this CGI
> script would be left running?
>
> Note: I had encountered this problem before, only then the reason
> the script was being left running was that the output buffering was
> disabled ($| = 42;) and the connection was timing out after 4 minutes
> (yes, I had an infinite loop), at which point the client got a server
> timeout error, and there was a process id left running on server.
> Now, as I said, it takes 2 seconds for the script to run...
>
> Please advise!
>
> Igor Vulfson
> --
> mailto:ivulfson@fedex.com
> http://codeflux.com/
>
> Senior Scientific Programmer
> Ops Research & Spatial Apps
> Federal Express Corporation
>
One method is to use the alarm function to set a timeout (in seconds).
When this timer expires it will call a routine that you define to handle
the timeout. For example:
# Define routine to handle timeout
sub timeout_handler {
# Timer expired - Dying
print "Timer expired - Dying!\n";
exit( -1 );
}
# Capture the ALRM Signal and and force it to be handled by
timeout_handler routine
$SIG{ALRM} = 'timeout_handler';
# Set the actual alarm to say 10 seconds
alarm( 10 );
# Do an infinite loop
while ( 1 )
{
print "zzzzzzzzzz...\n";
}
One reason why your script seems to be "left running" may be due to the
calling process not waiting for your process to complete leaving it in a
"zombie" state.
(Note that your e-mail address seems to be unreachable)
Regards,
Sajjid
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Wed, 15 Apr 1998 07:22:44 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Byron Jones <byronj@nd.edu.au>
Subject: Re: recursive fuctions
Message-Id: <Pine.GSO.3.96.980415001227.1896J-100000@user2.teleport.com>
On Wed, 15 Apr 1998, Byron Jones wrote:
> i want to write a perl script that renames files to 8.3, creating unique
> names as needed. the function needs to process subdirectories recusively.
Sounds like a job for File::Find.
> i'm kinda new to perl, and i tried the code below. it steps through the
> first directory it finds recursivley but stops there. it's like it's not
> calling mydir recursively.
> sub mydir {
> my ($rootdir, $filename);
> $rootdir = $_[0];
> opendir (DIR, $rootdir);
Probably should check that that succeeded, or the rest of this won't do
much good. A directory may not be readable for a number of reasons.
> while ($filename = readdir (DIR)) {
To be sure, you should use defined() there, since the file or directory
name could be '0'. A future version of Perl will remove that potential
bug.
> if (($filename ne ".") and ($filename ne "..")) {
Nothing _wrong_ with that, but I'd probably just do something like this.
next if $filename eq '.';
next if $filename eq '..';
...If, of course, I weren't using File::Find.
> if (-d $rootdir . '/' . $filename) {
You should check for symlinks, too. Or, use File::Find, which makes it
easy to take care of this problem... (Yet another good example of why it's
good to build on already-debugged code! :-)
> mydir ($rootdir . '/' . $filename);
This does recursively call mydir, but, alas, you do another opendir on the
(global) filehandle DIR, which closes the one from earlier. But I won't
tell you that File::Find would solve this problem, too, since you've
surely decided to use it by now. :-)
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 15 Apr 1998 10:40:21 +0200
From: Soetens Inge <soetensi@se.bel.alcatel.be>
Subject: scanning directories
Message-Id: <35347274.2B26@se.bel.alcatel.be>
Hello,
is there a way to scan the structure of a directory in perl ?
If the structure is determined, I need to access each underlying
directory....(read all files)
How can I do that ?
------------------------------
Date: Wed, 15 Apr 1998 11:52:49 +0200
From: Andreas Pidde <pidde@uni-koblenz.de>
Subject: Re: scanning directories
Message-Id: <35348371.23273D47@uni-koblenz.de>
Hi,
you can use the readdir function and a traverse the directory tree, try:
#!/usr/local/bin/perl -w
$dirsep = "/"; # "\\" for Windows
scandir( $ARGV[0] || ".", "");
sub scandir
{
my $dirname = shift;
my $indent = shift;
my $filename;
opendir THISDIR, $dirname or die "Error $_: No directory
$dirname?\n";
my @allfiles = readdir THISDIR;
closedir THISDIR;
foreach $filename ( @allfiles ) {
print "${indent}${filename}\n";
next if $filename eq '..' || $filename eq '.';
&scandir($dirname.$dirsep.$filename, $indent."\t")
if ( -d $dirname.$dirsep.$filename );
}
}
#
Soetens Inge wrote:
>
> Hello,
>
> is there a way to scan the structure of a directory in perl ?
>
> If the structure is determined, I need to access each underlying
> directory....(read all files)
>
> How can I do that ?
--
Greetings
Andreas Pidde
------------------------------
Date: Wed, 15 Apr 1998 11:23:38 +0200
From: Amar Subramanian <amar@iss-gmbh.de>
To: Soetens Inge <soetensi@se.bel.alcatel.be>
Subject: Re: scanning directories
Message-Id: <35347C9A.29C2@iss-gmbh.de>
Hi,
>
> is there a way to scan the structure of a directory in perl ?
>
> If the structure is determined, I need to access each underlying
> directory....(read all files)
>
> How ?
look for the functions "opendir" and "readdir". The rest is just a
simple recursion. If you want, I can mail you a solution.
regards amar
------------------------------
Date: Wed, 15 Apr 1998 09:01:46 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: scanning directories
Message-Id: <ebohlmanErG6Ey.I6K@netcom.com>
Soetens Inge <soetensi@se.bel.alcatel.be> wrote:
: is there a way to scan the structure of a directory in perl ?
Yes.
: If the structure is determined, I need to access each underlying
: directory....(read all files)
: How can I do that ?
Use File::Find;
------------------------------
Date: Wed, 15 Apr 1998 04:16:08 -0600
From: greene@gucc.org
Subject: Wanted: Script to report about a WinNT Policy File
Message-Id: <6h1tsn$21o$1@nnrp1.dejanews.com>
Does anybody have a PERL script (or WinNT executable?) to 'dump' a Windows NT
policy file to text or comma-separated-values?
I couldn't believe that the evil empire (M$) doesn't provide this kind of
reporting tool, but I've searched several software archives and have had no
joy finding anything remotely like what I need.
A co-worker did this job by hand, and it cost him several hours and a quite a
bit of grey hair. Now I need to do something similar, to compare two different
policy files used in two different countries.
Thanks in advance for any help!!!
[Posted via DejaNews, since messages on my company news server never appear
outside the company firewall]
--
# James Greene - Informatics Consulting - 79539 Loerrach, Germany
# www.gucc.org/greene/consult - greene (at) gucc (dot) org
perl -e "eval unpack
'u*',q/B<')I;G0@(DIU<W0@86YO=&AE<B!015),(&AA8VME<B$*(@``/"
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Wed, 15 Apr 1998 04:54:54 -0600
From: Christo@drexel.edu
Subject: WIN32::Process::Create doesn't work in Win 95. Why?
Message-Id: <6h205d$4dt$1@nnrp1.dejanews.com>
Hi, I'm doing my Senior Design and if I don't do this I won't graduate.
I'm trying to make Perl run a Windows program. I know that the paths are fine
and that the error is in the Win32 or Win32::Process module, because I can run
my password script, but not start a Win application.
The following perl script works fine when I run it on Win NT, but when I
installed Perl in Win 95 it won't work. It gives me the following error:
C:\sambar\cgi-bin>perl lighton.pl
Undefined subroutine &main::print_error called at lighton.pl line 9.
#!c:\sambar\perl\bin\perl.exe
use Win32;
use Win32::Process;
# Create the process object.
Win32::Process::Create( $ProcessObj, # LINE 9
"C:\\sambar\\cgi-bin\\Winexe\\lighton.exe",
"Win_Launcher",
0, # Don't inherit.
DETACHED_PROCESS,
".") || # current directory
die &print_error;
# Wait for the process to end. No timeout.
$ProcessObj->Wait(INFINITE) ||
warn &print_error;
$ProcessObj->GetExitCode($ExitCode) ||
warn &pring_error;
if ($ExitCode eq 0) #If it runs fine, the output is Success!...,etc.
Please, please, please help me if you have any clue what I can do.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
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 2326
**************************************