[24742] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6897 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Aug 22 06:06:01 2004

Date: Sun, 22 Aug 2004 03:05:05 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 22 Aug 2004     Volume: 10 Number: 6897

Today's topics:
        Breaking reference chians <perlman@hyperlands.net>
    Re: BWWHOIS in OS/2 and Perl support (Seymour J.)
        how to install Sybase::DBlib??? <heyubo@hotmail.com>
        Network Monitoring app. <dan@no.spam>
    Re: perl interpreter automatically exit windows so how  <dave@nospam.com>
        Recursively copying a directory <lenaic.huard@laposte.net>
    Re: Recursively copying a directory <spamtrap@dot-app.org>
    Re: split inconsistency- why? <nospam-abuse@ilyaz.org>
    Re: start some actions with Perl without Cron? (krakle)
    Re: start some actions with Perl without Cron? <spamtrap@dot-app.org>
    Re: Why '' Is Matched First Time, Not Second Time <eric-amick@comcast.net>
    Re: Why '' Is Matched First Time, Not Second Time <SaveWorldFromAids@alexa.com>
    Re: Why '' Is Matched First Time, Not Second Time <noreply@gunnar.cc>
    Re: Why '' Is Matched First Time, Not Second Time <abigail@abigail.nl>
    Re: Why '' Is Matched First Time, Not Second Time <spamtrap@dot-app.org>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 22 Aug 2004 09:48:19 GMT
From: Mark Keightley <perlman@hyperlands.net>
Subject: Breaking reference chians
Message-Id: <DZZVc.186181$28.87874@fe1.news.blueyonder.co.uk>

Hi

I'm currently writing a script to read windows style config files.  You 
know the sort of file that reads like this

[section name]
key1 = value1
key2 = value2

[another section name]
 ...

The config is then held in a hash of hashes.  The problem I'm having is 
getting the hash with the key value pairs stored in the main config 
hash.  I've written a sub routine that reads the key value pairs and 
then  returns a reference to this hash.  The problem is that because 
there is a reference back to this hash, even with it being a local hash 
(created with my) to that sub, it never goes out of scope.  Hence only 
the first section of the main config hash is correct.  Section 2 has 
keys and values for both sections 1 and 2, section 3 has 1,2 and 3 etc.
One way around this that I tried was de-reference the reference in to a 
hash take a reference to this new hash and then make the first reference 
undef.  The code I used was like this

$href1 = \%section;
$href2 = {%{$href1}};
$href1 = undef;
return $href2;

But this still failed in the same way.  It looks like rather than the 
'chain' of references I expected that all references point back to the 
original data.  So to my question how do I copy data using references, 
but keep the copies detached from each other?
Thanks in advance


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

Date: Sun, 22 Aug 2004 00:09:26 -0300
From: "Shmuel (Seymour J.) Metz" <spamtrap@library.lspace.org.invalid>
Subject: Re: BWWHOIS in OS/2 and Perl support
Message-Id: <41281c76$15$fuzhry+tra$mr2ice@news.patriot.net>

In <CXrVc.2864$3O2.1183@trndny07>, on 08/20/2004
   at 07:05 PM, $_@_.%_ said:

>In the directory: 
>http://www.cpan.org/authors/id/Q/QO/QOS/Networking/

>There are two old programs IPLU and IPLUc, one is command line and
>the other a pTk GUI.

They seem to use net::whois:iana, and I wouldn't expect Perl 5.5 to
include a version with support for referral processing.

-- 
Shmuel (Seymour J.) Metz, SysProg and JOAT  <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action.  I reserve the
right to publicly post or ridicule any abusive E-mail.  Reply to
domain Patriot dot net user shmuel+news to contact me.  Do not
reply to spamtrap@library.lspace.org



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

Date: Sat, 21 Aug 2004 23:59:01 -0400
From: "yubo he" <heyubo@hotmail.com>
Subject: how to install Sybase::DBlib???
Message-Id: <aSUVc.43288$Tr.2174134@news20.bellglobal.com>

hey, I am using activate perl in windows, I used ppm to install
Sybase::DBlib
error: could not locate a PPD file for package Sybase-DBlib

thx




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

Date: Sat, 21 Aug 2004 19:09:56 -0400
From: d0x <dan@no.spam>
Subject: Network Monitoring app.
Message-Id: <pan.2004.08.21.23.09.56.577265@no.spam>

    [sorry for the double post in vb.misc...]

