[8493] in Perl-Users-Digest
Perl-Users Digest, Issue: 2110 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 16 16:17:08 1998
Date: Mon, 16 Mar 98 13:00:52 -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 Mon, 16 Mar 1998 Volume: 8 Number: 2110
Today's topics:
Re: Deleting and copying files in Win95 <jkry3025@comenius.ms.mff.cuni.cz>
Re: elsif question (Andy Lester)
Re: globbing vs. opendir / readdir (Kevin B Cohen)
Hidden variables <pdoran@lucent.com>
how to slice an anonymous hash? <smalunjk@cisco.com>
Re: How to use CPAN modules/no permission to install <laufera@ruf.uni-freiburg.de>
Re: How to use CPAN modules/no permission to install <laufera@ruf.uni-freiburg.de>
Re: How to use CPAN modules/no permission to install <David.Boyce@fmr.com>
Re: How to use Perl for Win95? <joe.tully@virgin.net>
Re: How to use Perl for Win95? <joe.tully@virgin.net>
Re: Is there a "Newsgroup" for Newbies to Perl? <stackhou@elk.cray.com>
Re: Is there a "Newsgroup" for Newbies to Perl? (Joergen W. Lang)
LDAP interface <norman.bunn@mci.com>
Re: learn <samk@was.net>
Re: Multiple substitues dfrench@aig.vialink.com
Net::FTP & firewalls? <kehoe@fc.hp.com>
opendir and UNC's in NT (Jason V. Robertson~)
Re: passwd in perl <tex@lager.engsoc.carleton.ca>
Perl for DOS/Windows 3.x <flavio@sem.spam>
Perl for WIN32 external system calls <tensor@tensorex.com>
Re: Perl for Win32 <jkry3025@comenius.ms.mff.cuni.cz>
precedence problem <mlepine@bellsouth.net>
Problem determining if system function worked <russ_conway@cytec.gm.com>
Re: Problem determining if system function worked (Mike Stok)
Re: redirect stderr and stdout to same file (Joergen W. Lang)
Re: redirect stderr and stdout to same file <spamsux-tex@habit.com>
Re: regular expressions and control characters <jdporter@min.net>
Re: returning immediately from system call? <jamesr@aethos.co.uk.nospam>
Splitting a string to make keys to a hash (Matthew Cravit)
Re: Splitting a string to make keys to a hash (Jason Gloudon)
Re: Splitting Arrays/Variables <jefpin@bergen.org>
still rename probs with MS IIS <soul@explorer.com>
Re: Tied and blessed? <jdporter@min.net>
Unable to capture output of Perl script under NT 4.0 (Pontus Berglund)
Re: User-interface Quandary (Jack Ostroff)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 16 Mar 1998 19:50:23 -0800
From: Jan Krynicky <jkry3025@comenius.ms.mff.cuni.cz>
Subject: Re: Deleting and copying files in Win95
Message-Id: <350DF2FF.679@comenius.ms.mff.cuni.cz>
qvanegeren@frxsoft.com wrote:
>
> When I attempt to delete files in Win95, using the following
> command :
> system 'del file.txt';
> I get an Invalid switch error... It appears to remove the
> file but this makes it impossible for me to validate whether
> it executed directly, because it always returns false. I run
> into the same problem when trying to copy a file from one
> place to another. Again, the copy appears to work, but the
> error returned keeps me from reporting on the copy correctly.
> It's also pretty ugly for a user to see the 'Invalid Switch'
> message on the screen. Any help would be greatly appreciated.
>
> Quenten Van Egeren
Do not use system() calls for tasks you can do from within Perl.
unlink 'file.txt'
use File::Copy;
copy 'file.txt','otherfile.txt';
See
man perlfunc
and
perldoc File::Copy
Jenda
------------------------------
Date: 16 Mar 1998 17:54:30 GMT
From: petdance@maxx.mc.net (Andy Lester)
Subject: Re: elsif question
Message-Id: <6ejp0m$a04$1@usenet47.supernews.com>
: Without a code example, I am pretty sure there is nothing anyone
: can do for you. I personally am not a mindreader.
I'm proud of you. That was very restrained, considering what you were
REALLY thinking.
xoxo,
Andy
--
--
Andy Lester: <andy@petdance.com> http://tezcat.com/~andy/
Chicago Shows List: <shows@ChicagoMusic.com> http://ChicagoMusic.com/
------------------------------
Date: 16 Mar 1998 14:00:37 -0500
From: kcohen@julius.ling.ohio-state.edu (Kevin B Cohen)
Subject: Re: globbing vs. opendir / readdir
Message-Id: <6ejssl$2kf@julius.ling.ohio-state.edu>
In article <fl_aggie-1603981156000001@aggie.coaps.fsu.edu>,
I R A Aggie <fl_aggie@thepentagon.com> wrote:
>What's so hard about:
>
>@files = sort grep /\.html$/, readdir(DIR);
never said that was hard! but that's grep, not readdir. my statement
may not have been insightful, but it was correct.
kevin "i disavow any claim to being insightful, especially since i
don't actually know how to use grep" cohen
---
If we suppose for the moment that a pizza is a syntactical
structure...
---Nigel Chapman, Perl: The Programmer's Companion
------------------------------
Date: Mon, 16 Mar 1998 13:49:55 -0500
From: Patrick Doran <pdoran@lucent.com>
Subject: Hidden variables
Message-Id: <350D7453.7E1D2E0B@lucent.com>
Hi,
I am providing my users w/ a PERL script that will will modify a
production database (using DBD) to recover from a common manufactoring
error.
The problem I am having is the need to have the Oracle user ID and
password in the the PERL code, this is NOT acceptable.
What are my options for hiding these fields. I have tried set-id, and a
text file owned by a different user, but our system does NOT support SID
for "scripts". Is there a way to change the effective user-id in the
script itself, or is there a better way to do this w/ environmental
variables or some other approach. I have userd PERL proimarily for web
based apps in the past and this was never an issue.
Thanks in advance for any and all help...
--
"Silence is concurrence"
Patrick J. Doran
Database Applications Engineer
Lucent Technologies, Microelectronics
Email: stcpjd@micro.lucent.com
Phone: (610) 391-2747
Fax: (610) 391-3050
------------------------------
Date: Mon, 16 Mar 1998 12:26:44 -0800
From: Sanjay Malunjkar <smalunjk@cisco.com>
Subject: how to slice an anonymous hash?
Message-Id: <350D8B04.A7FEC57@cisco.com>
greeting,
I am trying to slice an anonymous hash but havent succeeded so far...
here's the piece of code:
#!/usr/local/bin/perl5
#print newlines after every print
$\="\n";
#'::' separated record of field name,value
$_='F::Scot::L::Tiger::C::Company name';
@x= (split(/::/))[2..5];
print "slice of an anonymous array in x =@x"; #
L Tiger C Company name
$_='F::Scot::L::Tiger::C::Company name';
@h= @{split(/::/)}{'F','L'};
print "slice of anonymous hash in h=@h";
#expect Scot Tiger, instead get blank
I looked at dejanews, camel, panther etc. but couldn't find any
solution.
Please let me know what am I doing wrong here and whats the best way to
achieve this ?
Thanks in advance,
Sanjay Malunjkar
------------------------------
Date: Mon, 16 Mar 1998 18:17:07 +0100
From: Andreas Laufer <laufera@ruf.uni-freiburg.de>
Subject: Re: How to use CPAN modules/no permission to install
Message-Id: <350D5E93.C73CFDC0@ruf.uni-freiburg.de>
Jan Krynicky schrieb:
>
> P.M.Wong wrote:
> >
> > Sorry for asking such trivial question but i just can't find
> > any doc telling me what to do once i downloaded those CPAN modules
> > For example, i just downloaded the CGI_Lite and after extracting the
> > tar file, i found files like CGI_Lite.pm and Makefile.PL there.
> > Do i have to make it (that's using Makefile.PL) before i can use
> > it
> > OR simply copy the CGI_Lite.pm to the appropriate directory
> > (in my case it is /usr/local/lib/perl5/aix/5.00401 )
>
> Some modules do not need any installing so you may just copy the .pm
> files to correct directory. I don't know if CGI_Lite.pm is this case.
>
> You should at least try to make it. The most common process is :
>
> perl Makefile.PL
> make
> make test
> make install
>
> That is put the files into some directory. Run perl with the Makefile.pl
> as the first parameter. This will create a file named makefile.
> You will then call "make" (without parameters), then "make test"
> to check everything is OK and at last "make install".
>
> >
> > If i need to make it, how do i go about doing it
> > (I don't see any !#/usr/local/bin/perl line in the file Makefile.PL)
>
> It can't, the author cannot know where did you put perl.
> I have seen it in /usr/bin/perl, /big/bin/perl, ...
> your is /usr/local/bin/perl.
>
> You just have to call perl explicitly from the command line.
> (Unless of course working with Windoze. It does not use #!)
How can I install and use perl modules which have in the readme the
lines
perl Makefile.PL
make
make test
make install
when I have only a cgi-bin on a machine with perl5 but neither root
access nor a telnet access, only ftp ?
Have all you perl modul users root access or how do you make this ?
By
Andreas
------------------------------
Date: Mon, 16 Mar 1998 18:22:44 +0100
From: Andreas Laufer <laufera@ruf.uni-freiburg.de>
Subject: Re: How to use CPAN modules/no permission to install
Message-Id: <350D5FE4.470EFD1D@ruf.uni-freiburg.de>
Andreas Laufer schrieb:
>
> Jan Krynicky schrieb:
> >
> > P.M.Wong wrote:
> > >
> > > Sorry for asking such trivial question but i just can't find
> > > any doc telling me what to do once i downloaded those CPAN modules
> > > For example, i just downloaded the CGI_Lite and after extracting the
> > > tar file, i found files like CGI_Lite.pm and Makefile.PL there.
> > > Do i have to make it (that's using Makefile.PL) before i can use
> > > it
> > > OR simply copy the CGI_Lite.pm to the appropriate directory
> > > (in my case it is /usr/local/lib/perl5/aix/5.00401 )
> >
> > Some modules do not need any installing so you may just copy the .pm
> > files to correct directory. I don't know if CGI_Lite.pm is this case.
> >
> > You should at least try to make it. The most common process is :
> >
> > perl Makefile.PL
> > make
> > make test
> > make install
> >
> > That is put the files into some directory. Run perl with the Makefile.pl
> > as the first parameter. This will create a file named makefile.
> > You will then call "make" (without parameters), then "make test"
> > to check everything is OK and at last "make install".
> >
> > >
> > > If i need to make it, how do i go about doing it
> > > (I don't see any !#/usr/local/bin/perl line in the file Makefile.PL)
> >
> > It can't, the author cannot know where did you put perl.
> > I have seen it in /usr/bin/perl, /big/bin/perl, ...
> > your is /usr/local/bin/perl.
> >
> > You just have to call perl explicitly from the command line.
> > (Unless of course working with Windoze. It does not use #!)
>
> How can I install and use perl modules which have in the readme the
> lines
> perl Makefile.PL
> make
> make test
> make install
> when I have only a cgi-bin on a machine with perl5 but neither root
> access nor a telnet access, only ftp ?
>
> Have all you perl modul users root access or how do you make this ?
>
Just forgot to add that
my ISP seems not to be able to install all the modules that I want to
use.
So ist there another way to make the modules work ?
Andreas
------------------------------
Date: Mon, 16 Mar 1998 13:35:53 -0500
From: David Boyce <David.Boyce@fmr.com>
Subject: Re: How to use CPAN modules/no permission to install
Message-Id: <350D7109.E15D2559@fmr.com>
Andreas Laufer wrote:
> Just forgot to add that
> my ISP seems not to be able to install all the modules that I want to
> use.
>
> So ist there another way to make the modules work ?
Read up on the -M flag and the 'blib' module, plus 'use lib' and -I if
you aren't familiar with those.
-David
------------------------------
Date: Mon, 16 Mar 1998 18:45:20 +0000
From: Joe Tully <joe.tully@virgin.net>
To: "Maxine G." <*nospam*mg*nospam*@pcg*nospam*.net>
Subject: Re: How to use Perl for Win95?
Message-Id: <350D7340.AA458361@virgin.net>
You could create a DOS batch file like the following:
@echo off
if "%1"=="" goto ERROR
perl %1 | more
goto END
:ERROR
echo "ERROR: No perl file specified."
:END
echo.
Then associate the .pl file type in windows with this batch
file.
Maxine G. wrote:
>
> Thanks to you and everyone who responded by e-mail.
> I am now able to run my scripts in a dos window.
> I tried setting up the win95 associations as suggested below, but when I try
> to run the scripts directly, the dos window opens, the script runs and the dos
> window immediately closes, so that I can just barely make out the results.
> Does anyone know a way to keep the window open?
>
------------------------------
Date: Mon, 16 Mar 1998 18:45:41 +0000
From: Joe Tully <joe.tully@virgin.net>
Subject: Re: How to use Perl for Win95?
Message-Id: <350D7355.658EBEDF@virgin.net>
You could create a DOS batch file like the following:
@echo off
if "%1"=="" goto ERROR
perl %1 | more
goto END
:ERROR
echo "ERROR: No perl file specified."
:END
echo.
Then associate the .pl file type in windows with this batch
file.
Maxine G. wrote:
>
> Thanks to you and everyone who responded by e-mail.
> I am now able to run my scripts in a dos window.
> I tried setting up the win95 associations as suggested below, but when I try
> to run the scripts directly, the dos window opens, the script runs and the dos
> window immediately closes, so that I can just barely make out the results.
> Does anyone know a way to keep the window open?
>
------------------------------
Date: Mon, 16 Mar 1998 12:35:38 -0600
From: Mark P Stackhouse <stackhou@elk.cray.com>
Subject: Re: Is there a "Newsgroup" for Newbies to Perl?
Message-Id: <350D70FA.59E2@elk.cray.com>
OK... OK ... OK... so why in the world am I getting all this HTML stuff
attached to my posts? I don't see it with my Mailtool at work, or at
home. I have Netscape 4.0 plus Communicator at home. I better take a
trip through my configurations tonight! Sorry, people, I sincerely
apologize!
Mark
John Stanley wrote:
>
> In article <6ehqlk$o90@newsops.execpc.com>,
> Mark Stackhouse <stackhou@execpc.com> wrote:
> ><HTML>
> >
> ><BLOCKQUOTE TYPE=CITE>
>
> <DORKQUOTE ... > is the proper citation.
>
<snip>
> Well, stop looking for nbsp and you won't get that error message.
>
> ><P>Mark
> ><BR>
>
> Goodybe PMark.
------------------------------
Date: Mon, 16 Mar 1998 20:07:54 +0100
From: joergen.lang@schwaben.de (Joergen W. Lang)
Subject: Re: Is there a "Newsgroup" for Newbies to Perl?
Message-Id: <1d60032.ljml7cpmmvwgN@host026-206.seicom.net>
Uri Guttman <uri@sysarch.com> wrote:
> again, if the not so newbies helped the newbies, we experts can help
> them.
But where are they ? Right now the situation seems to be a bit like:
newbie ---void---void---void---void---void--- expert
I probably fit in somewhere between the two leftmost "voids"s and only
start to get confident enough to share my knowledge.
I'm quite sure there's more not-so-newbies out there, who could
contribute.
But why don't they ? Afraid ? Lazy ?
Ach, whatever I'll just put up with the flames if I explain something
wrongly... Anyone else for a helping ? ;-)
Randal says in "Learning Perl", Ch1, Exercise 1:
"Consult your local Perl guru if you need assistance." Unfortunately,
for many people the local Perl guru seems to be clpm - just a few
keystrokes away....
> i vote for moderated!
>
> uri
yup,
Joergen
--
-------------------------------------------------------------------
"Everything is possible - even sometimes the impossible"
HOELDERLIN EXPRESS - "Touch the void"
-------------------------------------------------------------------
------------------------------
Date: Mon, 16 Mar 1998 19:17:39 GMT
From: "Norman Bunn" <norman.bunn@mci.com>
Subject: LDAP interface
Message-Id: <nVeP.3$%%2.8367@news.internetMCI.com>
Has anyone used LDAP with PERL? If so, how?
Norman
------------------------------
Date: Mon, 16 Mar 1998 11:23:37 -0600
From: Samuel King <samk@was.net>
To: dooks@netcom.ca
Subject: Re: learn
Message-Id: <350D6019.40C65F0A@was.net>
Go to mcp.com
register for their online bookshelf
and they have a plethora of books in the web programming section
the are ebooks
The real thing online for your reading/learning pleasure
SCK
ROBERT DOOKS wrote:
> Where can I go to learn Perl free on-line? Any websites that have free
> tutorials etc?
>
> Thanks
------------------------------
Date: Mon, 16 Mar 1998 14:00:39 -0600
From: dfrench@aig.vialink.com
Subject: Re: Multiple substitues
Message-Id: <6ek09l$pa7$1@nnrp1.dejanews.com>
In article <isogz67kjd.fsf@godzilla.kiere.ericsson.se>,
Calle Dybedahl <qdtcall@esb.ericsson.se> wrote:
> > The content of the substitutes above were just an example, but I
> > would like to do the same kind of thing in perl. I would like to do
> > multiple substitues in a single command, somthing like:
> >
> > $result = s/A/a/ && s/B/b/ && s/C/c/;
>
> That doesn't do what I think you think it does. $result will end up
> containing the (boolean) result from the &&-operators. If you want to
> do three substitutions, do three substitutions:
>
> $result =~ s/A/a/g;
> $result =~ s/B/b/g;
> $result =~ s/C/c/g;
>
The point of the posting is to see if anyone knows a way to avoid doing
multiple commands to perform multiple substitutes. The closest thing
to a solution I have received follows:
open(F, "somefile");
@result = <F>;
close(F);
for (@result) {s/A/a/g;s/B/b/g;s/C/c/g;}
Dana French
dfrench@aig.vialink.com
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Mon, 16 Mar 1998 12:27:20 -0700
From: "Jeffrey W. Kehoe" <kehoe@fc.hp.com>
Subject: Net::FTP & firewalls?
Message-Id: <350D7D18.7FFE8DE5@fc.hp.com>
Does anyone know if the Net::FTP code works transparently with a
"socksified" ftp installed. We're trying to utilize ftp to transfer
files, but we don't want to have to deal with firewalls, etc. We're
telling our users that they need to provide a "socksified" ftp if they
want to transfer through a firewall. Is anyone using the Net::FTP in
this manner?
Thanks in advance,
Jeff
------------------------------
Date: 16 Mar 1998 17:51:32 GMT
From: jvrobert@chnews.intel.com (Jason V. Robertson~)
Subject: opendir and UNC's in NT
Message-Id: <6ejor4$jb2@news.or.intel.com>
Has anybody else noticed that the NT version of perl (5.004 and above, at
least) won't do an opendir on a UNC with no subdirectory?
So, for example:
opendir(IN, "\\\\myserver\\myshare") will not work, but
opendir(IN, "\\\\myserver\\myshare\\subdir") will work.
Also,
-d "\\\\myserver\\myshare" won't work
but
-d "\\\\myserver\\myshare\\subdir" will work.
Any ideas, or am I doing something stupid?
Thanks,
Jason
--
|Jason V. Robertson <jvrobert@sedona.intel.com> |
|Not speaking for Intel. |
------------------------------
Date: 16 Mar 1998 16:35:11 GMT
From: "Clayton L. Scott" <tex@lager.engsoc.carleton.ca>
Subject: Re: passwd in perl
Message-Id: <6ejkbv$gre$1@bertrand.ccs.carleton.ca>
Stefan Adams <pinky@mail.usmo.com> spewed verbiage concerning:
: Here is my dilema:
: I have written an administration perl script that adds and deletes users
: and changes their passwords. The problem is, only root can run this
: program. But more often than not, I have other users that need to
: change passwords to all users, but I don't want to give them root
: access. How do I allow a few select users, specified by the admin group
: account, to change passwords for all users without giving group write
: access to /etc/passwd?
: Do I make the program SUID, or make a 'su' call?
: Please help me
Make the script executable and owned by the group maint_passwd and
add the special users to that group. Set permissions on the script
appropriately.
/tex
--
Some days are diamonds, some days are rocks
-Tom Petty and the Heartbreakers "Even walls fall down"
------------------------------
Date: 16 Mar 1998 19:11:43 GMT
From: Flavio Pereira <flavio@sem.spam>
Subject: Perl for DOS/Windows 3.x
Message-Id: <6ejthf$mmr$1@news.fr.internet.bosch.de>
Hi !
Does anybody knows where I can find Perl package for DOS/Windows 3.x ?
I know nothing about this language but I really need it now.
Some documentation is also important.
Thanks for any help.
Flavio.
------------------------------
Date: Mon, 16 Mar 1998 15:26:28 -0500
From: Tensor Engineering <tensor@tensorex.com>
Subject: Perl for WIN32 external system calls
Message-Id: <350D8AF4.1AF3981F@tensorex.com>
Hiya folks,
A quick question for all you Perl for WIN32 people out there.
I am used to UNIX Perl and am trying to write several portable
scripts for WIN32 now. What I am after is to be able to call
an external program like :
system ("gunzip $currfile");
for WIN95 platform, from what I have been experimenting and come to
understand if I used the WIN32::Process module I can bring up
the PKZIP for Windows program, however what I am trying to automate
running is "pkunzip" for DOS ie I am doing :
system ("c:\pkware\pkunzip $currfile");
My question is why doesn't this work ??
I understand shell invocation on UNIX and suspect that I need to
invoke the DOS shell to make this run but how and if there is a better
way to write perl scripts on WIN32 and be able to call external
programs easily.
Colin Foo
Tensor Engineering
cfoo@tensorex.com
------------------------------
Date: Mon, 16 Mar 1998 20:56:32 -0800
From: Jan Krynicky <jkry3025@comenius.ms.mff.cuni.cz>
To: Husky <huskystudio@geocities.com>
Subject: Re: Perl for Win32
Message-Id: <350E0280.6ACB@comenius.ms.mff.cuni.cz>
Husky wrote:
>
> I downloaded Perl for Win32 from http://www.activestate.com
> and install on my Windows NT 4.0 with IIS4 platform.
>
> I wrote a perl script in /Scripts lauched by a FORM in THML.
> When I use browser to submit the form, an eooro message appears:
> HTTP/1.0 501 Not support
>
> Does any one have the experience of Perl for Win32 vs. NT?
> Could you tell me why I can use this?
>
> Andrew Wang
Are you able to run scripts through browser?
I'd bet you don't. This message is pretty much always caused by
server misconfiguration.
Go to the Management Console and review the properties of
the directory. It MUST be executable, and .pl
(or .cgi if you use this extension) must be mapped to
'c:\perl\bin\perl.exe"%s" "%s"' or 'c:\perl\bin\PerlIS.dll'
<MORE>
Select properites. About half way down
you'll see a button "Configuration". It may be grayed out; if so,
just click on the "Create" button above it first. You don't need to
put anything in the "Name" box.
If you don't have an entry for perl, click on "Add" and put one in.
Jenda
------------------------------
Date: Mon, 16 Mar 1998 20:16:17 GMT
From: Michael Lepine <mlepine@bellsouth.net>
Subject: precedence problem
Message-Id: <350D8A07.D541672F@bellsouth.net>
I am using the following line of code in a script that I wrote ( it is a
very trivial line ):
`mv $Temp_File $Update_File` or die "Cannot
move\n$Temp_File\n\tTO\n$Update_File\n";
For some reason, both commands are being executed ( i.e. the file gets
moved and then the program dies printing the specified message ). I can
not figure it out. I have tried using eval and some other things but to
no avail. I am using perl 5 running on IRIX 6.2. Does anyone have any
suggestions???
Mike
------------------------------
Date: Mon, 16 Mar 1998 13:12:11 -0500
From: Russ Conway <russ_conway@cytec.gm.com>
Subject: Problem determining if system function worked
Message-Id: <350D6B7B.3EAA@cytec.gm.com>
I'm having trouble determining if this system() called worked.
$result = system('rename ' . $importFileName . ' ' . $archiveFileName);
$result seems to always equal 0. How can I determine if the rename was
successful? Is there a better way to do this than system()? I'm running
this script under Windows NT.
TIA
------------------------------
Date: 16 Mar 1998 18:46:58 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Problem determining if system function worked
Message-Id: <6ejs32$fhn@news-central.tiac.net>
In article <350D6B7B.3EAA@cytec.gm.com>,
Russ Conway <russ_conway@cytec.gm.com> wrote:
>I'm having trouble determining if this system() called worked.
>
>$result = system('rename ' . $importFileName . ' ' . $archiveFileName);
>
>$result seems to always equal 0. How can I determine if the rename was
>successful? Is there a better way to do this than system()? I'm running
>this script under Windows NT.
Have you checked out the move routine in File::Copy? I haven't tried it
on a Microsoft system, but perldoc File::Copy might be a worthwhile kite
to fly.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: Mon, 16 Mar 1998 20:07:59 +0100
From: joergen.lang@schwaben.de (Joergen W. Lang)
Subject: Re: redirect stderr and stdout to same file
Message-Id: <1d6022q.167s7by2c5wugN@host026-206.seicom.net>
<ruth@utdallas.edu> wrote:
> I want to redirect all STDOUT and STDERR to the same log file, to appear
> in the "right" order.
Have you tried CGI::Carp.pm ?
This module has a built-in error - redirection function - and it's part
of the Perl standard distribution, as far as I know.
Joergen
--
-------------------------------------------------------------------
"Everything is possible - even sometimes the impossible"
HOELDERLIN EXPRESS - "Touch the void"
-------------------------------------------------------------------
------------------------------
Date: Mon, 16 Mar 1998 11:55:55 +0800
From: Austin Schutz <spamsux-tex@habit.com>
Subject: Re: redirect stderr and stdout to same file
Message-Id: <350CA2CB.B64@habit.com>
ruth@utdallas.edu wrote:
>
> Hi,
> I'm running a perl script which calls several other perl scripts and other programs
> (written in C COBOL or whatnot).(this is for NT 4.0 machine).
> I want to redirect all STDOUT and STDERR to the same log file, to appear in the "right"
> order.
> I've tried
>
> #! .../perl
>
> $| = 1 ; # for flushing the buffers
>
> open (STDERR, ">> $filename");
>
You might try closing the handles before the open calls. My
guess is that since you are not checking the return of open() here
you are missing the failure.
Austin
#! .../perl
$| = 1 ; # for flushing the buffers
close (STDOUT);
close (STDERR);
open (STDOUT, ">> $filename") || warn "Couldn't open $filename, $!";
open (STDERR, ">> $filename") || warn "Couldn't open $filename, $!;
------------------------------
Date: Mon, 16 Mar 1998 13:04:40 -0500
From: John Porter <jdporter@min.net>
Subject: Re: regular expressions and control characters
Message-Id: <350D69B8.22C5@min.net>
Jonathan Feinberg wrote:
>
> #!/usr/bin/perl -w
> $_ = "abc^Udefg\n";
> s/\^([UD])/'"\c' . $1 . '"'/eeg;
> print;
As I have already pointed out to Uri in private correspondence,
this solution is "suboptimal" because of the enormous
performance penalty incurred by the double-eval.
It is also less readable/maintainable (IMHO) than this way:
s/\^([A-Z])/chr(unpack('C',$1) & 0x1F)/eg
hth,
John Porter
------------------------------
Date: 16 Mar 98 13:34:34 GMT
From: "James Richardson" <jamesr@aethos.co.uk.nospam>
Subject: Re: returning immediately from system call?
Message-Id: <01bd50e1$6d815ca0$26c0a4c1@kitkat.aethos.co.uk>
Erik Johnson <erik@phidias.colorado.edu> wrote in article
<34f1b44e.46922300@news.colorado.edu>...
> I've looked into the FAQ but come up empty handed (perhaps I don't
> know the right question to 'ask'?).
>
> Is there a way to have perl continue running after making a system
> call to launch another program, without waiting for the other program
> to complete?
Yup you call fork() and then exec().... It is in fact in the FAQ (I think
its under 'Forking a daemon process' (that's just from memory)
This is basically what system() does anyway (but it also waits for the
child to exit)
James
------------------------------
Date: 16 Mar 1998 11:44:55 -0800
From: mcravit@shell3.ba.best.com (Matthew Cravit)
Subject: Splitting a string to make keys to a hash
Message-Id: <6ejvfn$v4$1@shell3.ba.best.com>
I'm trying to split a string, and use the elements of the split as keys
to a hash. That is, if I have, for example, the string
"foo:bar:baz=99"
I'd like $SomeHash{foo}{bar}{baz} to be 99. The number of components in
the string will vary; otherwise this would be fairly trivial. There could
(at present) be as few as one and as many as 6 or 7 components before the
equals sign.
Can anyone suggest an elegant way of handling this?
TIA,
/MC
--
Matthew Cravit, N9VWG | Experience is what allows you to
E-mail: mcravit@best.com (home) | recognize a mistake the second
mcravit@net.com (work) | time you make it.
------------------------------
Date: Mon, 16 Mar 1998 20:30:44 GMT
From: jgloudon@manitoba.bbn.com (Jason Gloudon)
Subject: Re: Splitting a string to make keys to a hash
Message-Id: <slrn6gr2t3.ril.jgloudon@manitoba.bbn.com>
In article <6ejvfn$v4$1@shell3.ba.best.com>, Matthew Cravit wrote:
>to a hash. That is, if I have, for example, the string
>
>"foo:bar:baz=99"
>
>I'd like $SomeHash{foo}{bar}{baz} to be 99. The number of components in
>the string will vary; otherwise this would be fairly trivial. There could
>(at present) be as few as one and as many as 6 or 7 components before the
>equals sign.
>Can anyone suggest an elegant way of handling this?
If you know that : is not part of your keys you could take advantage of this
fact and do (truly elegant):
@keys= split /=/, $yourinput;
$SomeHash{$keys[0]} = $keys[1];
Or you could use recursively use references (not so elegant or time efficient
or as easy to understand), and I don't think I want to try to show an example
of that.
Jason Gloudon
------------------------------
Date: Mon, 16 Mar 1998 14:42:00 -0500
From: "I have a life, and I can prove it!" <jefpin@bergen.org>
To: Jesse Rosenberger <jesse@savalas.com>
Subject: Re: Splitting Arrays/Variables
Message-Id: <Pine.SGI.3.95.980316144100.13101B-100000@vangogh.bergen.org>
perlfunc -f split
>Question #1: I have a array named @arr, that has 4 numbers in
>it...numbers differ every time with a number 1-4...but the array
>contents look like "4 3 2 1", how can I split this array into 4 seperate
>variables... Example: I have an array: @arr = "3 4 2 1", I want $anum to
>equal 3, $bnum to equal 4, $cnum to equal 2, and $dnum to equal 1. I
>know it's pretty easy and I used to know how to do it but I seem to have
>forgotten after not doing it for a while.
($anum,$bnum,$cnum,$dnum) = @arr;
>Question #2: How can you take a variable that contains a word....that
>may contain spaces...and break each letter into a seperate
>variable...the word may be any length, but will probably not contain any
>characters besides letters, and spaces (let's assume it won't) how could
>I go about doing this?
@chars = split "", $string;
Check the man pages for the functions, please.
--
| Though the mills of God grind slowly, yet they grind exceeding
| small, though with patience He stands waiting, with exactness
| grinds He all.
| - Henry Wadsworth Longfellow
Jeff Pinyan | http://users.bergen.org/~jefpin | jefpin@bergen.org
techmaster@bergen.org | techmaster@mindless.com
qw[jeff] on #perl,#javascript,#cgi on IRC
&jp('"($``','','$)EDF8```','$*52J4```','$+E1G4```','#J``@','#2__`');sub
jp{for$w(@_){$c=unpack('B48',unpack('u',$w));$c=~tr/10/# /;print "$c\n"}}
------------------------------
Date: 16 Mar 1998 18:56:52 GMT
From: <soul@explorer.com>
Subject: still rename probs with MS IIS
Message-Id: <6ejslk$79o@news3.euro.net>
hi, posted a while ago with renaming problems on win32 perl.
i have since run the script from the perl command line and the rename
executes as intended, though when called with identical parameters from
a browser, $! always returns a "file not found" error.
even a simple test script with hardcoded filenames produces the same
results, correct renaming from the command line, and file not found when
called from a browser.
any assistance appreciated!
regards,
Christopher Paul
------------------------------
Date: Mon, 16 Mar 1998 13:19:27 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Tied and blessed?
Message-Id: <350D6D2F.44CA@min.net>
Jean-Louis Leroy wrote:
>
> Hello,
>
> I may soon have the need to tie a hash and have it behave like
> an object as well. Is that allowed?
Allowed? Bucko! It's intrinsic!
> I tried the following, which almost worked:
>
> package Test;
>
> sub new
> {
> return bless {}, shift;
> }
>
> sub test
> {
> print "ok\n";
> }
>
> sub TIEHASH
> {
> print "tied to $_[0]\n";
> return bless {}, $_[0];
> }
>
> sub FETCH
> {
> return 33;
> }
>
> sub STORE
> {
> print "STORE\n";
> }
>
> sub DESTROY
> {
> untie $_[0];
> print "destroyed\n";
> }
>
> package main;
>
> $t = new Test;
> tie %$t, Test;
> print "$t->{x}\n";
> $t->test;
Are you aware that the 'tie' function call returns a blessed
reference to an object of the given class?
perldoc perltie
my %h;
my $t = tie %h, Test;
$h{foo} = 'bar';
$t->test;
Remember that the tied hash (%h in this example) is magical.
The only direct access to it should be via hash operators,
while it's tied.
hth,
John Porter
------------------------------
Date: Mon, 16 Mar 1998 18:44:18 GMT
From: Pontus.Berglund@se.adsanker.com (Pontus Berglund)
Subject: Unable to capture output of Perl script under NT 4.0
Message-Id: <351072f3.528053390@Falun70>
Hi!
I'm running Apache under NT 4.0 w. SP3 and I'm trying to run Perl
scripts as CGI. My version of perl is the standard 5.004_02 port for
Win32. I've set up everything in the standard fashion, but the scripts
won't generate any output. This is what I get in the error log:
[Mon Mar 16 19:25:07 1998] [error] (2)No such file or directory:
couldn't spawn child process: c:/apache/cgi-bin/test.pl
I've come to the conclusion that the problem is that it's impossible
to capture the output of the scripts. I've tried to capture the output
of a simple test script with more, but nothing gets printed on the
screen.
The test script looks like this:
print "Content-Type: text/html\n\n";
print "Test\n";
In \Apache\cgi-bin this works:
perl test.pl | more
but this doesn't:
test.pl | more
What am I doing wrong?
[Pontus]
--
Name: Pontus Berglund
Homepage: http://come.to/pontus
ICQ UIN: 619869
E-Mail (Home): pontus.berglund@swipnet.se
E-Mail (Work): pontus@se.adsanker.com
PGP 5.0 key: http://come.to/pontus/Crypto/crypto.html
PGP key fingerprint: CDFE C72A C450 2D41 3FEC C8C7 CF93 E090
------------------------------
Date: 16 Mar 1998 18:36:01 GMT
From: jack_h_ostroff@groton.pfizer.com (Jack Ostroff)
To: tchrist@mox.perl.com (Tom Christiansen)
Subject: Re: User-interface Quandary
Message-Id: <6ejreh$2ma1@mascagni.pfizer.com>
Tom,
What about changing the first dropdown to:
contains the characters
contains the word(s)
exactly match the phrase
and then eliminating the second dropdown?
For the word(s) match - can they choose several
words? If so, must they match as a phrase, or does
the text really just need to contain each of them?
Perhaps one summary of this thread is that users
will almost always find a way to misunderstand,
so sometimes a wordier explanation/label is more
appropriate.
Jack -- jack_h_ostroff@groton.pfizer.com
(The trailing legal notice is automatically added by
my corporate firewall. There are no restrictions on
the distribution of this message.)
------------------------------
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 2110
**************************************