[24102] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6296 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 23 21:05:44 2004

Date: Tue, 23 Mar 2004 18:05:07 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 23 Mar 2004     Volume: 10 Number: 6296

Today's topics:
    Re: Building Perl with Open Watcom <nospam-abuse@ilyaz.org>
        Comparing 2 date/times? <baisley@hotmail.com.REMOVETHIS>
    Re: Comparing 2 date/times? <noreply@gunnar.cc>
    Re: Comparing 2 date/times? <postmaster@castleamber.com>
    Re: Comparing 2 date/times? <xx087@freenet.carleton.ca>
    Re: Comparing 2 date/times? <postmaster@castleamber.com>
    Re: Comparing 2 date/times? <noreply@gunnar.cc>
    Re: Comparing 2 date/times? <baisley@hotmail.com.REMOVETHIS>
    Re: Comparing 2 date/times? <glex_nospam@qwest.invalid>
    Re: Comparing 2 date/times? <postmaster@castleamber.com>
    Re: Comparing 2 date/times? <postmaster@castleamber.com>
    Re: Counting elements in array <remorse@partners.org>
    Re: directory properties <dwall@fastmail.fm>
    Re: dollar sign and spaces from a string <mr@sandman.net>
    Re: dollar sign and spaces from a string <mr@sandman.net>
    Re: FIFO problem - yet another .sig rot script... <bik.mido@tiscalinet.it>
    Re: FIFO problem - yet another .sig rot script... <mgjv@tradingpost.com.au>
    Re: Getting exit code when reading from a pipe <krahnj@acm.org>
    Re: graph smoothing... <pkent77tea@yahoo.com.tea>
        Help with NET::Inet <wendywds@hotmail.com>
    Re: Help with NET::Inet <glex_nospam@qwest.invalid>
        need help with array searching <dave@nowhere.com>
    Re: need help with array searching <postmaster@castleamber.com>
    Re: need help with array searching <ittyspam@yahoo.com>
    Re: need help with array searching <dwall@fastmail.fm>
    Re: Perl web Link Checker <rcookDELETE@pcug.org.au>
    Re: Problem installing Net::DNS (John Oliver)
    Re: regexp question <krahnj@acm.org>
        Server-side script to convert plan e-mail to  html/mime (PROTEON bv)
        SOAP::Lite <hillmw@ram.lmtas.lmco.com>
    Re: SOAP::Lite <simon@unisolve.com.au>
    Re: working example File::Taill <ittyspam@yahoo.com>
    Re: zip backup via ftp (jon)
    Re: zip backup via ftp <gnari@simnet.is>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 23 Mar 2004 21:12:47 +0000 (UTC)
From:  Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Building Perl with Open Watcom
Message-Id: <c3q98f$144o$1@agate.berkeley.edu>

[A complimentary Cc of this posting was sent to
Mat Nieuwenhoven 
<mnieuw@zap.dontincludethis.a2000.nl>], who wrote in article <Xns94B58B590DC5Emnieuwzapdontinclude@195.129.110.143>:
> >> As I said, this is only an uneducated guesswork on my side; I meant
> >> all the POSIXish stuff which is AFAIK missing in VAC: what I can
> >> immediately remember is exec() (which is used much more frequently
> >> than fork())
> 
> Watcom has a number of exec() funtions: execl, execle, execlp, execlpe,
> execv, execve, execvp and execvpe, plus their wide-char equivalents. It
> this what you mean? 

Nope.  No misprint here.

> >> some minor-but-tedious stuff auto-translation of /dev/tty and
> >> /dev/null, etc.
> 
> This is not Posix stuff, surely?

This is why I explicitly wrote "POSIXish", not POSIX.  ;-) I think all
reasonable POSIXification translate these too...

> >> Doing tell()/seek() on text files is a problem with many compilers as
> >> well. 
> 
> You refer to the CR/LF problems when a file is opened in text mode?.
> Don't know how Watcom behaves here, I've never tried it, I tend to open
> files binary. Do you have a test case? 

A sketch: open a large text file; read a thousand lines; read several
more bytes; tell(); repeat reading; seek() back; did you get to
exactly the same position in the *CRLF-translated* stream?

> >> "Reliable" treatment of ^Z in text files?
> 
> What is supposed to happen when a ^Z is encountered? Normally it would
> be the last char of a file added by bad editors, but what if I paste it
> in the middle? 

EMX treats ^Z specially only if it is the last byte of the file, or
(maybe only for TTY?) if it is immediately followed by \r? \n.

> >> sbrk() (optional for perl, but may improve functionality a lot)?
> 
> Watcom does have a sbrk. Under non-DOS, it returns a newly allocated
> block of memory (rounded up to a multiple of 4k). Is this the one you
> mean?

Good.  So at least one (optional) of the requirements is met...

> >> Reliable command-line argument quoting/dequoting and globbing (so
> >> that arguments to spawnve() correspond 1-to-1 to argv[] array)?
> 
> There is no cmd line parsing in Watcom as far as I know.

Com'on, you mean argc/argv is not supported?  ;-) A C compiler on OS/2
can't work without command-line parsing...

> >> wait()?
> 
> Watcom's wait returns the exit status and process ID of the first child
> process that terminates. 

What about "Signal which killed it" part?

> >> alarm()?
> 
> Not present in Watcom at the moment. Doesn't this send a particular
> signal to the process after a specified time? In the list of signals
> supported by Watcom (7 plus 3 OS/2 specific) I see nothing that looks
> like an alarm signal. 