I wanted to make a program that monitors hosts, to see that they are up. I
want to make the part of the program that does the testing in either
Perl,Pascal, or maybe VB. One of the GUI's is going to be in vb, but I
would prefer to have the part the does the polling on a unix system,
Preferably perl. But I will setting for any of the above 3 langs.

I want to be able to poll
the hosts every 5 minutes. So i figured I would send a really small 1
packet ping to each host every 2 mins. Lets say I have a list of 255 hosts
to ping ( I would like the timeout for a ping to be 4 seconds). If it
stalls on 50 hosts, that means 200 wasted seconds. Further more, it means
that now took up the time for 2 or more polls. What is the most efficient
way to do this? I was originally thinking that I would have to make it
ping multiple hosts at the same time, maybe like 10. I just have no idea
how to do that.

My other idea is to have multiple instances running. All the data is held
in a database. So if I see that there are 255 hosts, I can spawn 12
instances of the program, each one monitoring 20 hosts..

Any other ideas..  Right now i just want to monitor icmp, but later on i
want to monitor http as well.

Thanks.


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

Date: Sun, 22 Aug 2004 02:46:50 -0400
From: Dave <dave@nospam.com>
Subject: Re: perl interpreter automatically exit windows so how I can saw the result of script?
Message-Id: <4128416f$0$21751$61fed72c@news.rcn.com>

A. Sinan Unur wrote:

> Alont <end@dream.life> wrote in news:4126dabd.127559140@130.133.1.4:
> 
> 
>>in my WINDOWS XP, I can open *.pl file and perl interpreter
>>automatically start and execute *.pl file but it automatically exit
>>too, so I can't saw the result of script, how to set perl interpreter
>>stay on the command line?
>>the guide haven't tell me the answer:
> 
> 
> Learn how to use Windows XP, why don't you?
> 
> Download the "Command Prompt Here" powertoy from Microsoft (google for it).

One can also add the same functionality provided by the powertoy simply 
by importing the following into the registry:

--------------- Start copying here ---------------
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cmd]
@="Open Command Window Here"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cmd\command]
@="cmd.exe /k \"cd %L\""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Drive\shell\cmd]
@="Open Command Window Here"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Drive\shell\cmd\command]
@="cmd.exe /k \"cd %L\""

------------------- End of text ------------------

Note to OP: copy and paste the above text into a text file and rename it 
so that it ends with a 'reg' extension; then double click on it.

Dave


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

Date: Sun, 22 Aug 2004 10:30:54 +0200
From: =?ISO-8859-1?Q?L=E9na=EFc?= Huard <lenaic.huard@laposte.net>
Subject: Recursively copying a directory
Message-Id: <41285a53$0$29675$636a15ce@news.free.fr>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

Hello,

I'm looking for a way to copy a directory and all its content with perl ;
that is to say the perl function equivalent to the "cp -R" Unix command.

I've looked the 'File::Copy' package, but I only managed to copy regular
files and not directories.

If toto is a directory, the following lines create an empty regular file
named tata, whereas I expected tata to be new directory containing a copy
of toto's content.

  use File::Copy;
  copy( "toto", "tata" );

Does anybody have a nicer idea than a
  system( "cp -R toto tata" );
which is not very portable...

