[15684] in Perl-Users-Digest
Perl-Users Digest, Issue: 3097 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 19 11:05:33 2000
Date: Fri, 19 May 2000 08:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <958748713-v9-i3097@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 19 May 2000 Volume: 9 Number: 3097
Today's topics:
Re: [ CGI ] Can you know how long someone stayed connec (Michel Dalle)
a script's own fullpath, when run in crontab <eng40490@yahoo.com.sg>
Re: Accurate IP return? <flavell@mail.cern.ch>
Re: Accurate IP return? newsposter@cthulhu.demon.nl
Re: Array Question <sweeheng@usa.net>
Best way to let a program sleep ? <e.bras@hccnet.nl>
Re: Best way to let a program sleep ? <sweeheng@usa.net>
Re: Best way to let a program sleep ? (Teodor Zlatanov)
Re: curses - how to ? <bert@scanlaser.nl>
Re: Data Structures (complex) (Tad McClellan)
Re: Data Structures (complex) <jeff@vpservices.com>
Re: How can I tell if there is data in a pipe without d <rootbeer@redcat.com>
Re: integer ops: mod, etc: WHERE? <bert@scanlaser.nl>
Re: matching question(s) <bill.kemp@wire2.com>
Re: matching question(s) (Eric Bohlman)
Newbie asks how to split file by x number of lines? <y-o-y@home.com>
Re: Newbie asks how to split file by x number of lines? <peckert@epicrealm.com>
Re: Newbie asks how to split file by x number of lines? <jeff@vpservices.com>
Newbie to hash. (HELP) <apage.net[remove]@usa.net>
Re: Newbie to hash. (HELP) <sweeheng@usa.net>
Opening a file from another server <f.lalane@no-spam.pra.org.uk>
Re: Opening a file from another server <jeff@vpservices.com>
problems with compilation... <matthebraveone@yahoo.com>
Re: Q: children, signals, etc... <rootbeer@redcat.com>
Q: Reading from STDIN, pipe first, then keyboard (Pascal Haakmat)
Re: Rename all files in a directory <sweeheng@usa.net>
Return Codes <al.smith@mail.tju.edu>
Re: Return Codes <jeff@vpservices.com>
rounding numbers <Igor@fiveonline.com>
Re: rounding numbers (Bernd Witzgall)
Re: SNMP via Perl <peckert@epicrealm.com>
Re: Socket Connect Timeout <sweeheng@usa.net>
Re: Threads and Perl for Win32 <LeonardT@Intelis-Inc.Com>
Re: TNA <gellyfish@gellyfish.com>
Re: Using user-variables in external commands? II <bernie@fantasyfarm.com>
Windows: Accesing a DLL <mikesnews@stakeholderuk.org>
Re: Windows: Accesing a DLL <apage.net[remove]@usa.net>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 19 May 2000 10:13:32 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: [ CGI ] Can you know how long someone stayed connected?
Message-Id: <8g3475$esa$1@news.mch.sbs.de>
In article <8g1ou7$1da$1@news3.isdnet.net>, "Charles Henry" <charles.henry@engineer2k.com> wrote:
>> rather than how long the socket stays open.
>
>Sorry Brian but I am not sure to understand (newbie here).
>Could you explain me what you mean or, possibly, redirect me to a newsgroup
>or Website where I could learn more about those so-called sockets?
brian probably forgot to include the necessary :-) here.
For the question "to know how much long someone has
remained connected to my server", the technical answer
would indeed be to log the time between the first accept()
and the last recv() of 0 bytes or close().
This is most likely NOT what you're interested in, though,
so forget you ever heard about sockets. :)
You might want to check out some webserver log analysis
tools. You'll find some relevant Perl scripts at :
http://cgi.resourceindex.
com/Programs_and_Scripts/Perl/Logging_Accesses_and_Statistics/
Good luck,
Michel.
------------------------------
Date: Fri, 19 May 2000 18:18:43 +0800
From: ahnew <eng40490@yahoo.com.sg>
Subject: a script's own fullpath, when run in crontab
Message-Id: <39251503.24862435@yahoo.com.sg>
if i submit a351.pl as a cron job, i can't get a351.pl's fullpath. i
have tried $0, `pwd`, cwd()
please reply to victor@catchacorp.com
------------------------------
Date: Fri, 19 May 2000 12:11:36 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Accurate IP return?
Message-Id: <Pine.GHP.4.21.0005191155250.4238-100000@hpplus01.cern.ch>
On Wed, 17 May 2000, [TNN]G.Bloke wrote:
> Thanks....I was aware of the problems of obtaining the correct IP address
You gave no indication of it previously - quite the opposite.
> I was also aware why $ENV{REMOTE_HOST} didn't work, I just wondered if there
> was a better perl alternative to this.
Perl is a programming language. Your assumption is a category error,
and I have the distinct impression (based partly on your inappropriate
rudeness to those who answered your question) that you haven't even
started to understand the answers you already got.
As I said at the start, your hope of using the calling IP address that
is seen by the server to prevent multiple voting is misconceived and
cannot work in a WWW context. You have already been told this, with
appropriate explanations, but they seem to have gone over your head.
Merely discussing some trivial Perl language issue of how to get that
IP address (which is, of course, defined in the CGI specification) is
to miss the whole point.
You wrote:
> One day usenet users will just answer the question. (hopefully)
This too is misconceived, as well as being effectively an FAQ. On the
present evidence this too will go over your head, but it might help
some other lurkers: http://www.plover.com/~mjd/perl/varvarname.html
|When people come into comp.lang.perl.misc asking how to do something
|stupid, I'm never quite sure what to do. I can just answer the
|question as asked, figuring that it's not my problem to tell people
|that they're being stupid. [...]
------------------------------
Date: 19 May 2000 14:02:10 GMT
From: newsposter@cthulhu.demon.nl
Subject: Re: Accurate IP return?
Message-Id: <8g3hh2$kep$1@internal-news.uu.net>
Alan J. Flavell <flavell@mail.cern.ch> wrote:
Someone wrote:
>> One day usenet users will just answer the question. (hopefully)
> This too is misconceived, as well as being effectively an FAQ. On the
> present evidence this too will go over your head, but it might help
> some other lurkers: http://www.plover.com/~mjd/perl/varvarname.html
And http://www.plover.com/~mjd/perl/Questions.html
Erik
------------------------------
Date: Fri, 19 May 2000 21:42:51 +0800
From: "Swee Heng" <sweeheng@usa.net>
Subject: Re: Array Question
Message-Id: <8g3fn9$74m$1@mawar.singnet.com.sg>
> I am been playing with multidimentional associative arrays. I am
> getting the hang of it, but cannot figure out one thing: How the heck
> do you add rows to the array? For example, if I have this array:
>
>
%pers_record=('Bogdan'=>{'Address'=>'C1605','Phone'=>'x7869','College'=>'BMC
'})
>
> Now, I want to add another row, with another persons name, how do I do
> it? I cannot seem to find a way without destroying the original
> element..........
The short answer:
$pers_record{'Mickey'} = {
'Address' => 'Disney',
'Phone' => 'x1234',
'College' => 'ACME'
};
To verify:
use Data::Dumper;
print Dumper \%pers_record;
Swee Heng
------------------------------
Date: Fri, 19 May 2000 13:43:03 +0200
From: "Ed Bras" <e.bras@hccnet.nl>
Subject: Best way to let a program sleep ?
Message-Id: <8g39qg$gs0$1@news.hccnet.nl>
Can someone please tell how to let a program sleep in a GOOD way.
I use "system('sleep')" now, but was wondering if there is better way to do
this considering the system performance, and that Perl has several ways to
do this
What I want to do ?
Monitor files that come in by ftp. I want to see if new files arrive every
minute and do something with it.
Regards,
Ed Bras
------------------------------
Date: Fri, 19 May 2000 20:29:23 +0800
From: "Swee Heng" <sweeheng@usa.net>
Subject: Re: Best way to let a program sleep ?
Message-Id: <8g3bdo$9os$1@mawar.singnet.com.sg>
> I use "system('sleep')" now, but was wondering if there is better way to
do
> this considering the system performance, and that Perl has several ways to
> do this
Just wondering, why do you use "system('sleep')" when you can use
"sleep"?There are other ways of doing it which offer finer granularity, eg.
select, Time::HiRes. (read "perldoc -f sleep")
Regarding system performance, I don't know enough to comment. My personal
opinion is that "process sleeping", being a native Unix concept, should be
pretty optimized in Perl.
------------------------------
Date: 19 May 2000 09:58:15 -0500
From: tzz@iglou.com (Teodor Zlatanov)
Subject: Re: Best way to let a program sleep ?
Message-Id: <39254877$1_2@news.iglou.com>
<8g39qg$gs0$1@news.hccnet.nl>:Ed Bras (e.bras@hccnet.nl):comp.lang.perl.misc:Fri, 19 May 2000 13:43:03 +0200:quote:
: Can someone please tell how to let a program sleep in a GOOD way.
:
: I use "system('sleep')" now, but was wondering if there is better way to do
: this considering the system performance, and that Perl has several ways to
: do this
perldoc -f sleep : the sleep function
perldoc -q sleep : How can I sleep for less than a second?
: What I want to do ?
: Monitor files that come in by ftp. I want to see if new files arrive every
: minute and do something with it.
Depending on your OS, there may be a better sollution than polling. Ask on
the newsgroup specific to your OS, and read the FAQs. For most purposes,
polling is sufficient though. You may want to use locking to prevent
incoming files from being processed before they are written out completely.
--
Teodor Zlatanov <tzz@iglou.com>
"Brevis oratio penetrat colos, longa potatio evacuat ciphos." -Rabelais
------------------------------
Date: Fri, 19 May 2000 14:02:55 +0200
From: Bert IJff <bert@scanlaser.nl>
To: Marc Pestana <markp@mail1.jpl.nasa.gov>
Subject: Re: curses - how to ?
Message-Id: <39252D6F.2ADA9CEA@scanlaser.nl>
Marc Pestana wrote:
>
> Can someone help me with a question about the use of the perl module
> CURSES
>
> $mySubwin # is a sub window I create using the curses
> # function subwin.
> $char # character scalar
>
> I'm using the following code to get characters from a F-secure VT100
> terminal emulator on a Mac (OS 8.6) client, HP unix host supporting
> curses(5).
>
> raw;
> noecho;
> $char = getch($mySubwin);
> move($mySubwin,0,0);
> addstr($mySubwin,$char);
> refresh($mySubwin);
>
> the output for most keys is as expected. But, the arrow keys produce the
>
> values A,B,C,D. If, however, I use the following code (using getstr
> instead of getch)
>
> raw;
> noecho;
> getstr($mySubwin,$char);
> move($mySubwin,0,0);
> addstr($mySubwin,$char);
> refresh($mySubwin);
>
> the arrow keys produce the following output on my screen: ^[[A, ^[[B,
> etc. I need to obtain unique code for these keys. Any ideas.
That's correct, these strings can be interpreted as
^[ escape chararcter, ASCII char 033 (octal) or 27 (decimal) or 1B
(hex)
[ yes, the character '['
A for up arrow
B for down arrow
C for right arrow
D for left arrow
did you have a look at the pages coming up with
man -k termcap
Did you have a look at the VT100 entry in /etc/termcap ?
and of course the Term::Cap - Perl termcap interface
All these might give you clues on how to do whatever it is you want to
do.
Regards,
Bert
------------------------------
Date: Fri, 19 May 2000 06:55:36 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Data Structures (complex)
Message-Id: <slrn8ia7d8.7pd.tadmc@magna.metronet.com>
On 19 May 2000 03:48:00 GMT, The WebDragon <nospam@devnull.com> wrote:
>working with a CGI form script that creates a database of the form:
> gametype|reviewername|mapname|
[snip]
>where there are 7 gametypes, 15 reviwers and a choice of around 1450 maps to
>review.
[snip]
>my problem is that I am not exactly certain which type of complex hash I requre.
>if I read in the database.txt file like this:
>
>open(IN, "<database.txt");
Except your real code will check the return value from open(), right?
:-)
> chomp(@database = <IN>);
>close IN;
>
>foreach (@database) {
> my($type, $reviewer, $map) = split /\|/;
> $masterlist{$type}{$reviewer} = $map;
>}
>
>my question becomes -fold --
>
>A> Is this the best way to format this data, when a gametype will have several
>reviewers listed under it, and each reviewer may have 1 or more maps listed
^^^^^^^^^^^^^^
>after their name, UNDER that gametype.. then we proceed to the next gametype,
>and so on.
That is not the best way, because it allows only 1 map/reviewer.
>B> if I want to append a LIST to $masterlist{$type}{$reviewer},
You do not want to append a LIST. You want to append an ARRAY.
"list" and "array" are not interchangeable, they mean different things.
>how do I write
>it properly, if they are going to be added one at a time? Would I write it like
>this?
>
>$masterlist{$type}{$reviewer} .= [$map]; # would this work?
That isn't it.
push @{$masterlist{$type}{$reviewer}}, $map;
and let perl autovivify the anonymous array for you.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 19 May 2000 06:06:17 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Data Structures (complex)
Message-Id: <39253C49.BFB6AB6E@vpservices.com>
The WebDragon wrote:
>
> In article <3924C8F1.977527E6@vpservices.com>, Jeff Zucker
> <jeff@vpservices.com> wrote:
>
> | that is the route you want to go. But since you have a database, why
> | not treat it like a database and use DBD::CSV or DBD::RAM? With those
>
> Hmm.. not part of the current MacPerl build .. Assuming these are on CPAN, I
> wonder if they have been tested for compatibility on Macs? I'll have to peek
> around <http://testers.cpan.org/> to be sure.
It looks like DBD::CSV has passed on MACOS_68k and therefore DBD::RAM
should do fine also since the only non-pure-Perl part of DBD::RAM is the
SQL::Statement module that is also used by DBD::CSV.
--
Jeff
------------------------------
Date: Fri, 19 May 2000 06:51:56 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: How can I tell if there is data in a pipe without doing a blocking read? & Possible Async bug - example given
Message-Id: <Pine.GSO.4.10.10005190646300.23375-100000@user2.teleport.com>
On Thu, 18 May 2000, rgb wrote:
> Subject: How can I tell if there is data in a pipe without doing a blocking
read? & Possible Async bug - example given
Do you want the four-arg form of select?
> select looked very promising, but its return code (which i thought to
> be which index into the vec has data) doen't seem to always be that???
You may have misunderstood the docs; that's not the return value. See your
system's system(3c) (or similar) manpage. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 19 May 2000 12:56:44 +0200
From: Bert IJff <bert@scanlaser.nl>
To: Andreas Kahari <andkaha@my-deja.com>
Subject: Re: integer ops: mod, etc: WHERE?
Message-Id: <39251DEC.529B7514@scanlaser.nl>
Andreas Kahari wrote:
>
> In article <8frok2$9r$1@slb1.atl.mindspring.net>,
> dkcombs@netcom.com (David Combs) wrote:
> > I've grepped the pods (GTFM), including the faqs,
> > looked in the index of PP and CB -- no "mod" at all,
> > and the only refs to integer that aren't totally
> > irrevelant are for "use integer".
> >
> > Yeah, I did find LOTs of mods in ONE file: op.c!
> >
> > These things are pretty important when trying to
> > group things for histograms or hash-buckets; every
> > OTHER programming language has them, perl must too.
> >
> > WHERE?
> >
> > (of course, I've probably grepped for the wrong
> > string, but "mod" is a fairly standard term!)
> >
> > (Oh, I searched in "word mode" -- without that
> > there'd be 10,000 hits for module, etc)
> >
> > Thanks!
> >
> > David
> >
> >
>
> You mean "modulo", as in
>
> if ($i % 2) { print "$i is even\n" }
Actually this should be
if ($i % 2) { print "$i is ODD\n" }
>
> Use '%' as in C and C++, see the perlop manual.
>
> /A
>
> --
> # Andreas Kähäri, <URL:http://hello.to/andkaha/>.
> # All junk email is reported to the appropriate authorities.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: Fri, 19 May 2000 12:39:01 +0100
From: "W Kemp" <bill.kemp@wire2.com>
Subject: Re: matching question(s)
Message-Id: <958736430.16532.0.nnrp-13.c3ad6973@news.demon.co.uk>
> $_="@all_keys";
I might be wrong, but isn't that an array being evaluated in a scalar
context?
so $_ would be the number of elements in the array?
------------------------------
Date: 19 May 2000 12:16:47 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: matching question(s)
Message-Id: <8g3bbf$sbl$2@slb0.atl.mindspring.net>
W Kemp (bill.kemp@wire2.com) wrote:
:
: > $_="@all_keys";
:
:
: I might be wrong, but isn't that an array being evaluated in a scalar
: context?
: so $_ would be the number of elements in the array?
Nope. It's an array being interpolated into a double-quotish string, with
the elements separated by whatever is in $" (a space by default).
------------------------------
Date: Fri, 19 May 2000 13:32:28 GMT
From: A <y-o-y@home.com>
Subject: Newbie asks how to split file by x number of lines?
Message-Id: <MnbV4.200204$Tn4.1684475@news1.rdc2.pa.home.com>
Hi folks,
I was looking for a file splitter to split a 200+ mb file into files of
50,000 (or x) lines each.
Someone suggested MacPerl. But it's not what I thought. It could take
weeks just learning Perl.
Any help?
Andy
------------------------------
Date: Fri, 19 May 2000 13:34:26 GMT
From: Paul Eckert <peckert@epicrealm.com>
Subject: Re: Newbie asks how to split file by x number of lines?
Message-Id: <392541CD.859C226B@epicrealm.com>
Howdy.
Although you could easily write a script to do this in perl, if you're on a
linux
or Unix box, try split. man split gives:
split - split a file into pieces
SYNOPSIS
split [-linecount | -l linecount ] [ -a suffixlength ] [
file [ name ] ]
split -b n [k | m ] [ -a suffixlength ] [ file [ name ]
]
DESCRIPTION
The split utility reads file and writes it in linecount-
line pieces into a set of output-files. The name of the
first output-file is name with aa appended, and so on lexi-
cographically, up to zz (a maximum of 676 files). The max-
imum length of name is 2 characters less than the maximum
filename length allowed by the filesystem. See statvfs(2).
If no output name is given, x is used as the default
(output-files will be called xaa, xab, and so forth).
Paul
A wrote:
>
> Hi folks,
>
> I was looking for a file splitter to split a 200+ mb file into files of
> 50,000 (or x) lines each.
>
> Someone suggested MacPerl. But it's not what I thought. It could take
> weeks just learning Perl.
>
> Any help?
>
> Andy
--
Paul Eckert
Sr. Software Engineer
Epicrealm Inc.
1651 N. Glenville Dr., Suite 212
Richardson, TX 75081
(972) 479-0135 x300
peckert@epicrealm.com
------------------------------
Date: Fri, 19 May 2000 06:59:27 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Newbie asks how to split file by x number of lines?
Message-Id: <392548BF.DBA62C87@vpservices.com>
A wrote:
>
> Hi folks,
>
> I was looking for a file splitter to split a 200+ mb file into files of
> 50,000 (or x) lines each.
>
> Someone suggested MacPerl. But it's not what I thought. It could take
> weeks just learning Perl.
Ah, but they would be weeks well spent :-) And they would save you
months of work on down the line :-)
But to answer your more immediate question. There is something called
the PPT, Perl Power Tools Project that makes UNIX-like tools available
from within Perl. There is a PPT version of the UNIX split program. So
you could accomplish your goal like this:
1. Install MacPerl
2. Download PPT Split from:
http://language.perl.com/ppt/src/split/index.html
3. Then from the command line:
perl split -b50k name-of-file
Not too hard. And there are options to split by lines rather than
bytes, or to give specific names to the output files. It has limits
though. It won't split any single file into more than 17,576 individual
files. Bummer! :-)
--
Jeff
------------------------------
Date: Fri, 19 May 2000 08:26:19 -0400
From: "Zowwie" <apage.net[remove]@usa.net>
Subject: Newbie to hash. (HELP)
Message-Id: <siacn7i5ius182@corp.supernews.com>
Howdy all,
I hope someone can assist me with this little problem here.... I have not
worked with hashes much (as you can tell) and would love some assistance
here.
Here is my hash assignment:
%default_text_size = (
tiny => '5X8',
small => '6X12',
medium => '7X13', #bold (default)
large => '8X16',
giant => '9X15', #bold
);
Here is some inbound data that contains the word "large".
$box_memory_cells[3] (This contains the word "large")
Now... This is what I need to do...
I must look at $box_memory_cells[3] and determine what word they have tiny,
small, etc.
Then... I need to take that word, and compare it against the hash so I may
assign the actual size of large (8X16) to another scalar.
$new_size=$default_text_size {large} (This one works... But its not what I
need.
Here are the two methods I have tried with no luck...
$new_size=$default_text_size {$box_memory_cells[3]} (No go here...) :(
*If something similar to this would work... That would be great.
I also tried.....
foreach $default_box_size (keys %ENV){
if ($box_memory_cells[3] eq $key){
$new_size=$ENV{$key};
}
}
Please post any replies to both the group and my regular email. (remove the
anti-spam).
Thank you in advance for your time and assistance.
Zowwie
apage.net@[no_spam]usa.net
--Thank you Mr. Wall!
------------------------------
Date: Fri, 19 May 2000 20:51:42 +0800
From: "Swee Heng" <sweeheng@usa.net>
Subject: Re: Newbie to hash. (HELP)
Message-Id: <8g3cnq$9eg$1@mawar.singnet.com.sg>
> Here are the two methods I have tried with no luck...
> $new_size=$default_text_size {$box_memory_cells[3]} (No go here...) :(
> *If something similar to this would work... That would be great.
Are you quite sure it does not work? Did you get some error message? The
following code, copied verbatim from yours, DOES work.
====
%default_text_size = (
tiny => '5X8',
small => '6X12',
medium => '7X13', #bold (default)
large => '8X16',
giant => '9X15', #bold
);
$box_memory_cells[3] = 'large';
$new_size = $default_text_size {$box_memory_cells[3]};
print "$new_size\n";
====
------------------------------
Date: Fri, 19 May 2000 15:45:17 +0100
From: "Franck Lalane" <f.lalane@no-spam.pra.org.uk>
Subject: Opening a file from another server
Message-Id: <958747514.9624.0.nnrp-08.9e9872de@news.demon.co.uk>
Hello,
I have a search engine in perl running for an Intranet.
When I create the result list, I must open the files to get the title I will
display.
Everything works fine with all the files from the server running the script.
(I use the physical path related to the server)
The problem is that we have 3 servers, and I can't find the way to call them
in Perl.
I've tried the URL ("http://mysite.com/my_page") or with the server shares
("\\server\shared_directory\my_file").
I thought to work with a shared directory, but nobody is logged on the
server, and the shares are depending on who is logged.
Help me! I'm sure it's possible!
Thanks
Franck
------------------------------
Date: Fri, 19 May 2000 07:47:37 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Opening a file from another server
Message-Id: <39255409.1F1E8643@vpservices.com>
Franck Lalane wrote:
>
> I have a search engine in perl running for an Intranet.
> When I create the result list, I must open the files to get the title I will
> display.
> Everything works fine with all the files from the server running the script.
> (I use the physical path related to the server)
>
> The problem is that we have 3 servers, and I can't find the way to call them
> in Perl.
Look into the LWP (libnet) modules which allow you to access files on
other servers.
--
Jeff
------------------------------
Date: Fri, 19 May 2000 10:56:25 GMT
From: Mat <matthebraveone@yahoo.com>
Subject: problems with compilation...
Message-Id: <39251D2D.1A4B5AEF@yahoo.com>
Hi,
I have traced a recent discussion regarding compiling perl scripts.
However I don't see any alternative, cause the script has to be run at
several different locations without perl installed and with no
possibility to do it. I am using perlcc.exe on WinNT and what I get
after
running this program is:
--------------------------------------------------------------------------------
Compiling obs.pl:
--------------------------------------------------------------------------------
Making C(obs.pl.c) for obs.pl!
C:\Perl\bin\Perl.exe -IC:/Perl/lib -IC:/Perl/site/lib -I. -MB::Stash -c
obs.pl
C:\Perl\bin\Perl.exe -IC:/Perl/lib -IC:/Perl/site/lib -I.
-MO=C,-l2000,-umain,-uDB,-uWin32,-uattributes obs.pl
Starting compile
Walking tree
Prescan
Saving methods
Bootstrap attributes obs.pl
Writing output
Loaded B
Loaded IO
Loaded Fcntl
obs.pl syntax OK
Compiling C(obs) for obs.pl!
C:\Perl\bin\Perl.exe -IC:/Perl/lib -IC:/Perl/site/lib -I.
C:\TEMP/obs.pl.tst
Couldn't open C:TEMP/obs.pl.val
cl -O1 -MD -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT
-DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DPERL_MSVCRT_READFIX
-IC:\Perl\lib/CORE -o obs obs.pl.c /link -nologo -nodefaultlib
-release -libpath:"C:\Perl\lib\CORE" -machine:x86
-libpath:C:\Perl\lib/CORE C:\Perl\lib\CORE\perl56.lib oldnames.lib
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib
wsock32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib
msvcrt.lib
The name specified is not recognized as an
internal or external command, operable program or batch file.
ERROR: In compiling code for obs.pl.c !
What do I do wrong? Is there any possibility to compile a script using
other programs (free)?
Kind regards,
Maciek
------------------------------
Date: Fri, 19 May 2000 06:42:28 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Q: children, signals, etc...
Message-Id: <Pine.GSO.4.10.10005190629380.23375-100000@user2.teleport.com>
On Fri, 19 May 2000, Elliot Finley wrote:
> are signals reliable in Perl 5.005_03?
Sure, signals are reliable - it's the signal handlers written in Perl that
are the problem! :-)
Any signal handler written in Perl will, sooner or later, crash. Sometimes
that's acceptable, sometimes it's a problem.
> Every time I fork and send an email, the parent process will
> eventually receive a CHLD signal.
On some systems, you can set $SIG{CHLD} to 'IGNORE' to get the system to
automatically reap the child. Even if that doesn't happen automatically,
you may be able to use waitpid() without a signal handler.
If nothing else works, you may be able to make a signal handler via XS. In
handling this signal, it's good to remember that there won't necessarily
be one signal per dead child process - if two children die at
approximately the same time, you may receive only one signal. (Actually,
this sort of thing applies to all signals, not just CHLD.)
> Is there a way for a child that has been forked to disassociate itself
> from the parent in such a way that when it exits, the parent will NOT
> receive a CHLD signal?
Well, it could fork a second child, then exit. The grandchild would be
reaped by init, but the parent would still get a signal from the first
child, normally. So, I don't think that's a solution.
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 19 May 2000 13:41:15 GMT
From: p@awacs.dhs.org (Pascal Haakmat)
Subject: Q: Reading from STDIN, pipe first, then keyboard
Message-Id: <slrn8iah3p.19n.p@awacs.dhs.org>
Hi,
I want to write a program that reads data from a pipe on STDIN and then
prompts for some data from the keyboard. I use
undef $/;
$data = <STDIN>;
to slurp the data from the pipe, and I use readline() to get input from the
keyboard. The program is invoked from a shell somewhat like:
echo 'test' | my-program
The problem is that I can no longer read anything from the keyboard after I
get the data from the pipe -- readline() just returns the undefined value.
I tried closing STDIN and reopening it (in all sorts of funny ways,
including redirection from and to /dev/null), tried creating two seperate
scripts, one of them which reads the data from the pipe and then invokes the
second script which does keyboard interaction, all to no avail.
I guess there are some subtle issues which continue to elude me. If any of
you has any idea how to solve the problem I'd be more than happy to hear it.
Thanks in advance,
------------------------------
Date: Fri, 19 May 2000 19:40:53 +0800
From: "Swee Heng" <sweeheng@usa.net>
Subject: Re: Rename all files in a directory
Message-Id: <8g38jk$93t$1@coco.singnet.com.sg>
> I'm trying to move all files in a directory to another.
>
> First I have to read the old directory. Probably like this
> opendir DIRECTORY, $file;
> @directory = readdir DIRECTORY;
>
> Then I must do a loop that renames all the files in the directory.
> Anyone who can give me an example of this?
Run the command: perldoc -q rename
It tells you how to rename/move files. Here is code that worked for me:
use File::Copy; # new versions of File::Copy has move()
($old, $new) = @ARGV; # I used command line arguments
move($old, $new);
On Win98 with ActivePerl, there was a problem: it refused to move files/dirs
from one partition to another. It worked fine when moving within the same
partition. I did not test it on other platforms.
Swee Heng
------------------------------
Date: Fri, 19 May 2000 10:31:59 -0400
From: Al Smith <al.smith@mail.tju.edu>
Subject: Return Codes
Message-Id: <3925505F.68593782@mail.tju.edu>
Greetings folks,
I have what appears be a easy problem but it is complicated to me.
I am running a subroutine that runs a system command:
system `/usr/bin/mt -t /dev/rmt/0m rew`
basically it's doing a very basic drive test to see if a tape is in the
drive. I am tring to figure out how to evaulate the return code then if
the return code is anything but a 0 to get to a different subroutine.
Can anyone help?
Thanks,
Al Smith
al.smith@mail.tju.edu
------------------------------
Date: Fri, 19 May 2000 07:46:21 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Return Codes
Message-Id: <392553BD.CAB77C58@vpservices.com>
Al Smith wrote:
>
> Greetings folks,
>
> I have what appears be a easy problem but it is complicated to me.
> I am running a subroutine that runs a system command:
>
> system `/usr/bin/mt -t /dev/rmt/0m rew`
You're redundantly reduplicating your efforts multiple times in a row
again. Either use system to run a command or backtics, not both.
> I am tring to figure out how to evaulate the return code
my $return_code = `/usr/bin/mt -t /dev/rmt/0m rew`;
--
Jeff
------------------------------
Date: Fri, 19 May 2000 15:09:35 +0100
From: "Igor" <Igor@fiveonline.com>
Subject: rounding numbers
Message-Id: <MWbV4.360$283.7196@news6-win.server.ntlworld.com>
Does anyone know how to round numbers to 2 deciaml places in perl?
thanks
------------------------------
Date: 19 May 2000 14:26:09 GMT
From: bernd.witzgall@gmx.de (Bernd Witzgall)
Subject: Re: rounding numbers
Message-Id: <slrn8iagek.2dh.bernd.witzgall@bart.megatron.de>
Igor <Igor@fiveonline.com> wrote on Fri, 19 May 2000 15:09:35 +0100:
>Does anyone know how to round numbers to 2 deciaml places in perl?
perldoc sprintf
--
------------------------------
Date: Fri, 19 May 2000 11:58:27 GMT
From: Paul Eckert <peckert@epicrealm.com>
Subject: Re: SNMP via Perl
Message-Id: <39252B4E.3798D7B2@epicrealm.com>
Dear McNuttJ:
What you want is implemented in SNMP v2 and is called get_bulk_request.
Rather
than doing a getnext which fails under the circumstances you report, use the
SNMP::get_bulk_request call. Salient part of the manpage shown below:
get_bulk_request() - send a SNMPv2 get-bulk-request to the remote agent
Blocking
$response = $session->get_bulk_request(
[-nonrepeaters => $nonrepeaters,]
[-maxrepetitions => $maxrepetitions,]
-varbindlist => \@oids
);
Non-blocking
$ok = $session->get_bulk_request(
[-callback => sub {},]
[-delay => $seconds,]
[-nonrepeaters => $nonrepeaters,]
[-maxrepetitions => $maxrepetitions,]
-varbindlist => \@oids
);
Give it a try!
Paul
mcnuttj@missouri.edu wrote:
>
> Okay, guys, I think I've got a real winner here.
>
> I'm trying to query a *specific* instance of a *specific* MIB using the
> UCD SNMP perl module (UCD SNMP 4.1.1).
>
> If I do this:
>
> ######## BEGIN CODE
> # Create a socket.
> $sess = new SNMP::Session(DestHost => $ip, Community => $comm);
>
> # This is the MIB to query the layer 2 forwarding table of a switch.
> $mib = 'dot1dTpFdbPort';
>
> # This is the object used for multi-instance queries.
> $vb = new SNMP::Varbind([$mib]);
>
> # Set the instance to the decimal equivalent of the MAC address I'm
> # looking for (that's how they're stored in the forwarding table, in
> # numeric order).
> $vb->[$SNMP::Varbind::iid_f] = '8.0.32.47.24.108';
>
> # Get the next instance of the MIB.
> $var = $sess->getnext($vb);
> ######## END CODE
>
> If I do all that, what I get is the instance of the MIB that's immediately
> *after* the one I'm looking for.
>
> Now, the intelligent person would say, "Okay, just subtract one and you'll
> get the one you're looking for." Nay, not so, my friends. I *still* get
> the one *after*. Not until I reduced the *third* octet to less than *10*
> was I able to get the one I was looking for.
>
> The problem is, I can't make any sense of that. Therefore, the only
> reliable algorithm I have for searching the forwarding table for an
> arbitrary MAC address is to begin at the beginning and just go until I hit
> the one I want. This is pretty slow when the table is large. The idea
> was to speed up this process (sometimes it will have to run over a modem
> link).
>
> Any ideas?
>
> For reference, the instances in the table immediately surrounding the one
> I want (in *this* case) are as follows:
>
> 8.0.9.151.248.74
> 8.0.9.186.64.8
> 8.0.17.12.111.225
> 8.0.32.27.47.108 (This is the one I want)
> 8.0.105.2.216.245
> 8.0.105.2.252.38
> 8.0.105.2.252.237
>
> (Apparently, the "8.0.105" OUI is a popular vendor. I haven't bothered to
> look it up.)
>
> Anyway, any ideas, folks?
>
> Thanks!
>
> --J
--
Paul Eckert
Sr. Software Engineer
Epicrealm Inc.
1651 N. Glenville Dr., Suite 212
Richardson, TX 75081
(972) 479-0135 x300
peckert@epicrealm.com
------------------------------
Date: Fri, 19 May 2000 19:59:36 +0800
From: "Swee Heng" <sweeheng@usa.net>
Subject: Re: Socket Connect Timeout
Message-Id: <8g39ln$7vd$1@coco.singnet.com.sg>
> Having taken the basic calls from Steven's 'UNIX Network Programming' I
> believe that the actual calls are ok but I'm just wondering if there's a
way
> of increasing the time before the connect will timeout.
It seems that the IO::Socket module has a 'timeout' option. Maybe you can
examine the code for that module (ie. run "perldoc -m IO::Socket"). Or just
use that module. :)
Hope I've been of some help.
Swee Heng
------------------------------
Date: Fri, 19 May 2000 10:50:39 -0400
From: "Leonard Thornton" <LeonardT@Intelis-Inc.Com>
Subject: Re: Threads and Perl for Win32
Message-Id: <8g3k9m$nbg$1@nntp9.atl.mindspring.net>
Just to complete the thread...
The answer is ActivePerl Build 613 and don't use CPerlHost / CPerlObj C++
wrappers. By taking the basic miniperlmain constructs and function calls
and wrappering them into my own C++ class, I am now able to instantiate and
execute multiple Perl scripts within threads in a single process.
Special thanks to Dave and Tom for their input and guidance.
Leonard Thornton
Intelis, Inc
LeonardT@Intelis-Inc.com
------------------------------
Date: Fri, 19 May 2000 11:57:38 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: TNA
Message-Id: <S_9V4.269$6T1.36805@news.dircon.co.uk>
On Thu, 18 May 2000 18:16:56 -0700, yam Wrote:
> Hi,
>
> I'd like to know whether there is any perl module that
> implements Training Needs Analysis (TNA) in human resource
> management.
>
>
What did you find when you searched CPAN <http://search.cpan.org> ?
/J\
------------------------------
Date: Wed, 17 May 2000 08:27:02 -0400
From: Bernard Cosell <bernie@fantasyfarm.com>
Subject: Re: Using user-variables in external commands? II
Message-Id: <1q35iskn445enm0pt0vjerduffd89gkovj@4ax.com>
On Tue, 16 May 2000 15:30:56 -0700, Tom Phoenix <rootbeer@redcat.com>
wrote:
} On Tue, 16 May 2000, Anonymous wrote:
}
} > The question is can contain $body any character?
}
} But I'll point out that a line containing a single dot is significant to
} some mail-handling programs,...
Actually, the SMTP spec *forbids* a line with a single-period other
than to terminate a DATA command. The spec requires that any line in
the body of the message that begins with a dot must have the dot
doubled [and the doubled-dot will be changed back to a single-dot by
the receiving SMTP server].
/Bernie\
------------------------------
Date: Fri, 19 May 2000 14:53:37 +0100
From: Mike Denton <mikesnews@stakeholderuk.org>
Subject: Windows: Accesing a DLL
Message-Id: <$bsMQBAhdUJ5EADs@stakeholderuk.org>
I've written various Perl CGI scripts for use on a Unix server. I now
have to switch to a Windows NT server, because I have a Windows DLL that
I have to query.
The DLL is an OLE Server DLL which can be called from any application
that supports OLE Automation.
Can I do this easily in Perl? If so, how? The documentation with the DLL
explains how you create the object, pass parameters to the methods, and
extract the results when using VB or Visual FoxPro, but I need to use
perl to access it. Can this be done? If I need to provide more
information in order for anyone to help me with this query, please let
me know.
Kind regards,
--
Mike Denton
------------------------------
Date: Fri, 19 May 2000 10:32:13 -0400
From: "Zowwie" <apage.net[remove]@usa.net>
Subject: Re: Windows: Accesing a DLL
Message-Id: <siak3a53ius76@corp.supernews.com>
Mike,
These may help:
Win32/Perl and OLE:
http://www.4images.com/ntperl/docs/oleauto.htm
Excel DLL examples.
Win32/Perl/Tips/Tricks
http://www.4images.com/ntperl/
Perl Documentation AKA online books/tutors and quick reference:
http://www.spacecom.ru/Perl/
Good luck.
Mike Denton wrote in message <$bsMQBAhdUJ5EADs@stakeholderuk.org>...
>I've written various Perl CGI scripts for use on a Unix server. I now
>have to switch to a Windows NT server, because I have a Windows DLL that
>I have to query.
>
>The DLL is an OLE Server DLL which can be called from any application
>that supports OLE Automation.
>
>Can I do this easily in Perl? If so, how? The documentation with the DLL
>explains how you create the object, pass parameters to the methods, and
>extract the results when using VB or Visual FoxPro, but I need to use
>perl to access it. Can this be done? If I need to provide more
>information in order for anyone to help me with this query, please let
>me know.
>
>Kind regards,
>--
>Mike Denton
------------------------------
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 V9 Issue 3097
**************************************