This would restrict functionality *a lot*.  Most scripts which need a
timed read() would use alarm()...

Hope this helps,
Ilya


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

Date: Tue, 23 Mar 2004 21:58:46 GMT
From: "Brett Baisley" <baisley@hotmail.com.REMOVETHIS>
Subject: Comparing 2 date/times?
Message-Id: <qq28c.123593$IF6.4184964@ursa-nb00s0.nbnet.nb.ca>

Hello

I need help with a Perl app. I get a datetime value from a mySQL table and I
need to compare that date/time with the current time.

I use localtime in perl to get the current time, but then the two are not
formatted the same. What is the best method to do this?

Thanks!




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

Date: Tue, 23 Mar 2004 23:04:13 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Comparing 2 date/times?
Message-Id: <c3qcep$2bn0ko$1@ID-184292.news.uni-berlin.de>

Brett Baisley wrote:
> I need help with a Perl app. I get a datetime value from a mySQL
> table and I need to compare that date/time with the current time.
> 
> I use localtime in perl to get the current time, but then the two
> are not formatted the same. What is the best method to do this?

Convert one - or both - so that they have the same format. :)

What have you tried? Can you show us the code you have so far? Have
you explored any of the Perl modules that might be useful?

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



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

Date: Tue, 23 Mar 2004 16:18:02 -0600
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Comparing 2 date/times?
Message-Id: <4060b7bb$0$24355$58c7af7e@news.kabelfoon.nl>



Brett Baisley wrote:
> Hello
> 
> I need help with a Perl app. I get a datetime value from a mySQL table and I
> need to compare that date/time with the current time.
> 
> I use localtime in perl to get the current time, but then the two are not
> formatted the same. What is the best method to do this?
> 
> Thanks!

using MySQL, it has a function to generate the current time, and support 
for comparison.

-- 
John                            personal page:  http://johnbokma.com/

Freelance Perl / Java developer available  -  http://castleamber.com/


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

Date: 23 Mar 2004 22:15:11 GMT
From: Glenn Jackman <xx087@freenet.carleton.ca>
Subject: Re: Comparing 2 date/times?
Message-Id: <slrnc61dnf.9k9.xx087@smeagol.ncf.ca>

Brett Baisley <baisley@hotmail.com.REMOVETHIS> wrote:
>  Hello
>  
>  I need help with a Perl app. I get a datetime value from a mySQL table and I
>  need to compare that date/time with the current time.
>  
>  I use localtime in perl to get the current time, but then the two are not
>  formatted the same. What is the best method to do this?

fetch the date from mysql in seconds since the epoch -- use the
UNIX_TIMESTAMP() function:
    select UNIX_TIMESTAMP(dateField) from ...

-- 
Glenn Jackman
NCF Sysadmin
glennj@ncf.ca


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

Date: Tue, 23 Mar 2004 16:19:56 -0600
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Comparing 2 date/times?
Message-Id: <4060b82c$0$24355$58c7af7e@news.kabelfoon.nl>



Gunnar Hjalmarsson wrote:

> Brett Baisley wrote:
> 
>> I need help with a Perl app. I get a datetime value from a mySQL
>> table and I need to compare that date/time with the current time.
>>
>> I use localtime in perl to get the current time, but then the two
>> are not formatted the same. What is the best method to do this?
> 
> Convert one - or both - so that they have the same format. :)
> 
> What have you tried? Can you show us the code you have so far? Have
> you explored any of the Perl modules that might be useful?

Not needed, itīs a MySQL functionality, IIRC NOW getīs the current time.

-- 
John                            personal page:  http://johnbokma.com/

Freelance Perl / Java developer available  -  http://castleamber.com/


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

Date: Wed, 24 Mar 2004 00:12:04 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Comparing 2 date/times?
Message-Id: <c3qge8$28vn99$1@ID-184292.news.uni-berlin.de>

John Bokma wrote:
> Gunnar Hjalmarsson wrote:
>> Brett Baisley wrote:
>>> I need help with a Perl app. I get a datetime value from a
>>> mySQL table and I need to compare that date/time with the
>>> current time.
>>> 
>>> I use localtime in perl to get the current time, but then the
>>> two are not formatted the same. What is the best method to do
>>> this?
>> 
>> Convert one - or both - so that they have the same format. :)
>> 
>> What have you tried? Can you show us the code you have so far?
>> Have you explored any of the Perl modules that might be useful?
> 
> Not needed, itīs a MySQL functionality, IIRC NOW getīs the current
> time.

Hmm.. Thanks. Have to admit that I know (almost) nothing about MySQL.

On the other hand, the OP was talking about a table value, and I kind
of got the impression that it's not necessarily the current time, but
rather some other time that is supposed to be *compared* with the
current time.

To me, Glenn's suggestion appears to better address the OP's problem.

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



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

Date: Tue, 23 Mar 2004 23:19:37 GMT
From: "Brett Baisley" <baisley@hotmail.com.REMOVETHIS>
Subject: Re: Comparing 2 date/times?
Message-Id: <dC38c.123656$IF6.4188606@ursa-nb00s0.nbnet.nb.ca>

Thanks everyone. I got it working now, with these suggestions.

The datetime stored in the db was from a previous session. I had to compare
that to the current datetime. I figured out how to convert it all to the
same format, and compared it that way. I am new to perl, so it took a bit of
work. We have to code everything ourselves, and now use pre-built mods.