Thanks,
Lénaïc.
- -- 
(o_       Lénaïc HUARD
//\ Lenaic.Huard@laposte.net
V_/_    KeyID: 0x04D2E818
-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFBKFnIjYEjJATS6BgRAsaCAKCHuCyqllVr59P1cnxID9NyONEDJACgqOVn
hCEkKvRqSQwQ+hTiTI/14bQ=
=85pH
-----END PGP SIGNATURE-----


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

Date: Sun, 22 Aug 2004 04:56:10 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Recursively copying a directory
Message-Id: <yKudnQdqK_Q2wrXcRVn-iw@adelphia.com>

Lénaïc Huard wrote:
> I'm looking for a way to copy a directory and all its content with perl ;
> that is to say the perl function equivalent to the "cp -R" Unix command.

#!/usr/bin/perl

use strict;
use warnings;

use File::NCopy;

my $copier = new File::NCopy('recursive'=>1);
$copier->copy('dir1', 'dir2');

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Sat, 21 Aug 2004 18:13:11 +0000 (UTC)
From:  Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: split inconsistency- why?
Message-Id: <cg83bn$1u7u$1@agate.berkeley.edu>

[A complimentary Cc of this posting was sent to
David Combs
<dkcombs@panix.com>], who wrote in article <cg6gbe$3gd$1@reader1.panix.com>:

> >>     how much work would it be for someone (good like you)
> >>     to implement a splitSmall with perhaps fewer features,
> >>     but at least do those things robustly, "as advertised"?
> >
> >As I said, this was already (mostly?) done in my
> >
> >  use strict 'split';
> >
> >patch.  But if it is not easly transferable to the current code base,
> 
> OOPS -- with the above line sitting there, I'm
> not so sure that really understand the situation:
> 
> Ilya -- are you saying that you made all these fixes
> to a pre-5.6 version -- and that those fixes *did not*
> make their way into (then) code base, and thus
> had no chance to be kept there (obviously)
> in subsequent versions?

Yes, this is what I remember about the situation.  (Since my memory is
not that good now, it *might* have been slightly different; I
definitely had a working patch; maybe what I sent to the list was not
the patch itself, but the description - though I doubt it.  Anyway, it
was rejected.)

Hope this helps,
Ilya


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

Date: 21 Aug 2004 21:22:54 -0700
From: krakle@visto.com (krakle)
Subject: Re: start some actions with Perl without Cron?
Message-Id: <237aaff8.0408212022.5c085386@posting.google.com>

"PHP2" <gp@nospm.hr> wrote in message news:<cg5u56$d6$1@ls219.htnet.hr>...
> is possible start some actions with Perl without Cron?
> 
> for example send email to users from database after 3 days or delete
> something from database automaticaly after 3 day with Perl but without Cron?

What's wrong with cron?


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

Date: Sun, 22 Aug 2004 02:50:54 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: start some actions with Perl without Cron?
Message-Id: <xtSdnT0jxcDT37XcRVn-uQ@adelphia.com>

PHP2 wrote:
> is possible start some actions with Perl without Cron?
> 
> for example send email to users from database after 3 days or delete
> something from database automaticaly after 3 day with Perl but without Cron?

If you're looking to avoid cron because you don't want to leave your 
server active 24x7, you might want to have a look at anacron. It's a job 
scheduler that's designed to handle downtime, by running any missed jobs 
whenever the system comes back up.

Otherwise, yes, it's possible to do without Cron, but you'll end up 
writing something that looks, walks, and quacks like Cron anyway. You'll 
need to write a script that runs all the time, checking to see if it 
needs to run any scheduled actions and then sleeping for a time before 
checking again.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Sat, 21 Aug 2004 15:30:03 -0400
From: Eric Amick <eric-amick@comcast.net>
Subject: Re: Why '' Is Matched First Time, Not Second Time
Message-Id: <3r7fi0pi0jh9jg3ffobg9nfnea9o8jd33m@4ax.com>

On Sat, 21 Aug 2004 04:22:56 GMT, "http://links.i6networks.com"
<SaveWorldFromAids@alexa.com> wrote:

>
>"Eric Bohlman" <ebohlman@omsdev.com> дÈëÓʼþ
>news:Xns954BD03767F88ebohlmanomsdevcom@130.133.1.4...
>> "http://links.i6networks.com" <SaveWorldFromAids@alexa.com> wrote in
>> news:YLwVc.1833114$Ar.1019409@twister01.bloor.is.net.cable.rogers.com:
>> When you read the very first line, no regexp has yet successfully matched,
>> so /$keywordcat/ matches the empty string.  When you read the next line,
>> /.+\|.+\|.+/ successfully matches, so when you go on to read the third
>> line, /$keywordcat/ is now being treated as /.+\|.+\|.+/, which of course
>> doesn't match there.
>
>I still don't understand. Why perl will do that weired, none normal thing.

Because of historical precedent, I suspect. Perl's s/// operator does
the same thing with an empty pattern, and the behavior is the same in
various Unix editors that predate Perl. And there's a practical reason
for giving it a special meaning--since *every* line in a file would
match an empty pattern if that pattern meant an empty string, why not
give it some useful meaning?

>Thanks alot. I was right not to waste more time on my own and came here to
>ask. Saved my time for a game and a meal.

Interesting logic. The answer was right in the docs, but apparently we
are here to read the docs for you. Clearly our time is less valuable
than yours. I don't think so.

-- 
Eric Amick
Columbia, MD


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

Date: Sat, 21 Aug 2004 22:11:55 GMT
From: "http://links.i6networks.com" <SaveWorldFromAids@alexa.com>
Subject: Re: Why '' Is Matched First Time, Not Second Time
Message-Id: <LMPVc.3$D001.0@news04.bloor.is.net.cable.rogers.com>


"Eric Amick" <eric-amick@comcast.net> ????
news:3r7fi0pi0jh9jg3ffobg9nfnea9o8jd33m@4ax.com...
> On Sat, 21 Aug 2004 04:22:56 GMT, "http://links.i6networks.com"
> <SaveWorldFromAids@alexa.com> wrote:
>
> >
> >"Eric Bohlman" <ebohlman@omsdev.com> дÈëÓʼþ
> >news:Xns954BD03767F88ebohlmanomsdevcom@130.133.1.4...
> >> "http://links.i6networks.com" <SaveWorldFromAids@alexa.com> wrote in
> >> news:YLwVc.1833114$Ar.1019409@twister01.bloor.is.net.cable.rogers.com:
> >> When you read the very first line, no regexp has yet successfully
matched,
> >> so /$keywordcat/ matches the empty string.  When you read the next
line,
> >> /.+\|.+\|.+/ successfully matches, so when you go on to read the third
> >> line, /$keywordcat/ is now being treated as /.+\|.+\|.+/, which of
course
> >> doesn't match there.
> >
> >I still don't understand. Why perl will do that weired, none normal
thing.
>
> Because of historical precedent, I suspect. Perl's s/// operator does
> the same thing with an empty pattern, and the behavior is the same in
> various Unix editors that predate Perl. And there's a practical reason
> for giving it a special meaning--since *every* line in a file would
> match an empty pattern if that pattern meant an empty string, why not
> give it some useful meaning?
>
> >Thanks alot. I was right not to waste more time on my own and came here
to
> >ask. Saved my time for a game and a meal.
>
> Interesting logic. The answer was right in the docs, but apparently we
> are here to read the docs for you. Clearly our time is less valuable
> than yours. I don't think so.

It only take others 2 minutes to point out and will costs me 2 days before
giving up. I would say costing others two minutes worth saving my two day
without any result. You guys did not read my saying correctly. I was saying
it is so much quicker using a good helper than reinvent the wheel.


>
> -- 
> Eric Amick
> Columbia, MD




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

Date: Sun, 22 Aug 2004 00:31:15 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Why '' Is Matched First Time, Not Second Time
Message-Id: <2oq0q1Fcv40jU1@uni-berlin.de>

http://links.i6networks.com wrote:
> Eric Amick wrote:
>> http://links.i6networks.com wrote:
>>> Thanks alot. I was right not to waste more time on my own and
>>> came here to ask. Saved my time for a game and a meal.
>> 
>> Interesting logic. The answer was right in the docs, but
>> apparently we are here to read the docs for you. Clearly our time
>> is less valuable than yours. I don't think so.
> 
> It only take others 2 minutes to point out and will costs me 2 days
> before giving up.

2 days? I don't believe you. Not even you are *that* stupid.

> I would say costing others two minutes worth saving my two day 
> without any result. You guys did not read my saying correctly.

I think they did read your message correctly. You are just another one
of those lazy, egocentric persons who post here all too often.

> I was saying it is so much quicker using a good helper than
> reinvent the wheel.

Would reading the docs be the same as reinventing the wheel? Idiot!

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: 21 Aug 2004 23:49:02 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Why '' Is Matched First Time, Not Second Time
Message-Id: <slrncifnre.q3p.abigail@alexandra.abigail.nl>

http://links.i6networks.com (SaveWorldFromAids@alexa.com) wrote on
MMMMVIII September MCMXCIII in <URL:news:LMPVc.3$D001.0@news04.bloor.is.net.cable.rogers.com>:
--  
--  It only take others 2 minutes to point out and will costs me 2 days before
--  giving up. I would say costing others two minutes worth saving my two day
--  without any result. You guys did not read my saying correctly. I was saying
--  it is so much quicker using a good helper than reinvent the wheel.


*PLOINK*


Abigail
-- 
My 2 minutes are worth a lot


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

Date: Sun, 22 Aug 2004 02:53:49 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Why '' Is Matched First Time, Not Second Time
Message-Id: <xtSdnTwjxcBg37XcRVn-uQ@adelphia.com>

Abigail wrote:

> *PLOINK*

You might want to take that killfile in for servicing - it sounds a bit off.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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


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