[18057] in Perl-Users-Digest
Perl-Users Digest, Issue: 217 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Feb 5 18:07:06 2001
Date: Mon, 5 Feb 2001 15:05:18 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <981414318-v10-i217@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 5 Feb 2001 Volume: 10 Number: 217
Today's topics:
Re: "Average of List of Numbers" by Abigail <mischief@velma.motion.net>
[ANNOUNCE] Compiling ActivePerl modules w/ MinGW (Mattia Barbon)
Access denied with JFS tradcarl@my-deja.com
Re: Apologies to Joyce Kilmer, a hack for your enjoymen <DNess@Home.Com>
Re: Apologies to Joyce Kilmer, a hack for your enjoymen <russ_jones@rac.ray.com>
Re: Comparing File and URL size (BUCK NAKED1)
Re: deleting some folders... <mischief@velma.motion.net>
Exit code from perl script <bradgwinn@hotmail.com>
Re: Exit code from perl script <ajborla@bigpond.com>
Re: getting line number n of a file <uri@sysarch.com>
Re: getting line number n of a file (Gwyn Judd)
Re: getting line number n of a file <joe+usenet@sunstarsys.com>
Re: getting line number n of a file (Craig Berry)
Help a novice? mr_griz@my-deja.com
Re: Help a novice? grehom@my-deja.com
Re: Help a novice? <krahnj@acm.org>
Re: Help with < nobull@mail.com
Re: Help! How to print range of array lines? (Craig Berry)
Re: How does sysopen function? nobull@mail.com
How to transfer config.sh (Csaba Raduly)
Is this a rename() bug??? richardstands@my-deja.com
Re: Is this a rename() bug??? bits101010@my-deja.com
Re: Localtime Question <hafateltec@hotmail.com>
Re: making a mail reciving script koen_dejonghe@my-deja.com
Re: Modules/Constants. <dorsettest@uk.insight.com>
newbie - grep non-used uid from passwd <kolisko@penguin.cz>
Re: newbie: Conditional statements <aqumsieh@hyperchip.com>
Params by .shtml <punches@zlob.net.ru>
perl & expect - STDOUT vs. redirect to file <bogus@bogus.com>
Re: perl & expect - STDOUT vs. redirect to file bits101010@my-deja.com
Re: perl & expect - STDOUT vs. redirect to file <amonotod@netscape.net>
Re: Perl implementation of UNIX tools <you.will.always.find.him.in.the.kitchen@parties>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 05 Feb 2001 21:13:40 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: "Average of List of Numbers" by Abigail
Message-Id: <t7u5s4l8eanb69@corp.supernews.com>
In comp.lang.perl.misc Terrence Brannon <brannon@lnc.usc.edu> wrote:
> The Museum of Modern Programming is proud to present its first work:
> "Average of List of Numbers" by Abigail.
> The Museum of Modern Programming: http://www.momp.org
on 5 February:
$ nslookup www.momp.org
Server: dns1.motion.net
Address: 216.1.104.12
*** dns1.motion.net can't find www.momp.org: Non-existent host/domain
Chris
--
Christopher E. Stith
Product shown enlarged to make you think you're getting more.
------------------------------
Date: Mon, 05 Feb 2001 21:38:27 GMT
From: mbarbon@dsi.unive.it (Mattia Barbon)
Subject: [ANNOUNCE] Compiling ActivePerl modules w/ MinGW
Message-Id: <903FE2E66rbootliberoit@192.106.1.6>
Hello,
I wrote a small document explaining how to compile
Perl modules for ActivePerl ( 6xx builds )
with MinGW ( GCC for Win32 ); see
http://wxperl.sourceforge.net/ap_mingw/
Tested modules ( AP build 616, 620 )
DBD::CSV 0.1022 Win2k
DBD::ODBC 0.28 Win2k
DBI 1.14 Win2k
SQL::Statement 0.1016 Win2k
Text::CSV_XS 0.20 Win2k
wxPerl 0.04 Win2k
Regards
Mattia
------------------------------
Date: Mon, 05 Feb 2001 20:14:42 GMT
From: tradcarl@my-deja.com
Subject: Access denied with JFS
Message-Id: <95n1j9$e9e$1@nnrp1.deja.com>
I am having trouble with a new file server. We
typically work with NTFS on Windows or HPFS on
OS2. We decided to go to JFS on some of our OS2
servers. Perl is not working from our Windows
machines. We have an OS2 Perl port that works
fine, but all of our different Windows ports get
access denied when trying to write files.
Reading is fine, but writing no so much.
I have tried versions 5.005_02 and 5.005_03.
Any experiences out there? This is not a user
permissions problem or anything easy like that.
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Mon, 05 Feb 2001 19:06:24 GMT
From: David Ness <DNess@Home.Com>
Subject: Re: Apologies to Joyce Kilmer, a hack for your enjoyment
Message-Id: <3A7EF9BC.CDBEAD9D@Home.Com>
Brendon Caligari wrote:
>
> cool....but who is joyce kilmer???
>
The eerie offspring of Val Kilmer and Dr. Joyce Brothers, famous for
perling when she should have nit (picked)... ;-)
------------------------------
Date: Mon, 05 Feb 2001 14:02:22 -0600
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Re: Apologies to Joyce Kilmer, a hack for your enjoyment
Message-Id: <3A7F06CE.6351D465@rac.ray.com>
Brendon Caligari wrote:
>
> In article <fHGe6.273433$hD4.66305660@news1.rdc1.mi.home.com>,
> clintp@geeksalad.org (Clinton A. Pierce) wrote:
>
> cool....but who is joyce kilmer???
>
Once again, I seem to have fallen amongst the Philistines.
--
Russ Jones - HP OpenView IT/Operatons support
Raytheon Aircraft Company, Wichita KS
russ_jones@rac.ray.com 316-676-0747
Cacatne ursus in sylvis? - Ovid
------------------------------
Date: Mon, 5 Feb 2001 13:39:17 -0600 (CST)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Comparing File and URL size
Message-Id: <18744-3A7F0165-51@storefull-243.iap.bryant.webtv.net>
> jdf@pobox.com (Jonathan=A0Feinberg)
> > whataman@home.com writes:
> > I am using LWP::Simple to "getstore($URL, $tmpfile);"
> > I want to compare the size of the URL > > file to the size of the
tmpfile, to make > > sure that the download was successful.
>
> Even if the transfer is successful, the sizes
> might be different, if the server and your > box are of platforms that
represent the
> end-of-line differently.
> If you wish to check the size of a remote > file using the LWP, please
see the
> section "HEAD" in the lwpcook manpage.
Thanks for your response, and for pointing out the fact that the file
sizes may be different, even though the transfer was successful. I
hadn't thought of that.
I've been studying lwpcook and am already using head($url) to check the
size of the URL. However, it's not working like I want it to. Perhaps
this is the problem...
Using LWP's "getstore($URL, $tmpfile)", I immediately put the URL into a
tmpfile. I check the filesize of the URL with head($URL), pulling it
from the 2nd part [1] of the "head" array. I, then, check the filesize
of my tmpfile with -s $tmpfile. I print them both, and they show the
exact same size, but when I call up the tmpfile, it is empty. Can you
tell me why?
FWIW... I'm doing the above on a BSDi server that uses Apache.
Regards,
Dennis
------------------------------
Date: Mon, 05 Feb 2001 20:45:38 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: deleting some folders...
Message-Id: <t7u47igmsn8cf9@corp.supernews.com>
Christian Gersch <c.gersch@team.isneurope.com> wrote:
>>Looks like it would work to me, if
>>unlink() were capable of removing a directory which is not empty. But
>>it won't even remove a directory unless you are superuser and Perl was
>>started with -U.
> Oh yes, why did I forget that? ;-)
> Ehmm...but how can the script
> a) check which directory is older than 5 minutes
> b) change to the directory
> c) delete the files in it
> d) delete the directory itself
perldoc -f opendir
perldoc -f readdir
perldoc -f stat
perldoc -f unlink
perldoc -f rmdir
or maybe the File::Find module would help.
> By the way: Of course I would pay for a good solution (= written script)
> :-))
>>You don't say what your platform is, but maybe system("rm -f -r $_")
>>would work in place of unlink. It might be slow.
> It a deciated server, running RedHat Linux 7, Apache and Perl 5 (its a dual
> processor system, not public - it should be fast enough ;-)
The Linux 'rm' should do you well then, unless you need to be portable
or want to program Perl by programming Perl ;)
--
Christopher E. Stith
Even in the worst of times, there is always someone who's
never had it better. Even in the best of times, there is
always someone who's never had it worse.
------------------------------
Date: Mon, 5 Feb 2001 14:51:59 -0600
From: "Brad A. Gwinn" <bradgwinn@hotmail.com>
Subject: Exit code from perl script
Message-Id: <gpEf6.443$cu.2150@gazette.loc1.tandem.com>
I'm calling a perl script from a batch file, and I'd like to return an exit
code from perl to be used as an ERRORLEVEL in the batch file. Apparently
the batch file doesn't see the perl 'exit 1;' as an errorlevel.
Any ideas?
Please respond directly as well....
Thanks,
Brad Gwinn
brad.gwinn@compaq.com
------------------------------
Date: Tue, 6 Feb 2001 09:52:22 +1100
From: "Anthony Borla" <ajborla@bigpond.com>
Subject: Re: Exit code from perl script
Message-Id: <%ZFf6.18469$65.92558@newsfeeds.bigpond.com>
"Brad A. Gwinn" <bradgwinn@hotmail.com> wrote in message
news:gpEf6.443$cu.2150@gazette.loc1.tandem.com...
> I'm calling a perl script from a batch file, and I'd like to return an
exit
> code from perl to be used as an ERRORLEVEL in the batch file. Apparently
> the batch file doesn't see the perl 'exit 1;' as an errorlevel.
>
As long as the value specified as a parameter to 'exit' is in the range 0 -
255, there should be no problem. If a negative value is specified, for
example, no errorlevel will be set and any previous value will remain (at
least this is the behaviour under NT 4.0, and, believe, other Win32
environments).
The problem may be in how you check for the errorlevel from your batch file.
The sample below shows how this should be done. Note:
* Check for 'errorlevel' immediately after the Perl script completes;
any intervening commands may set their own errorlevels, so wiping
out this information
* Always check from the highest expected value on down. Each errorlevel
check is *not* for equality but for 'greater than or equal to'.
Therefore, a
check for an errorlevel of 5 will match on the values 5 or greater (up to
255).
@echo off
:main
:: Execute Perl script, check for 'errorlevel' immediately after execution
perl sample.pl
if errorlevel 5 goto 5
if errorlevel 1 goto 1
:0
echo Errorlevel 0
goto exit
:5
echo Errorlevel 5
goto exit
:1
echo Errorlevel 1
:exit
I hope this helps.
------------------------------
Date: Mon, 05 Feb 2001 19:30:28 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: getting line number n of a file
Message-Id: <x7ofwhq65n.fsf@home.sysarch.com>
>>>>> "e" == egwong <egwong@netcom.com> writes:
>> % perl -ne 'print && last if $.=4'
e> ^^^^
e> Jesus.
e> % perl -ne 'print && last if $.==4'
minor golf swing:
perl -ne 'print && last if 4..4'
and if you were really concerned about golf, the last would go. but it
does speed up the one liner even if that is not crtitical with most text
files.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Mon, 05 Feb 2001 21:02:13 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: getting line number n of a file
Message-Id: <slrn97u56k.80v.tjla@thislove.dyndns.org>
I was shocked! How could Abigail <abigail@foad.org>
say such a terrible thing:
>From the PGA:
>
> perl -nwe '$.==4&&die$_' file
perl -e 'die((<>)[3])' file
This is blatantly assuming there are at least four lines in the input of
course.
--
Gwyn 'Call me Tiger' Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Just remember: when you go to court, you are trusting your fate to
twelve people that weren't smart enough to get out of jury duty!
------------------------------
Date: 05 Feb 2001 16:48:05 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: getting line number n of a file
Message-Id: <m38znkls2y.fsf@mumonkan.sunstarsys.com>
Uri Guttman <uri@sysarch.com> writes:
> >>>>> "e" == egwong <egwong@netcom.com> writes:
>
>
> >> % perl -ne 'print && last if $.=4'
> e> ^^^^
> e> Jesus.
>
> e> % perl -ne 'print && last if $.==4'
>
>
> minor golf swing:
>
> perl -ne 'print && last if 4..4'
>
> and if you were really concerned about golf, the last would go. but it
> does speed up the one liner even if that is not crtitical with most text
> files.
Here's two more:
% perl -e 'print $_=(<>,<>,<>,<>)' filename
% perl -pe '$\=$_ if 1..4 }{' filename
Joe Schaefer
--
"Go to Heaven for the climate, Hell for the company."
--Mark Twain
------------------------------
Date: Mon, 05 Feb 2001 21:52:50 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: getting line number n of a file
Message-Id: <t7u85i55ddt75d@corp.supernews.com>
Andre Bonhote (andre.bonhote@linux.ch) wrote:
: do you know a way to get eg. line number four of a file without too much
: code?
For files short enough to fit into memory, and from which you don't want
any other lines,
$line4 = (<FILE>)[3];
is probably about as short as you can get.
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "When the going gets weird, the weird turn pro."
| - Hunter S. Thompson
------------------------------
Date: Mon, 05 Feb 2001 21:00:22 GMT
From: mr_griz@my-deja.com
Subject: Help a novice?
Message-Id: <95n490$gsk$1@nnrp1.deja.com>
Hi,
I'm a real babe in the woods around here, but I'm hoping someone will
help me out.
I need a subroutine that will search a specified directory on a linux
server, and return a list of subdirectories. Is this something I can do
with PERL?
Thanks in advance,
Larry
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Mon, 05 Feb 2001 22:32:19 GMT
From: grehom@my-deja.com
Subject: Re: Help a novice?
Message-Id: <95n9lj$m50$1@nnrp1.deja.com>
I use something similar to this to do what I want when checking
files/directories on server - read docs shouldn't be too difficult
to create a *nix version:
#!perl -w
use strict;
use warnings;
my $ip_address = ""; # put sensible values in these 3 variables
my $user_name = "";
my $password = "";
use Win32::Internet;
my $INET = new Win32::Internet();
use vars qw( $FTP );
$INET->FTP($FTP, $ip_address, $user_name, $password);
$FTP->Cd("/user/xxx/site/kis/design_docs");
my @files = $FTP->List("*.*", 3);
foreach my $file (@files) {
print $file->{'name'}, " "
, $file->{'size'}, " "
, $file->{'mtime'}, "\n";
}
1;
In article <95n490$gsk$1@nnrp1.deja.com>,
mr_griz@my-deja.com wrote:
> Hi,
>
> I'm a real babe in the woods around here, but I'm hoping someone will
> help me out.
>
> I need a subroutine that will search a specified directory on a linux
> server, and return a list of subdirectories. Is this something I can
do
> with PERL?
>
> Thanks in advance,
>
> Larry
>
> Sent via Deja.com
> http://www.deja.com/
>
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Mon, 05 Feb 2001 22:36:41 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Help a novice?
Message-Id: <3A7F2C06.40B03139@acm.org>
mr_griz@my-deja.com wrote:
>
> Hi,
>
> I'm a real babe in the woods around here, but I'm hoping someone will
> help me out.
>
> I need a subroutine that will search a specified directory on a linux
> server, and return a list of subdirectories. Is this something I can do
> with PERL?
Yes.
perldoc -f opendir
perldoc -f readdir
perldoc -f -X
perldoc -f stat
> Thanks in advance,
You're welcome
John
------------------------------
Date: 05 Feb 2001 18:52:00 +0000
From: nobull@mail.com
Subject: Re: Help with <
Message-Id: <u9pugxdktr.fsf@wcl-l.bham.ac.uk>
"Joelle Lavergne" <jlavergne@drs.ca> writes:
> Hello all. I have no experience with perl.
Then you are about to get the "RTFM experience".
> I am trying to understand a script that I found on the
> internet. Everything is going pretty well except for a few statment
> that I cannot figure out.
I'd guess that's partly because the document you are reading is
corrupt. It would appear something somewhere has processed the
document you are reading though an HTML metacharacter escaping tool so
that '<' appears as '<'.
> Here goes:
>
> $x = 0;
> $y = 9;
> $z = 0;
>
>
> $x < < $y;
That's gibberish even once the '<' have been changed to '<'.
$x < < $y; # Error: Unterminated <> operator
$x << $y; # Warning: Useless use of left bitshift in void context
You say that this is a script that you found on the Internet? Do you
have any reason to suspect it is a working (or even syntactically
valid) script?
> if ($z < 7){
That should read
if ($z < 7){
> $x |= @$table[$z++]
Note the '@' in the above line would better be written as '$'.
> what is the meaning of this " |= " ?
It is an operator. (An composite assignment (aka mutator) operator as
it happens).
Perl operators are documented in the "perlop" manual. (perldoc perlop)
A list of Perl manuals can be found in the "perl" manual. (perldoc perl)
You can find the documentation on |= by looking for the string '|=' in
the perlop manpage.
Assignment Operators
"=" is the ordinary assignment operator.
Assignment operators work as in C. That is,
$a += 2;
is equivalent to
$a = $a + 2;
although without duplicating any side effects that
dereferencing the lvalue might trigger, such as from
tie(). Other assignment operators work similarly. The
following are recognized:
**= += *= &= <<= &&=
-= /= |= >>= ||=
.= %= ^=
x=
So that explains what |= does in terms of the | operator. Keep on
reading the manual to find out what the | operator does:
Binary "|" returns its operators ORed together bit by bit.
(See also the section on Integer Arithmetic and the
section on Bitwise String Operators.)
Follow that pointer and you find:
Bitwise String Operators
Bitstrings of any size may be manipulated by the bitwise
operators (~ | & ^).
If the operands to a binary bitwise op are strings of
different sizes, | and ^ ops will act as if the shorter
operand had additional zero bits on the right, while the &
op will act as if the longer operand were truncated to the
length of the shorter. Note that the granularity for such
extension or truncation is one or more bytes.
# ASCII-based examples
print "j p \n" ^ " a h"; # prints "JAPH\n"
print "JA" | " ph\n"; # prints "japh\n"
print "japh\nJunk" & '_____'; # prints "JAPH\n";
print 'p N$' ^ " E<H\n"; # prints "Perl\n";
If you are intending to manipulate bitstrings, you should
be certain that you're supplying bitstrings: If an operand
is a number, that will imply a numeric bitwise operation.
You may explicitly show which type of operation you intend
by using "" or 0+, as in the examples below.
$foo = 150 | 105 ; # yields 255 (0x96 | 0x69 is
0xFF)
$foo = '150' | 105 ; # yields 255
$foo = 150 | '105'; # yields 255
$foo = '150' | '105'; # yields string '155' (under
ASCII)
So to return to your question what is meant by...
$x |= $$table[$z++]
...depends on whether $x is initialised to a string or a number.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Mon, 05 Feb 2001 21:42:45 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Help! How to print range of array lines?
Message-Id: <t7u7ilmug9k387@corp.supernews.com>
Mark Jason Dominus (mjd@plover.com) wrote:
: for $lineno ($current_first .. $current_last) {
: print $array[$lineno];
: }
Or more concisely,
print @array[$current_first .. $current_last];
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "When the going gets weird, the weird turn pro."
| - Hunter S. Thompson
------------------------------
Date: 05 Feb 2001 19:20:36 +0000
From: nobull@mail.com
Subject: Re: How does sysopen function?
Message-Id: <u9itmpdji3.fsf@wcl-l.bham.ac.uk>
Dave Clews <Dave@inner-realm.co.uk> writes:
> Still I am unable to create or open the file,
> please tell me where I should be looking. The $! tells me that the
> file or directory dosen't exist, this is pantz because I know they do I
> have even checked the spelling to see if that was the error and no it
> wasn't.
Have you really? Have you checked it really very carefully? Have you
remebered that spaces in filenames are significant?
There are syntax errors in the code you have posted so we know it is
not really the code you are running. It could, therefore, be the
spaces are transcription errors.
Please always post actual code. If you post code with transcription
errors we can never know if we are finding the bugs in your code of
the errors in your transcription.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Mon, 5 Feb 2001 22:25:00 +0000 (UTC)
From: real.email@signature.this.is.invalid (Csaba Raduly)
Subject: How to transfer config.sh
Message-Id: <Xns903FE0DEAquuxi@194.203.134.135>
Compiling Perl 5.6.0 on OS/2 seems to be a function of location (i.e it
works for some, it doesn't for others :-). I'm in the happy position of
having succeeded; now I want to help out others less lucky.
If I send them my config.sh and/or Policy.sh, would that be enough for
them to just run Configure and hopefully be able to complete the build
? If yes, what switches do they need to give to Configure ? ( -der and
-S are suggested in config.sh )
--
Csaba Raduly, Software Developer (OS/2), Sophos Anti-Virus
mailto:csaba.raduly@sophos.com http://www.sophos.com/
US Support +1 888 SOPHOS 9 UK Support +44 1235 559933
You are in a maze of twisted little minds, all different.
------------------------------
Date: Mon, 05 Feb 2001 22:10:44 GMT
From: richardstands@my-deja.com
Subject: Is this a rename() bug???
Message-Id: <95n8cr$kur$1@nnrp1.deja.com>
This appears to be a bug, at least on Windows NT 4.0 with Active
State's Perl "v5.6.0 built for MSWin32-x86-multi-thread". If you
attempt to rename a file in the same directory with its valid Win32
short name rename() will return success(1) but won't rename the file:
#!perl -w
use strict;
use Win32;
my $foo = "d:\\temp\\this is a foo.txt";
my $bar = Win32::GetShortPathName( $foo );
# -OR-
# my $bar = "d:\\temp\\THISIS~1.TXT";
print rename( $foo, $bar ), "\n";
This prints "1" but the file is not renamed. It works if you simply
change the value of $bar to say "d:\\temp\\THISBE~1.TXT"
or "d:\\THISIS~1.TXT"(different target directory). Does anyone know why
this happens? Can it be fixed? Thanks :o)
-Rich
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Mon, 05 Feb 2001 22:39:13 GMT
From: bits101010@my-deja.com
Subject: Re: Is this a rename() bug???
Message-Id: <95na2f$mkb$1@nnrp1.deja.com>
The short name is still referring to the original file name (in short
form only). You haven't changed it at all.
In article <95n8cr$kur$1@nnrp1.deja.com>,
richardstands@my-deja.com wrote:
> This appears to be a bug, at least on Windows NT 4.0 with Active
> State's Perl "v5.6.0 built for MSWin32-x86-multi-thread". If you
> attempt to rename a file in the same directory with its valid Win32
> short name rename() will return success(1) but won't rename the file:
>
> #!perl -w
>
> use strict;
> use Win32;
>
> my $foo = "d:\\temp\\this is a foo.txt";
>
> my $bar = Win32::GetShortPathName( $foo );
> # -OR-
> # my $bar = "d:\\temp\\THISIS~1.TXT";
>
> print rename( $foo, $bar ), "\n";
>
> This prints "1" but the file is not renamed. It works if you simply
> change the value of $bar to say "d:\\temp\\THISBE~1.TXT"
> or "d:\\THISIS~1.TXT"(different target directory). Does anyone know
why
> this happens? Can it be fixed? Thanks :o)
>
> -Rich
>
> Sent via Deja.com
> http://www.deja.com/
>
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 6 Feb 2001 08:07:21 +1000
From: "Mike McPherson" <hafateltec@hotmail.com>
Subject: Re: Localtime Question
Message-Id: <95n86v$5in$1@brokaw.wa.com>
Hey what can I say... It is an asignment that requires I don't use
perlmods...
------------------------------
Date: Mon, 05 Feb 2001 21:58:02 GMT
From: koen_dejonghe@my-deja.com
Subject: Re: making a mail reciving script
Message-Id: <95n7l4$k7o$1@nnrp1.deja.com>
> Eih bennek, eih blavek.
Ennik, ik keusse min skippe of. Saluu.
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Mon, 05 Feb 2001 19:07:29 +0000
From: Kelly Dorset <dorsettest@uk.insight.com>
Subject: Re: Modules/Constants.
Message-Id: <3A7EF9F1.DD0E2F55@uk.insight.com>
> When that script is used by the coms modules, here is the error:
>
> Bareword "C_LOGIN" not allowed while "strict subs" in use at
> /scripts/include/coms.pm line 95 (#1)
>
> (F) With "strict subs" in use, a bareword is only allowed as a
> subroutine identifier, in curly brackets or to the left of the "=>"
> symbol.
> Perhaps you need to predeclare a subroutine?
>
> Bareword "C_MSG_SEND" not allowed while "strict subs" in use at
> /scripts/include/coms.pm line 120 (#1)
>
> etc etc for each of the constants exported.
>
> I'm guess it must be a problem in the way I'm using exported here.. but
> I have no clue really..
>
> Thank!
Just to add to the confusion.. but perhaps aid a resolution, the first
script, can reference the constants, but the second coms script (which
is also useing the constants script) cannot and generates those errors.
k
------------------------------
Date: Mon, 5 Feb 2001 17:24:49 +0100
From: "- = k o l i s k o = -" <kolisko@penguin.cz>
Subject: newbie - grep non-used uid from passwd
Message-Id: <3a7ed39c$1@news.cvut.cz>
Hello!
I am newbie to perl.
Is possible to grep from my /etc/passwd the 1st non-used uid in
range from 100 to 999?
ex:
user1:x:100:100:....
user2:x:101:100:....
user3:x:102:100:....
user4:x:106:100:....
user5:x:107:100:....
user6:x:108:100:....
In this example is 1st non-used uid '103' ...
Tx.
--
S pozdravem,
Michal Kolesar
kolisko@penguin.cz
http://www.egarden.cz
server of free unix services
------------------------------
Date: Mon, 05 Feb 2001 19:39:40 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: newbie: Conditional statements
Message-Id: <7a7l34vs03.fsf@merlin.hyperchip.com>
Epiphany <epiphany1@my-deja.com> writes:
> I'm having a hard time with and "if else" statement.
It's very hard to tell you what your problem is since you don't give us
enough information. Maybe you're confused by the fact that 'else if' is
written as 'elsif' in Perl?
--Ala
------------------------------
Date: Tue, 6 Feb 2001 00:04:55 +0300
From: "Punches" <punches@zlob.net.ru>
Subject: Params by .shtml
Message-Id: <95n5lb$2pr$1@news.sovam.com>
How to pass parametrs to perl-script using shtml-document?
It must look like this:
http://coolsite.com/main.shtml?param1=value1¶m2=value2
------------------------------
Date: Mon, 05 Feb 2001 14:40:52 -0600
From: Perl User <bogus@bogus.com>
Subject: perl & expect - STDOUT vs. redirect to file
Message-Id: <3A7F0FD4.DE031DC1@bogus.com>
Hello, I need your help:
I have a perl script (prog1) that calls another perl script
(prog2) that uses expect to contact a remote host to execute a command.
When I run prog1 on the command with STDOUT going to the screen, I
get the output in the following order:
$ prog1
1) some output from prog1
2) output from prog2, including the output from the remote
command
3) some more output from prog1
When I redirect the output to a file, I get the output in the
following order
$ prog1 >/tmp/out
$ cat /tmp/out
2) output from prog2, including the output form the remote
command
1) some output from prog1
3) some more output from prog 1
I've set $AUTOFLUSH in prog1 to 1, but it doesn't help.
I've tried to use tee, but that outputs the incorrect order
to both the screen and file.
Any ideas on how I can capture the same output in the file as
I get to the screen?
Thanks in advance,
MJB
------------------------------
Date: Mon, 05 Feb 2001 22:43:54 GMT
From: bits101010@my-deja.com
Subject: Re: perl & expect - STDOUT vs. redirect to file
Message-Id: <95nab7$n07$1@nnrp1.deja.com>
Try adding $|++; to both programs.
In article <3A7F0FD4.DE031DC1@bogus.com>,
Perl User <bogus@bogus.com> wrote:
> Hello, I need your help:
>
> I have a perl script (prog1) that calls another perl script
> (prog2) that uses expect to contact a remote host to execute a
command.
> When I run prog1 on the command with STDOUT going to the screen, I
> get the output in the following order:
>
> $ prog1
>
> 1) some output from prog1
> 2) output from prog2, including the output from the remote
> command
> 3) some more output from prog1
>
> When I redirect the output to a file, I get the output in the
> following order
>
> $ prog1 >/tmp/out
> $ cat /tmp/out
>
> 2) output from prog2, including the output form the remote
> command
> 1) some output from prog1
> 3) some more output from prog 1
>
> I've set $AUTOFLUSH in prog1 to 1, but it doesn't help.
>
> I've tried to use tee, but that outputs the incorrect order
> to both the screen and file.
>
> Any ideas on how I can capture the same output in the file as
> I get to the screen?
>
> Thanks in advance,
> MJB
>
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Mon, 05 Feb 2001 22:49:51 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: perl & expect - STDOUT vs. redirect to file
Message-Id: <95namc$n67$1@nnrp1.deja.com>
In article <3A7F0FD4.DE031DC1@bogus.com>,
Perl User <bogus@bogus.com> wrote:
> Hello, I need your help:
>
> I have a perl script (prog1) that calls another perl script
> (prog2) that uses expect to contact a remote host to execute a
<snip>
> Any ideas on how I can capture the same output in the file as
> I get to the screen?
http://www.deja.com/dnquery.xp?ST=QS&DBS=2&groups=comp.lang.perl.misc&QR
Y=redirect+stdout&svcclass=dncurrent
>
> Thanks in advance,
> MJB
>
amonotod
--
`\|||/ amonotod@
(@@) netscape.net
ooO_(_)_Ooo________________________________
_____|_____|_____|_____|_____|_____|_____|_____|
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 6 Feb 2001 11:02:29 +1300
From: "Tintin" <you.will.always.find.him.in.the.kitchen@parties>
Subject: Re: Perl implementation of UNIX tools
Message-Id: <981410620.571635@shelley.paradise.net.nz>
<jbenshet@my-deja.com> wrote in message news:95mn2b$3kh$1@nnrp1.deja.com...
> I recall that there is an effort to implement many standard UNIX tools
> in Perl so they are available on other platforms. As I'm stuck on NT
> right now, I'd love to find some of these. Where can I get them?
Why not just install cygwin tools?
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 V10 Issue 217
**************************************