Thanks for all your input! Greatly appreciated!


"Brett Baisley" <baisley@hotmail.com.REMOVETHIS> wrote in message
news:qq28c.123593$IF6.4184964@ursa-nb00s0.nbnet.nb.ca...
> Hello
>
> I need help with a Perl app. I get a datetime value from a mySQL table and
I
> need to compare that date/time with the current time.
>
> I use localtime in perl to get the current time, but then the two are not
> formatted the same. What is the best method to do this?
>
> Thanks!
>
>




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

Date: Tue, 23 Mar 2004 17:35:52 -0600
From: "J. Gleixner" <glex_nospam@qwest.invalid>
Subject: Re: Comparing 2 date/times?
Message-Id: <sR38c.81$kP6.103409@news.uswest.net>

Brett Baisley wrote:
> Thanks everyone. I got it working now, with these suggestions.
> 
> The datetime stored in the db was from a previous session. I had to compare
> that to the current datetime. I figured out how to convert it all to the
> same format, and compared it that way. I am new to perl, so it took a bit of
> work. We have to code everything ourselves, and now use pre-built mods.
> 
> Thanks for all your input! Greatly appreciated!


Nothing to do with perl, but as mentioned, it'd be better/more efficient 
to use MySQL to compare the dates and take whatever action is required 
on your tables.

See MySQL documentation on Date Calculations:

http://www.mysql.com/documentation/mysql/bychapter/manual_Tutorial.html#Date_calculations


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

Date: Tue, 23 Mar 2004 17:38:52 -0600
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Comparing 2 date/times?
Message-Id: <4060caca$0$24360$58c7af7e@news.kabelfoon.nl>

Gunnar Hjalmarsson wrote:

> John Bokma wrote:
> 
>> Gunnar Hjalmarsson wrote:
>>
>>> Brett Baisley wrote:
>>>
>>>> I need help with a Perl app. I get a datetime value from a
>>>> mySQL table and I need to compare that date/time with the
>>>> current time.
>>>>
>>>> I use localtime in perl to get the current time, but then the
>>>> two are not formatted the same. What is the best method to do
>>>> this?
>>>
>>>
>>> Convert one - or both - so that they have the same format. :)
>>>
>>> What have you tried? Can you show us the code you have so far?
>>> Have you explored any of the Perl modules that might be useful?
>>
>>
>> Not needed, itīs a MySQL functionality, IIRC NOW getīs the current
>> time.
> 
> 
> Hmm.. Thanks. Have to admit that I know (almost) nothing about MySQL.
> 
> On the other hand, the OP was talking about a table value, and I kind
> of got the impression that it's not necessarily the current time, but
> rather some other time that is supposed to be *compared* with the
> current time.

The only thing that can cause a problem is if the MySQL server is 
running in a different time zone. Otherwise, use MySQL. You can add the 
current time as an additional column, for example:

select c1,c2,c3,NOW() from table;

or even do the comparison in the select:

select c1,c2, DATEDIFF(c3, NOW()) from table;

<http://www.mysql.com/documentation/mysql/bychapter/manual_Functions.html#Date_and_time_functions>

> To me, Glenn's suggestion appears to better address the OP's problem.

Personally, I would let the database do as much work as possible, 
especially since it has a lot of date/time handling functionality.

-- 
John                            personal page:  http://johnbokma.com/

Freelance Perl / Java developer available  -  http://castleamber.com/


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

Date: Tue, 23 Mar 2004 17:45:11 -0600
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Comparing 2 date/times?
Message-Id: <4060cc46$0$24360$58c7af7e@news.kabelfoon.nl>

John Bokma wrote:

> The only thing that can cause a problem is if the MySQL server is 
> running in a different time zone.

Forget that one :-D. Unless you really need to compare times between the 
database, and the timezone the script is in.

-- 
John                            personal page:  http://johnbokma.com/

Freelance Perl / Java developer available  -  http://castleamber.com/


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

Date: Tue, 23 Mar 2004 16:50:51 -0500
From: Richard Morse <remorse@partners.org>
Subject: Re: Counting elements in array
Message-Id: <remorse-C760B6.16505123032004@plato.harvard.edu>

In article <u9lllrfp5j.fsf@wcl-l.bham.ac.uk>,
 Brian McCauley <nobull@mail.com> wrote:

> Richard Morse <remorse@partners.org> writes:
> 
> > In article <u9r7vkexs4.fsf@wcl-l.bham.ac.uk>,
> >  Brian McCauley <nobull@mail.com> wrote:
> > 
> > >       !$saw{$vir}++;
> > 
> > Hi!  Why the '!'?
> 
> Typo. ( There was a ! in the OP's code, I neglected to remove it when
> I rearranged the code).

Ah!  Makes sense...

Thanks,
Ricky


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

Date: Tue, 23 Mar 2004 20:22:24 -0000
From: "David K. Wall" <dwall@fastmail.fm>
Subject: Re: directory properties
Message-Id: <Xns94B59C62A7EDDdkwwashere@216.168.3.30>

Andy <andreasmaier@nurfuerspam.de> wrote:

> I would like to check the properties of some of my directories of my
> Win NT using perl. Does anybody know if there is a possibility to get
> properties like the right assignment for definite groups of a
> filesystem folder?

How about

Win32::File
Win32::FileSecurity
Win32API::File

These modules come with Activestate Perl for Win32.  



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

Date: Tue, 23 Mar 2004 21:41:43 +0100
From: Sandman <mr@sandman.net>
Subject: Re: dollar sign and spaces from a string
Message-Id: <mr-682467.21414323032004@news.fu-berlin.de>

In article <m3vfky40wl.fsf@quimby.dirtyhack.org>,
 Vetle Roeim <vetro@online.no> wrote:

> >>   Although I believe that Kenton _perhaps_ could have been treated
> >>   a little better, your claim is that a lot of newbies are scared
> >>   off. You have only showed us Kenton. Where's the rest of them?
> >
> > I will counter that with a question. During the time clp.misc has
> > existed, do you think Kenton is the only one, ever, to have done
> > this?
> 
>   No and I don't think he'll be the last.

Good.

> > Mind you, even if you would actually believe this to be the case, I
> > have no need to substantiate my claim on a semantical level.
> 
>   I'm sorry, but you're the one who said you wouldn't make such a
>   claim if you couldn't back it up. ;)

I did back it up. Only not on a semantical level, as in one could claim that it 
isn't "proof" or that my claimed pointed to plurals and I have proved only 
singulars (as you did). I have no need to prove it on a semantical level. It 
has been adequately proved to substantiated my claim and the purpose of my 
claim.

> >>   I can understand much of the attitude here, though. Sometimes it
> >>   seems like 90% of the posts here are from people who haven't
> >>   bothered to even pick up a book on Perl.
> >
> > I don't share that opinion. If 90% of the group bothers you that
> > much - LEAVE.
> 
>   The 10% is too interesting to give it up.

So get a filter that kills every post not belonging to that 10%. It's not 
rocket science.

> > If you're here to help people and get some help yourself - DO THAT.
> 
>   Asking people to RTFM or STFW can actually be very helpful. :)

Absolutely. We're not talking about people who do that. We are talking about 
people who choose to insult and mock the poster.

> > There is no reason, and I really mean "no" when I say "no" here, to
> > insult people just because they haven't learned enough yet when they
> > post here for the first time.
> 
>   Someone have gone to great lenghts to assemble extensive
>   documentation for Perl, and it's a little insulting when they don't
>   bother reading *any* of it.

No, it isn't. It would be insulting if they IGNORED to read them when being 
directed to it, it is NOT an insult if someone doesn't read documentation he or 
she knows nothing about.

>   Anyway; I doubt you'll manage to rid USENET of insults

I have no such need or no such goal. Some people deserve insults due to their 
behaviour - and ironically most of the time the ones handing it out here are 
the ones who deserve it as opposed to the newbies.

>   but I'm sure
>   newbies will appriciate your not-so-insulting answers to their
>   posts.

Naturally.

-- 
Sandman[.net]


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

Date: Tue, 23 Mar 2004 21:44:16 +0100
From: Sandman <mr@sandman.net>
Subject: Re: dollar sign and spaces from a string
Message-Id: <mr-7E0B5A.21441623032004@news.fu-berlin.de>

In article <c3kajd$44q$1@mamenchi.zrz.TU-Berlin.DE>,
 anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote:

> > >> I asked for evidence, you give me an anecdote (no news there, I
> > >> read this newsgroup too).
> > >> 
> > >> How many newbies are scared off by the elitist attitude of this NG,
> > >> and how do you know?
> > >
> > > I have showed you exactly what I wanted to show and I have no doubt
> > > my claim is adequately substantiated.
> > 
> >   Although I believe that Kenton _perhaps_ could have been treated a
> >   little better, your claim is that a lot of newbies are scared
> >   off. You have only showed us Kenton. Where's the rest of them?
> 
> The claim really seems to be that _too many_ newbies are scared away,
> whatever their number or percentage.

Indeed, even one would be too many. :)

> >   I can understand much of the attitude here, though. Sometimes it
> >   seems like 90% of the posts here are from people who haven't
> >   bothered to even pick up a book on Perl.
> 
> It's part of a feedback loop.  A high number of newbie posts means less
> time for the regulars to deal with each, means less patience with postings
> that are a waste of time, means the tone in the group gets rougher, means
> newbies are scared away (I'm not denying that) until their number is such
> that the group can deal with them.  If this group-dynamic process doesn't
> work for some reason, the regulars leave and the newsgroup goes to seed
> (see alt.perl).
> 
> You don't have to like all the consequences, but trying to influence the
> process through moral appeals is... well, greetings from King Canute.
> 
> The only way to improve the tone on clpm is to join the crew (welcome
> to it, by the way :), thus increasing the group's capacity for questions,
> and its tolerance for less-than-optimal ones.  The occasional scaring-away
> comes naturally after a while :)

I understand all of this (and have used pretty much the same wording myself in 
the past) but it is important to understand that this negative spiral does in 
no way JUSTIFY insults, it only causes them. And it's lotto for the newbie that 
come here if it's a good day or a bad day.

-- 
Sandman[.net]


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

Date: Wed, 24 Mar 2004 00:23:16 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: FIFO problem - yet another .sig rot script...
Message-Id: <ebg1605jb9p9q6rao3513tne977k814i69@4ax.com>

On Tue, 23 Mar 2004 07:41:28 +0100, Michele Dondi
<bik.mido@tiscalinet.it> wrote:

>>I believe your error is that you recreate the fifo each time around
>>the loop.  That may irritate pine more than the fact it is a fifo.
>
>Do I?!?

Eventually 'strace -e trace=file,read' clarified what's going on: it
(pine) first stats .sig getting its size and then tries to read at
most that many bytes, i.e. 0 in the case of a pipe as you can see from
the relevant lines quoted below for a pipe and for a regular file (a
symlink, really) respectively:

  access("/home/blazar/.signature", F_OK) = 0
  open("/home/blazar/.signature", O_RDONLY) = 5
  fstat64(5, {st_mode=S_IFIFO|0755, st_size=0, ...}) = 0
  read(5, "", 0)                          = 0

  access("/home/blazar/.signature", F_OK) = 0
  open("/home/blazar/.signature", O_RDONLY) = 5
  fstat64(5, {st_mode=S_IFREG|0644, st_size=75, ...}) = 0
  read(5, "-- \nSILVIO B. LADER\n- Scritta su"..., 75) = 75

By contrast 'cat .signature' yielded 

  open(".signature", O_RDONLY|O_LARGEFILE) = 3
  fstat64(3, {st_mode=S_IFIFO|0755, st_size=0, ...}) = 0
  read(3, "-- \nMANIOS MED FHEFHAKED NUMASIO"..., 8192) = 57
  read(3, "", 8192)                       = 0

  open(".signature", O_RDONLY|O_LARGEFILE) = 3
  fstat64(3, {st_mode=S_IFREG|0644, st_size=75, ...}) = 0
  read(3, "-- \nSILVIO B. LADER\n- Scritta su"..., 8192) = 75
  read(3, "", 8192)                       = 0

'perl -lpe' does something very similar. (up to a power of two!)

Oh, and of course also if you can't see that here, pine closes  my
pipe after having read 0 bytes from it while the writing process is
still writing to which is what I guess make it die...


Michele
-- 
you'll see that it shouldn't be so. AND, the writting as usuall is
fantastic incompetent. To illustrate, i quote:
- Xah Lee trolling on clpmisc,
  "perl bug File::Basename and Perl's nature"


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

Date: 24 Mar 2004 01:50:04 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: FIFO problem - yet another .sig rot script...
Message-Id: <slrnc61q6i.644.mgjv@verbruggen.comdyn.com.au>

On Thu, 18 Mar 2004 23:17:29 +0100,
	Michele Dondi <bik.mido@tiscalinet.it> wrote:
><intro>
> I'm trying to write a .sig rotation script for client-independet use
> by means of a FIFO. This attempt is also and (possibly even) *mainly*
> for learning purposes: the fact that I'm encountering the difficulties
> described hereafter shows that indeed it is well suited for that...
></intro>

\begin{offtopic}

> But when I try it with pine when composing a mail, the process started
> by my script dies and .sig is not inserted!

This is a known problem with pine (also ref
http://www.caliban.org/files/signature/ChangeLog).

On first quick read, the latest source for pie still have that
problem. It uses read_file() in os.c to read the signature file, which
does a fstat, followed by a read of statbuf.st_size bytes. That works
for regular files, but not for pipes.

It's a "bug" in pine that it can't handle named pipes correctly.
There's not much you can do about it apart from submitting a patch to
pine's source code, I suppose.

\end{offtopic}

Martien
-- 
                        | 
Martien Verbruggen      | 
Trading Post Australia  | 42.6% of statistics is made up on the spot.
                        | 


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

Date: Tue, 23 Mar 2004 21:35:32 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Getting exit code when reading from a pipe
Message-Id: <4060AD9E.6033F610@acm.org>

Ittay Dror wrote:
> 
> I'm reading a command output via a pipe like:
> 
> open (LS, "ls|") or die "ls could not be run";
> 
> while (<LS>) {
>    ...
> }
> 
> close (LS);
> 
> now, what happens if 'ls' (or any other command of course) runs but
> fails? How can I check its exit code in my perl program?

After you close() the pipe $? will contain the exit code.


John
-- 
use Perl;
program
fulfillment


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

Date: Tue, 23 Mar 2004 23:54:05 +0000
From: pkent <pkent77tea@yahoo.com.tea>
Subject: Re: graph smoothing...
Message-Id: <pkent77tea-514A7B.23535823032004@pth-usenet-01.plus.net>

In article <c3kmp0$bb4$1@news-reader3.wanadoo.fr>,
 "Bill Parker" <bill@gites.org.uk> wrote:

> I'm using GD::Graph quite successfully to produce a (temperature by time)
> graph.
> 
> But it's quite spikey and so I thought I'd overlay it with some sort of
> smoothed graph, so's the trend can (well, may be) displayed. But my
> statistics knowledge is very rusty now:

I'd suggest a moving average graph - and shiver me timbers if another 
poster has suggested the same thing. Indeed they are nice and easy to 
program, and ISTR you can have variations on the theme, e.g. giving 
weights to each sample in you rmoving window before averaging. The 
example on the Wolfram site looked ideal though.

P

-- 
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply


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

Date: Tue, 23 Mar 2004 14:58:54 -0700
From: "Wendy S" <wendywds@hotmail.com>
Subject: Help with NET::Inet
Message-Id: <c3qbvn$k2$1@news.asu.edu>

I'm [a Java programmer who is] trying to use some Perl code that I got from
a third party, and I'm having trouble.  I just installed ActiveState Perl
5.8.3 on Win2000 for testing, the code will eventually need to run on HP-UX.

The code I've (signat.pl) got starts with:
use Digest::MD5;
use MIME::Base64;
use Net::Inet qw(htonl ntohl);
sub GenerateSig { ...

And when I attempt to use it:
#! c:\perl
require "signat.pl";
print GenerateSig( "012345", "The quick red fox", 1 );

I get:
G:\src\perl>perl test.pl
Can't locate Net/Inet.pm in @INC (@INC contains: C:/Perl/lib
C:/Perl/site/lib .)
 at signat.pl line 5.
BEGIN failed--compilation aborted at signat.pl line 3.
Compilation failed in require at test.pl line 2.

It's true that there is no 'Inet.pm' file in c:\perl\lib\Net.  I'm not quite
sure what to do next.  I tried 'ppm' but I don't see a 'Net' package that I
should install.  Google turns up the docs for Net::Inet at
http://aspn.activestate.com/ASPN/CodeDoc/Net-ext/Net/Inet.html

I'm not sure if Net::Inet is supposed to already be there or if I have to
get it from somewhere.  In which case I need to know where, and how.  Thanks
in advance!

-- 
Wendy in Chandler, AZ




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

Date: Tue, 23 Mar 2004 17:30:06 -0600
From: "J. Gleixner" <glex_nospam@qwest.invalid>
Subject: Re: Help with NET::Inet
Message-Id: <2M38c.133$k9.55876@news.uswest.net>

Wendy S wrote:
> I'm [a Java programmer who is] trying to use some Perl code that I got from
> a third party, and I'm having trouble.  I just installed ActiveState Perl
> 5.8.3 on Win2000 for testing, the code will eventually need to run on HP-UX.
> 
> The code I've (signat.pl) got starts with:
> use Digest::MD5;
> use MIME::Base64;
> use Net::Inet qw(htonl ntohl);
> sub GenerateSig { ...
> 
> And when I attempt to use it:
> #! c:\perl
> require "signat.pl";
> print GenerateSig( "012345", "The quick red fox", 1 );
> 
> I get:
> G:\src\perl>perl test.pl
> Can't locate Net/Inet.pm in @INC (@INC contains: C:/Perl/lib
> C:/Perl/site/lib .)
>  at signat.pl line 5.
> BEGIN failed--compilation aborted at signat.pl line 3.
> Compilation failed in require at test.pl line 2.
> 
> It's true that there is no 'Inet.pm' file in c:\perl\lib\Net.  I'm not quite
> sure what to do next.  I tried 'ppm' but I don't see a 'Net' package that I
> should install.  Google turns up the docs for Net::Inet at
> http://aspn.activestate.com/ASPN/CodeDoc/Net-ext/Net/Inet.html
> 
> I'm not sure if Net::Inet is supposed to already be there or if I have to
> get it from somewhere.  In which case I need to know where, and how.  Thanks
> in advance!
> 

Based on that URL, and by looking at:
http://aspn.activestate.com/ASPN/Modules/dist_html?dist_id=9351

You'd need use ppm and:

install Net-ext

PPM FAQ: 
http://aspn.activestate.com/ASPN/docs/ActivePerl/faq/ActivePerl-faq2.html

There are many, many useful modules that are not part of the core.


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

Date: Tue, 23 Mar 2004 11:27:44 -0800
From: Dave Smith <dave@nowhere.com>
Subject: need help with array searching
Message-Id: <dave-7583BB.11274423032004@corp.supernews.com>

I have an array of data and I need to search for duplicate fields.

The array looks like this:

[0] NAME, ACCOUNT NUMBER, PHONE
[1] JOHN, 12345,509-555-1212
[2] MATT, 98376,509-555-1212

I want to find the duplicate phone numbers and print them out in a list. 
Suggestions?

Dave


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

Date: Tue, 23 Mar 2004 13:31:45 -0600
From: John Bokma <postmaster@castleamber.com>
Subject: Re: need help with array searching
Message-Id: <406090e2$0$24340$58c7af7e@news.kabelfoon.nl>

Dave Smith wrote:

> I have an array of data and I need to search for duplicate fields.
> 
> The array looks like this:
> 
> [0] NAME, ACCOUNT NUMBER, PHONE
> [1] JOHN, 12345,509-555-1212
> [2] MATT, 98376,509-555-1212

Is [0] etc part of the array?

> I want to find the duplicate phone numbers and print them out in a list. 
> Suggestions?

You want to know if the second and third element of each element have 
the same number?. And are those arrays elements of an array themselves?

Is the format of each number similar, or is sometimes a - used, other 
times a /, then a space, then nothing at all?

Remeber to specify as exact your problem as possible.

-- 
John                            personal page:  http://johnbokma.com/

Freelance Perl / Java developer available  -  http://castleamber.com/


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

Date: Tue, 23 Mar 2004 14:32:12 -0500
From: Paul Lalli <ittyspam@yahoo.com>
Subject: Re: need help with array searching
Message-Id: <20040323143037.A21521@dishwasher.cs.rpi.edu>

On Tue, 23 Mar 2004, Dave Smith wrote:

> I have an array of data and I need to search for duplicate fields.
>
> The array looks like this:
>
> [0] NAME, ACCOUNT NUMBER, PHONE
> [1] JOHN, 12345,509-555-1212
> [2] MATT, 98376,509-555-1212
>
> I want to find the duplicate phone numbers and print them out in a list.
> Suggestions?

What have you tried so far?  My suggestion is to review the split function
and loop through the array building up a hash, where the key is the phone
number and the value would be the number of times the phone number has
appeared so far.  When the loop is completed, loop through the hash keys
and print out all the ones with a value of at least 2.

Paul Lalli


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

Date: Tue, 23 Mar 2004 20:30:13 -0000
From: "David K. Wall" <dwall@fastmail.fm>
Subject: Re: need help with array searching
Message-Id: <Xns94B59DB62391Cdkwwashere@216.168.3.30>

Dave Smith <dave@nowhere.com> wrote:

> I have an array of data and I need to search for duplicate fields.

perldoc -q duplicate

You may have to modify your data or the FAQ answer, but that's not unusual.

-- 
David Wall
"I don't know what your original problem is, 
but I suggest to use a hash."  --Rafael Garcia-Suarez


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

Date: Wed, 24 Mar 2004 08:10:27 +1100
From: Owen <rcookDELETE@pcug.org.au>
Subject: Re: Perl web Link Checker
Message-Id: <pan.2004.03.23.21.10.24.962442@pcug.org.au>

On Tue, 23 Mar 2004 14:34:49 +0000, zzapper wrote:

> Hi,
> 
> I've tried using http://www.linklint.org but this hasn't been updated
> since 2001? It doesn't cope with JavaScript links (AFAIK). Is there any
> other project?
> 
> 
> zzapper (vim, cygwin, wiki & zsh)



Try CPAN and look for checkbot.


-- 
Owen




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

Date: 23 Mar 2004 19:36:27 GMT
From: joliver@john-oliver.net (John Oliver)
Subject: Re: Problem installing Net::DNS
Message-Id: <slrnc614dn.fv.joliver@ns.sdsitehosting.net>

On Sun, 21 Mar 2004 18:20:49 -0500, James Willmore wrote:
> On Sun, 21 Mar 2004 18:05:00 +0000, John Oliver wrote:
> 
>> The exact same result... nothing more, nothing less.
> 
> Maybe you should contact the author.  This *may* be a know issue.
> 
> Or, you could submit a bug report at the following URL:
> http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-DNS
> 
> Apparently, there *appears* to be a bug that was(n't) fix related to the
> Resolver.pm.

Well, the exact same process works on several other machines... :-)  I
really doubt it's a bug in the code... more it seems more like some sort
of issue with the host itself.  Ahh well...

-- 
* John Oliver                              http://www.john-oliver.net/ *
* California gun owners - protect your rights and join the CRPA today! *
* http://www.crpa.org/         Free 3 month trial membership available *
* San Diego shooters come to http://groups.yahoo.com/group/sdshooting/ *


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

Date: Tue, 23 Mar 2004 23:43:36 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: regexp question
Message-Id: <4060CBA1.DB6DF0EC@acm.org>

BigDaDDY wrote:
> 
> I have kind of a tricky problem.  Here goes:
> 
> We have some shorthand notations we use in practice that describe a
> structure that I would like to allow in my program.  However, in order to
> allow them, I need to be able to expand them out.  They work as follows:
> 
> (30/40/50)S     is the same as (30/40/50/50/40/30) Note: the S only occurs
> once at the end
> 
> (30/40/50)$     is the same as (30/40/50/40/30)  Note: the $ only occurs
> once at the end
> 
> and finally (30/40(5)/50) is the same as 30/40/40/40/40/40/50  Note: the
> quantifier in parenthesis (in this case the (5)) is allowed anywhere. For
> example this would be allowed too:
> 
> (30(4)/40(5)/50(5))S =
> (30/30/30/30/40/40/40/40/40/50/50/50/50/50/50/50/50/50/50/40/40/40/40/40/30/30/30/30)
> 
> How can I allow the user to use this shorthand notation, and make my
> program transparent to it?  In other words how would I have my program
> expand out these shorthand notations?


#!/usr/bin/perl
use warnings;
use strict;

while ( <DATA> ) {
    print;
    s/^\(// and s/\)([S\$]?)$// and my $type = $1;
    my @fields = map {
        my ( $num, $cnt ) = /^(.+?)(?:\((\d+)\))?$/;
        [ $cnt ? ($num) x $cnt : $num ]
        } split /\//;

    if ( $type ) {
        my @rev = map [ @$_ ], reverse @fields;
        shift @rev if $type eq '$';
        push @fields, @rev;
        }
    my $result = '(' . join( '/', map @$_, @fields ) . ')';

    print "$result\n";
    }

__DATA__
(30/40/50)S
(30/40/50)$
(30(4)/40(5)/50(5))S
(30/40/50)
(30/40/50)
(30(4)/40(5)/50(5))
(30.45/40.45/50.45)S
(30.67/40.67/50.67)$
(30.23(4)/40.23(5)/50.23(5))S



John
-- 
use Perl;
program
fulfillment


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

Date: 23 Mar 2004 15:38:04 -0800
From: hvtijen@hotmail.com (PROTEON bv)
Subject: Server-side script to convert plan e-mail to  html/mime ?
Message-Id: <8b67eb87.0403231538.6d205786@posting.google.com>

Hi all,

I've been googling for hours, but did not find the follwoing:

For a customer I need to make all plain-text mail that is send from a
certain app to  be converted to a html/mime message.

So the user types a plain text messages, but on the server some
template-based conversion takes place, a company logo is added and a
'corporate identity' compliant mime-mail is send out. [i know, but i
have no choice..]

Basically, I could take Mime::Lite and start from there, but I can
imagine a lot of little pitfalls are to be avoided. Does anybody know
of a tried-and-true solution for this ?

TIA

henq


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

Date: Tue, 23 Mar 2004 17:32:42 -0600
From: Michael Hill <hillmw@ram.lmtas.lmco.com>
Subject: SOAP::Lite
Message-Id: <4060C91A.1456766B@ram.lmtas.lmco.com>

At this page there is an article on use SOAP:Lite

http://www.perl.com/lpt/a/2001/01/soap.html#writing%20a%20cgibased%20server

Towards the middle of the page there is an example about using:

Objects access (it's 'Simple Object access protocol', isn't it?)

Then some examples:

(temper.cgi):
#!perl -w
  use SOAP::Transport::HTTP;
  SOAP::Transport::HTTP::CGI
    -> dispatch_to('Temperatures')
    -> handle;
  package Temperatures;
  sub f2c {
      my ($class, $f) = @_;
      return 5/9*($f-32);
  }
  sub c2f {
      my ($class, $c) = @_;
      return 32+$c*9/5;
  }
  sub new {
      my $self = shift;
      my $class = ref($self) || $self;
      bless {_temperature => shift} => $class;
  }
  sub as_fahrenheit {
      return shift->{_temperature};
  }
  sub as_celsius {
      my $self = $shift;
      return $self->f2c( $self->{_temperature} );
  }


Here is a client that accesses this class:

(tempobj.pl):
 #!perl -w 
  use SOAP::Lite;
  my $soap = SOAP::Lite
    -> uri('http://www.soaplite.com/Temperatures')
    -> proxy('http://services.soaplite.com/temper.cgi');
  my $temperatures = $soap
    -> call(new => 100) # accept Fahrenheit  
    -> result;
  print $soap
    -> as_celsius($temperatures)
    -> result;

I ram this example executing > perl tempobj.pl and I get nothing. Can
someone explain why?

Mike


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

Date: Wed, 24 Mar 2004 12:54:03 +1100
From: Simon Taylor <simon@unisolve.com.au>
Subject: Re: SOAP::Lite
Message-Id: <c3qprf$2otd$1@otis.netspace.net.au>

Hello Michael,

> Towards the middle of the page there is an example about using:
> 
> Objects access (it's 'Simple Object access protocol', isn't it?)
> 
> Then some examples:

[snip]

> Here is a client that accesses this class:
> 
> (tempobj.pl):
>  #!perl -w 
>   use SOAP::Lite;
>   my $soap = SOAP::Lite
>     -> uri('http://www.soaplite.com/Temperatures')
>     -> proxy('http://services.soaplite.com/temper.cgi');
>   my $temperatures = $soap
>     -> call(new => 100) # accept Fahrenheit  
>     -> result;
>   print $soap
>     -> as_celsius($temperatures)
>     -> result;
> 
> I ram this example executing > perl tempobj.pl and I get nothing. Can
> someone explain why?

Not sure.

I ran the tempobj.pl script above and got reasonable output:

   [simon@acacia perl]$ perl clpm.pl
   37.7777777777778[simon@acacia perl]$

However, I did change the first line from

#!perl -w

to

#!/usr/bin/perl

I'm not sure how relevant that change is on your platform....

Oh, and I added:

use strict;
use warnings;

also...

Regards,

Simon Taylor




-- 
Unisolve Pty Ltd - Melbourne, Australia



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

Date: Tue, 23 Mar 2004 14:09:07 -0500
From: Paul Lalli <ittyspam@yahoo.com>
Subject: Re: working example File::Taill
Message-Id: <20040323140642.A21521@dishwasher.cs.rpi.edu>

On Tue, 23 Mar 2004, Aaron Baugher wrote:

> anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:
>
> > None of these evaluate to false.  A single "0" without a terminating
> > newline is the only type of line that may be missed.  That is really
> > a malformed line, so it is customary to simply check for truth.
>
> Whoops; learned something today.  I thought anything which equaled
> zero, like "0000.000", was false.  Just tested it, and you're right.

All *numeric* representations of zero, like 0, 0.0, -0.00E25, etc are
false.  But when it comes to strings, only the single-character string "0"
and the empty string are false.

Paul Lalli


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

Date: Tue, 23 Mar 2004 13:21:54 -0800 (PST)
From: xbg86@webtv.net (jon)
Subject: Re: zip backup via ftp
Message-Id: <20342-4060AA72-161@storefull-3316.bay.webtv.net>

i have a hosting service, and i know how to program, i am just not
familiar with ftp programing. i have everything else set.



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

Date: Tue, 23 Mar 2004 21:05:45 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: zip backup via ftp
Message-Id: <c3q8p0$4cs$1@news.simnet.is>

"James Willmore" <jwillmore@remove.adelphia.net> wrote in message
news:pan.2004.03.23.18.18.53.451422@remove.adelphia.net...
> On Tue, 23 Mar 2004 21:01:54 +1000, Gregory Toomey wrote:
>
> [coming in late to the thread ...]
>
> Why does the OP *need* a web server or web host in order to use Perl?
>
> PC - yes.  web server / hosting service - no.  *Not* a requirement to run
> Perl scripts.

one of the OP's requirement was to control the thing from a
browser. some people jumped to the conclusion that a web
server was needed. but why use a web server when
HTTP::Daemon is perfectly adequate ?


gnari


P.S.:
:-)






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

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


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