[15972] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3384 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 16 00:05:33 2000

Date: Thu, 15 Jun 2000 21: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: <961128312-v9-i3384@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 15 Jun 2000     Volume: 9 Number: 3384

Today's topics:
    Re: [Q] Perl implemented in Java? <brian@bluecoat93.org>
    Re: [Q] Perl implemented in Java? (Randal L. Schwartz)
    Re: binding a string variable to call a stored proc ? <bwalton@rochester.rr.com>
    Re: Bot for this group to auto-answer queries? <Jonathan.L.Ericson@jpl.nasa.gov>
    Re: Crazy enough that it might just work... <henry@penninkilampi.net>
    Re: Determining Dates (Peter L. Berghold)
    Re: Does anyone have some exercises? (David Wall)
    Re: Graphics files gd.pm and gd.dll <bwalton@rochester.rr.com>
    Re: MacPerl- Back to square one. <hakon.alstadheim@oslo.mail.telia.com>
        Need help with timelocal <djbishop@bigfoot.com>
        Numbers and RE newbie@db-networks.com
    Re: Numbers and RE <lauren_smith13@hotmail.com>
    Re: Numbers and RE <bwalton@rochester.rr.com>
    Re: Numbers and RE <ivoz@starmail.com>
    Re: Numbers and RE <bwalton@rochester.rr.com>
    Re: Numbers and RE <phill@modulus.com.au>
    Re: Numbers and RE <ivoz@starmail.com>
    Re: OT: Re: Taryag Perl <lr@hpl.hp.com>
    Re: perl 5.6 for linux using CPAN <rootbeer@redcat.com>
        Perl! <damonNOdaSPAM@unispace.com.invalid>
    Re: PM's <rootbeer@redcat.com>
    Re: ppm install using downloaded package <bwalton@rochester.rr.com>
        regex to capture numbers from string <sturman@netdoor.com>
    Re: regex to capture numbers from string <bwalton@rochester.rr.com>
    Re: regexp question (David Wall)
    Re: relocation error <rootbeer@redcat.com>
    Re: Sorting a ':' delimeted file by a field value/surna <lr@hpl.hp.com>
    Re: Sorting a ':' delimeted file by a field value/surna <ivoz@starmail.com>
    Re: SSL stand-alone module? <rootbeer@redcat.com>
    Re: strict variable declaration in subroutines <rootbeer@redcat.com>
    Re: uploading files problem <lucas@cplhk.com>
        using mail-sender with NT scheduler service <geeky2@gte.net>
        Where are the error logs? (Johnny)
    Re: Where are the error logs? <bwalton@rochester.rr.com>
    Re: why does this code print two spaces? <rootbeer@redcat.com>
    Re: Writing Matlab files via Perl <Jonathan.L.Ericson@jpl.nasa.gov>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 15 Jun 2000 22:03:07 -0400
From: "Brian Landers" <brian@bluecoat93.org>
Subject: Re: [Q] Perl implemented in Java?
Message-Id: <CUf25.10881$9M2.58542@news2.atl>

A perhaps better choice would be OROmatcher, http://www.savarese.org, which
*claims* 100% Perl RE compatibility. While I doubt it faithfully reproduces
every nuance of perl RE's (the /x modifier comes immediately to mind), I've
used it quite a bit and it is excellent.

Cheers,
Brian

"Tim" <tcuffel@exactis.com> wrote in message
news:XOb25.2646$Ck1.265618@den-news1.rmi.net...
> Alun Moon wrote in message <3948B8AF.B2C2CA40@ncl.ac.uk>...
> >Bart Lateur wrote:
> >> No as is, for the reasons Tom Phoenix has given. But I think Larry Wall
> >> is being paid (by O'Reilly?) to write a Perl-to-Java-bytecode compiler,
> >> so you could RUN your Perl scripts on a Jave only machine.
> >
> >Just what I need.
> >Especially to get the power of Perl's pattern matching into Java.
> >(also spilt, and array slices)
> >
> >Any news of its progress?
>
>
> http://javaregex.com/
>
> This is a Java package that claims to implement most of
> Perl 5's regex.  I have played with it a little, but cannot
> attest to its quality or efficiency.
>
> It does have a really cool regex game, though.
>
> http://javaregex.com/cgi-bin/pat/agame.asp
>
> -T
>
>




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

Date: 15 Jun 2000 19:16:32 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: [Q] Perl implemented in Java?
Message-Id: <m1u2euv08v.fsf@halfdome.holdit.com>

>>>>> "Brian" == Brian Landers <brian@bluecoat93.org> writes:

Brian> A perhaps better choice would be OROmatcher,
Brian> http://www.savarese.org, which *claims* 100% Perl RE
Brian> compatibility. While I doubt it faithfully reproduces every
Brian> nuance of perl RE's (the /x modifier comes immediately to
Brian> mind), I've used it quite a bit and it is excellent.

In order to be 100% compatible with Perl's regex in 5.6, it'd have to
include a full Perl installation. :) Perl's regex in 5.6 include Perl
code in the match side.

print "Just another Perl hacker," =~ /(.*)/

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Fri, 16 Jun 2000 03:17:22 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: binding a string variable to call a stored proc ?
Message-Id: <39499B37.DA95D9E5@rochester.rr.com>

Andy wrote:
> 
> hi all,
> 
> I'm trying to call a stored procedure and pass it a string
> variable (with spaces) :
> 
> ---SNIP---
> my $my_str_val = "val_a or val_b";
> $sth = $dbh->prepare(q{
>   BEGIN OPEN :cursor FOR
>     SELECT * from tbl_my_table where first_val = :str_first_val;
>   END;
> });
> $sth->bind_param(":str_first_val", $my_string_val, {ora_type =>
> ORA_VARCHAR2});
> 
> ---SNIP---
> 
> The problem seems to be the binding of the string
> $my_string_val. If its set to "val_a" it returns ok, but when
> there seems to be spaces in the string, it returns nothing. What
> am I doing wrong ?!?!??!
> 
> thanks in advance,
> 
> Andy
 ...

<warning>untested, probably off-topic</warning>

I don't use Oracle, so I'm just guessing -- but with other databases I
have used, you need to quote SQL strings with general content (like
space characters, for example) with apostrophes.  So your last line
might be:

    $sth->bind_param(":str_first_val", "'$my_string_val'", {ora_type =>
ORA_VARCHAR2});

And apostrophes inside strings typically need to be doubled
($my_string_val=~s/'/''/g;).  I expect the value specified in bind_param
will simply be plonked into the SQL, which means that if it needs
apostrophes in the final SQL, they need to be there in bind_param. 
Also, note that your placeholder strings are nonportable to many other
DBI drivers.
-- 
Bob Walton


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

Date: Thu, 15 Jun 2000 18:32:27 -0700
From: Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov>
Subject: Re: Bot for this group to auto-answer queries?
Message-Id: <394983AB.92AF1145@jpl.nasa.gov>

John Stanley wrote:
> In article <3949295D.CEEAEB67@jpl.nasa.gov>,
> Jon Ericson  <Jonathan.L.Ericson@jpl.nasa.gov> wrote:
> >I think you might convince people of the usefulness of auto-responses if
> >you start out very small.  For instance, have the bot comment on poor
> >subject lines.  Tom Phoenix regularly posts:
> 
> There was once upon a time a news transport program that resulted in
> emailed error reports to a poster when the news area on the destination
> server filled up. "You message was not accepted...". Isn't it important
> to notify someone that there is an error somewhere?

Ugh!  (But if the error message was sent to the right place and worded
correctly, the world would be a better place, right?)
 
> Programming a bot to harass people about the subject they've chosen is
> not a good idea. Automated email in response to postings in a discussion
> group are not a good idea.

My thought was that all reponses would be posts in c.l.p.m, not email,
but re-reading what I said, I see how I was mis-interpreted.  Except for
the word harass, I don't know why you think it's a bad idea, however. 
What difference does it make if it's Tom Phoenix or a perl program that
responds to poor subject lines with a standard message?  

Jon
-- 
Knowledge is that which remains when what is
learned is forgotten. - Mr. King


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

Date: Fri, 16 Jun 2000 10:46:17 +0930
From: Henry <henry@penninkilampi.net>
Subject: Re: Crazy enough that it might just work...
Message-Id: <henry-61CDA3.10461716062000@news.metropolis.net.au>

In article <slrn8kir75.jil.abigail@alexandra.delanet.com>, 
abigail@delanet.com wrote:

>>> As for "regulars", deja.com only has 39 messages by "Henry"
>>> in this group
>> 
>> What, in the last month?
> 
> No, not in the last month. In the entire period deja.com has been
> archiving.

Well, I just checked the news server run by Australia's largest 
backbone provider, and I've posted 37 messages to this group since 
MONDAY (4 days ago).

I think it's time you stopped quoting deja.com statistics (which I've 
noticed you are fond of doing) - as they are so obviously screwed.


>> Suggest you use a _real_ news service.
> 
> What does the newsservice I use have to do with it? (The service
> I use can of course be determined from the headers.)

I was referring to deja.com.  The implication being that if you're going 
to cite statistics, you should at least cite a source that knows 
how to count, and who's primary role is _not_ flogging cheap, nasty crap 
at inflated prices to mindless lemmings.

(It's not _your_ fault deja.com are hopeless - they just are.)


Henry.


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

Date: Fri, 16 Jun 2000 02:24:47 GMT
From: peter@berghold.net (Peter L. Berghold)
Subject: Re: Determining Dates
Message-Id: <slrn8kj0oa.4p1.peter@localhost.localdomain>

On Thu, 15 Jun 2000 20:56:51 GMT, concerning discussion about Determining Dates
reedjd@bitsmart.com formed electrons and spake thusly:
*]but is there any way in Perl to
*]determine the total number of days a month taking leap years into
*]account?

Hmmm... seems that it would be pretty much the same way you do this in 
any computer language. It is a well published algorithm. 

I just checked my notebooks and could lay my finger on it. Check the 
Knuth books if you have access to a set. It may be in there.

-- 
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
Peter L. Berghold                      http://www.berghold.net
Peter@Berghold.Net               Linux Bigot at Large
"Linux renders ships... Windows NT renders ships useless..."


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

Date: 15 Jun 2000 22:51:11 -0400
From: darkon@one.net (David Wall)
Subject: Re: Does anyone have some exercises?
Message-Id: <8F54E44E8darkononenet@206.112.192.118>

care227@attglobal.net (Drew Simonis) wrote in 
<39492D64.FDF1CF5A@attglobal.net>:
>Tad McClellan wrote:
>> 
>> 
>> You can even modify #1 so that you _post_ your solution, then
>> watch as it gets torn down and redone    :-)
>> 
>
>Oh the pain.  The shame and the pain.  Hmm..
>
>I think I've only mumbled "I'm a moron" 5 times so far today, and 
>only 4 were because of foolish postings.
>
>I'm improving so much.

I'm glad I'm not alone.... I don't post as much as you two, so I have fewer 
opportunities to embarrass myself, but I've posted some dumb things, too.  
(I hesitate to even estimate the proportions for fear of extreme damage to 
my ego)  A few days ago someone asked how to encrypt and *decrypt* a 
string.  I saw 'crypt', and thought, "Ooh, I can help here!", and 
immediately posted a one-line reply of 'perldoc -f crypt'.  I felt so 
stupid when someone pointed out that it's <understatement>slightly 
difficult</understatement> to decrypt a string encrypted with crypt(), and 
my reply was not even on the right track.  

-- 
David Wall
darkon@one.net


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

Date: Fri, 16 Jun 2000 02:58:39 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Graphics files gd.pm and gd.dll
Message-Id: <394996D4.4366D689@rochester.rr.com>

Bobby Singh wrote:
> 
> I need gd.pm and gd.dll from Perl 5 for windows NT. I need it for
> graphics and cannot find in the default perl package or if someone can
> direct me where to get these files.
> 
> Bobby
Assuming you are using ActiveState Perl:

    ppm install GD

at any command prompt.  Note that current versions don't support gif's
-- for a version that supports gif's, see the first edition of the Win32
Perl Resource Kit (I don't know about subsequent editions).
-- 
Bob Walton


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

Date: 15 Jun 2000 20:07:15 -0300
From: Hakon Alstadheim <hakon.alstadheim@oslo.mail.telia.com>
Subject: Re: MacPerl- Back to square one.
Message-Id: <m0og527dcs.fsf@alstadhome.cyberglobe.net>

"B Kemp" <hyagillot@tesco.net> writes:

> A Mac has appeared in my office and I'm supposed to do something with it.
> There don't seem to be specific newsgroups, can't even seem to find an
> active general one.
> Help!
> 
The MacPerl community lives in a mailing-list
<macperl@macperl.org>. Check out how to subscribe on either
www.perl.com or www.perl.org. 

> So, if you want a question rather than idle chatter:-
> Information? Where from?
> I get the impression that standard CPAN modules stand no chance on a Mac-
> true? false?

Cpan is working on the mac (I haven't tried it myself ).

Go to www.apple.com and do a search for 'MPW shell' or something such
to get a commandline shell and c-compiler. The 'tool' version of the
mac binaries work under MPW. The c-compiler needs the shell to
work. I'm a bit rusty on this, the people on the macperl mailinglist
will know.

I don't know wheter the CPAN port is available from CPAN yet, look at
the web-sites and then maybe ask the mailinglist. It's been a while
since I followed it closely.

Now that 5.6 is out with fork emulation, MacPerl might really start to
rock, but I think I'll stick to my Linux box :-).


---
Hakon Alstadheim        Ph: +1 (514) 523 6537
4579 rue Garnier
Montreal (Que) H2J 3S6
Canada 


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

Date: Fri, 16 Jun 2000 02:08:32 +0100
From: "Dominic Bishop" <djbishop@bigfoot.com>
Subject: Need help with timelocal
Message-Id: <8ibupk$4h4qf$1@fu-berlin.de>

I am trying to use the timelocal function to compare 2 dates and find the
difference between them, although this is a bit crude it is accurate enough
for my purposes and with the server belonging to my ISP I don't have the
option of installing something like Date::Calc.
Anyway as I understand it timelocal will give a value in Epoch seconds or
seconds elapsed since sometime in 1970 (on my server anyway). This works up
until 2038 which makes sense due to an integer size limit. The thing is all
the documentation I've read says it works from about 1901-2038 and my
assumption was that this would be by returning a negative value counting
seconds backwards from 1970 for dates before that. I assume this since then
the arithmetic makes sense by having negative values, also for about an hour
before the date/time with Epoch second value 0 it returns a negative number,
ie -3600. My server however returns -1 when I attempt to give it a date much
before this date in 1970 same as if the date is out of the acceptable range,
also if I give it a date say of 1935 it
actually returns the Epoch seconds value for 2035.
Btw I do know that you have to subtract 1900 off the year and 1 off the
month
before passing the parameters to timelocal so that isn't the problem. Also
tried it using timegm() but with the same results.

Any ideas anyone?

Regards

Dominic Bishop






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

Date: Fri, 16 Jun 2000 01:25:09 GMT
From: newbie@db-networks.com
Subject: Numbers and RE
Message-Id: <qpviksobhuiegg6e2fieg4ksr64254n7lc@4ax.com>

I am trying unsuccessfully to make an RE that will:

If it just a number then remove it. ie: 
1,000 becomes blank --or-- 1000 becomes blank
but SD5 stays as a valid entry.

my $data[0] =~ s/\d+$//g;

Syv


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

Date: Thu, 15 Jun 2000 18:59:33 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: Numbers and RE
Message-Id: <8ic1ks$mar$1@brokaw.wa.com>


<newbie@db-networks.com> wrote in message
news:qpviksobhuiegg6e2fieg4ksr64254n7lc@4ax.com...
> I am trying unsuccessfully to make an RE that will:
>
> If it just a number then remove it. ie:
> 1,000 becomes blank --or-- 1000 becomes blank
> but SD5 stays as a valid entry.
>
> my $data[0] =~ s/\d+$//g;

Make a variable blank if it doesn't contain an alpha character.

$data[0] = '' unless ($data[0] =~ /[a-zA-Z]/);

or

$data[0] = '' if ($data[0] !~ /[a-zA-Z]/);

Lauren





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

Date: Fri, 16 Jun 2000 02:18:32 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Numbers and RE
Message-Id: <39498D6E.27E589E@rochester.rr.com>

newbie@db-networks.com wrote:
> 
> I am trying unsuccessfully to make an RE that will:
> 
> If it just a number then remove it. ie:
> 1,000 becomes blank --or-- 1000 becomes blank
> but SD5 stays as a valid entry.
> 
> my $data[0] =~ s/\d+$//g;
> 
> Syv
How about:

  $data[0]=~s/\b\d+\b//g;

?  You won't want the "my", since that doesn't compile (did you try
it?).  If you use the "g" switch, you don't want the $ included, since
it could only match once anyway if the $ is present.  Or you could keep
the $ and forget the g if you want the match to occur only at the end of
the string.  You might want to fancy the above suggestion up a bit by
eliminating leading/trailing/duplicate whitespace from the result.
-- 
Bob Walton


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

Date: Fri, 16 Jun 2000 05:46:31 +0300
From: "Ivo Zdravkov" <ivoz@starmail.com>
Subject: Re: Numbers and RE
Message-Id: <394994d1_2@news.nwlink.com>


<newbie@db-networks.com> wrote in message
news:qpviksobhuiegg6e2fieg4ksr64254n7lc@4ax.com...
> I am trying unsuccessfully to make an RE that will:
>
> If it just a number then remove it. ie:
> 1,000 becomes blank --or-- 1000 becomes blank
> but SD5 stays as a valid entry.
>
> my $data[0] =~ s/\d+$//g;

I think that this covers enough cases

   my $data[0] =~s/\b((\d[.,](?=\d))|\d)+\b//g;

>
> Syv




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

Date: Fri, 16 Jun 2000 03:22:38 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Numbers and RE
Message-Id: <39499C74.C5443F97@rochester.rr.com>

Ivo Zdravkov wrote:
> 
> <newbie@db-networks.com> wrote in message
> news:qpviksobhuiegg6e2fieg4ksr64254n7lc@4ax.com...
> > I am trying unsuccessfully to make an RE that will:
> >
> > If it just a number then remove it. ie:
> > 1,000 becomes blank --or-- 1000 becomes blank
> > but SD5 stays as a valid entry.
> >
> > my $data[0] =~ s/\d+$//g;
> 
> I think that this covers enough cases
> 
>    my $data[0] =~s/\b((\d[.,](?=\d))|\d)+\b//g;
> 
> >
> > Syv
That doesn't even compile.  Did you even try it?
-- 
Bob Walton


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

Date: Fri, 16 Jun 2000 13:51:45 +1000
From: Peter Hill <phill@modulus.com.au>
Subject: Re: Numbers and RE
Message-Id: <3949A451.53F4@modulus.com.au>

newbie@db-networks.com wrote:
> 
> I am trying unsuccessfully to make an RE that will:
> 
> If it just a number then remove it. ie:
> 1,000 becomes blank --or-- 1000 becomes blank
> but SD5 stays as a valid entry.
> 
> my $data[0] =~ s/\d+$//g;
> 
> Syv

Others (Lauren, Bob, Ivo) have replied with solutions which match your
specifications. This post is to suggest you review your specifications -
it might not matter to your application, but 2E8 looks like a number to
me. There are many other variants.
hth
-- 
Peter Hill,
Modulus Pty. Ltd.,
http://www.modulus.com.au/


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

Date: Fri, 16 Jun 2000 07:00:33 +0300
From: "Ivo Zdravkov" <ivoz@starmail.com>
Subject: Re: Numbers and RE
Message-Id: <3949a62b_2@news.nwlink.com>

Yes ... not same but ... look yourself:
script:
---------
#!/usr/bin/perl
use strict;

my $s="  9,5 67 89.9,90 6";

$s=~s/\b((\d[.,](?=\d))|\d)+\b/number/g;

print $s, "\n";
-------------
result:
--------
---------- Perl Exec ----------
  number number number number
Normal Termination
Output completed (1 sec consumed).
--------
"Bob Walton" <bwalton@rochester.rr.com> wrote in message
news:39499C74.C5443F97@rochester.rr.com...
> Ivo Zdravkov wrote:
> >
> > <newbie@db-networks.com> wrote in message
> > news:qpviksobhuiegg6e2fieg4ksr64254n7lc@4ax.com...
> > > I am trying unsuccessfully to make an RE that will:
> > >
> > > If it just a number then remove it. ie:
> > > 1,000 becomes blank --or-- 1000 becomes blank
> > > but SD5 stays as a valid entry.
> > >
> > > my $data[0] =~ s/\d+$//g;
> >
> > I think that this covers enough cases
> >
> >    my $data[0] =~s/\b((\d[.,](?=\d))|\d)+\b//g;
> >
> > >
> > > Syv
> That doesn't even compile.  Did you even try it?
> --
> Bob Walton




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

Date: Thu, 15 Jun 2000 19:12:18 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: OT: Re: Taryag Perl
Message-Id: <MPG.13b32cd5ec5bdc198ab88@nntp.hpl.hp.com>

In article <150620001638146842%degraafSPAMMENOT@SPAMMENOTiname.com>, 
degraafSPAMMENOT@SPAMMENOTiname.com says...
> In article <MPG.13b2d301910a27d98ab86@nntp.hpl.hp.com>, Larry Rosler
> <lr@hpl.hp.com> wrote:

 ...
  
> > The system is called 
> > 'gammatriya', from the value of gamma, 3 (the third letter in the 
> > alphabet).
> 
> I am actually pretty sure that gematriyah derives from 'geometry'. Why
> would they call it after gamma and not beta or tau?

I chose not to mention that false etymology in my post.  Clearly there 
is no relationship between gammatriya and geometry.

I don't know why it wasn't called betadeutera or something; but as for 
tau, what is Greek for 400?  :-)

-- 
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Thu, 15 Jun 2000 18:18:25 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: perl 5.6 for linux using CPAN
Message-Id: <Pine.GSO.4.10.10006151816090.5301-100000@user2.teleport.com>

On Thu, 15 Jun 2000, geneman wrote:

> can u tell me how to get the latest perl using CPAN.

Please don't use 'kewl' spelling on this newsgroup. But (AFAIK) you should
probably not use the CPAN module to compile and install a new version of
Perl itself. Better to download the source and follow the included
directions. Since it typically takes only a few commands to make it all
happen, it's either not complex enough or too complex for automation. :-)

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 15 Jun 2000 20:45:05 -0700
From: damonr <damonNOdaSPAM@unispace.com.invalid>
Subject: Perl!
Message-Id: <0cae95e8.b403dda1@usw-ex0105-037.remarq.com>

Hello,

I just finished developing my site(http://www.devcritic.com) and
was wondering if any of you were intrested in adding any Perl
resource links to my site. The url is
http://www.devcritic.com/sites/Perl/ , feel free to add them
using the Add A Site feature on the left menu or post them here
and i will gladly add them.

Thanks in advance!
Damon Ramsey
http://www.devcritic.com

Got questions?  Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com



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

Date: Thu, 15 Jun 2000 18:15:45 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: PM's
Message-Id: <Pine.GSO.4.10.10006151814510.5301-100000@user2.teleport.com>

On Thu, 15 Jun 2000, Todd Anderson wrote:

> If I install a module in my directory (not the system perl_dir) do I
> need a different path for this...

Have you seen section eight of the FAQ, which includes the question, "How
do I keep my own module/library directory?" Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 16 Jun 2000 02:37:18 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: ppm install using downloaded package
Message-Id: <394991D3.F3E1CF05@rochester.rr.com>

spenc82403@my-deja.com wrote:
> 
> I am unable to install the Date-Calc module using PPM from an NT box
> due to firewalls. I have downloaded the Date-Calc.ppd file from the
> ActiveState site and I believe that I can install the package from the
> directory without connecting to the internet. However, I am getting a
> message "Error installing package 'date-calc.ppd': Could not locate a
> PPM binary of 'date-calc.ppd' for this platform." To get this message,
> I am executing "ppm install date-calc.ppd" from the directory where I
> have downloaded the date-calc.ppd file. What does this message mean? Is
> there another command that I can use (I saw a reference on active state
> site to PPM::InstallPackage)?
> 
> Thanks,
> Trevor
> 703-245-4935

What you need to do is to browse to
http://www.activestate.com/ppmpackages/5.6/zips or
http://www.activestate.com/ppmpackages/5.005/zips (depending on which
version you are using), and download the zip files for the packages you
want.  You may then unzip them somewhere (like maybe c:\temp -- and
remember to preserve the directory structure when unzipping) and then do
ppm like:

    ppm "--location=c:/temp"

And no, the forward slash is not a typo.  And yes, the quotes are
literal.  BTW, there is a complicated procedure to specify environment
variables to let you get around the firewall problem, but it is easier
to just get the zips.  Besides, with the zips you can hang on to the
files in the event you don't wish to keep up with the version frenzy but
may need to install them on additional systems in the future.
-- 
Bob Walton


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

Date: Thu, 15 Jun 2000 22:27:07 -0500
From: sturman <sturman@netdoor.com>
Subject: regex to capture numbers from string
Message-Id: <39499E8B.6EF5C92E@netdoor.com>

I have a record format like this

fieldname1:value,fieldname2:value,fieldname3:value, ...

The number of fields varies.  The problem I choose to work on is trying
to get a regex to grab all the numbers from a value for a specific
field.  Occasionally, the field, which is supposed to be only numbers
will have alphas in it.  I want to do it the more difficult way as
opposed to splitting and tr'ing.  The regex I have so far is

/fieldnameX:(\D*(\d*))+?,fieldnameY/

But $2 is only the digits from the last match and no digits if the value
is like 'fieldnameX:990909090;,'  What I want is a regex to give me all
the numbers in the field value.

I have tried using a few variations.

/fieldnameX:\D*(\d+)\D*(\d*),f/   ### this breaks with 999;999;999

Any helpful knowledge?

st

### what follows is the results and the test program. ###
###results

;
;
xx80993 80993

### test program
#!/usr/bin/perl

while( <DATA> )
{
  print( join( ' ', /fieldnameX:(\D*(\d*))+?,f/ ), "\n" );
}
__DATA__
fieldnameX:;8990380993;,fieldnameY:999999,
fieldnameX:;89903xx80993;,fieldnameY:999999,
fieldnameX:899xlll03xx80993,fieldnameY:999999,




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

Date: Fri, 16 Jun 2000 03:50:15 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: regex to capture numbers from string
Message-Id: <3949A2EC.C16945E9@rochester.rr.com>

sturman wrote:
> 
> I have a record format like this
> 
> fieldname1:value,fieldname2:value,fieldname3:value, ...
> 
> The number of fields varies.  The problem I choose to work on is trying
> to get a regex to grab all the numbers from a value for a specific
> field.  Occasionally, the field, which is supposed to be only numbers
> will have alphas in it.  I want to do it the more difficult way as
> opposed to splitting and tr'ing.  The regex I have so far is
> 
> /fieldnameX:(\D*(\d*))+?,fieldnameY/
> 
> But $2 is only the digits from the last match and no digits if the value
> is like 'fieldnameX:990909090;,'  What I want is a regex to give me all
> the numbers in the field value.
> 
> I have tried using a few variations.
> 
> /fieldnameX:\D*(\d+)\D*(\d*),f/   ### this breaks with 999;999;999
> 
> Any helpful knowledge?
> 
> st
> 
> ### what follows is the results and the test program. ###
> ###results
> 
> ;
> ;
> xx80993 80993
> 
> ### test program
> #!/usr/bin/perl
> 
> while( <DATA> )
> {
>   print( join( ' ', /fieldnameX:(\D*(\d*))+?,f/ ), "\n" );
> }
> __DATA__
> fieldnameX:;8990380993;,fieldnameY:999999,
> fieldnameX:;89903xx80993;,fieldnameY:999999,
> fieldnameX:899xlll03xx80993,fieldnameY:999999,

Hmmm...I think what you want to do is a bit too complicated for a single
substitute.  Maybe something like this would work:

while(<DATA>){
    my @a;
    s/[^:]+:([^,]+),/push @a,$1/eg;
    map {s/\D+//g} @a;
    print join(' ',@a)."\n";
}
__DATA__
fieldnameX:;8990380993;,fieldnameY:999999,
fieldnameX:;89903xx80993;,fieldnameY:999999,
fieldnameX:899xlll03xx80993,fieldnameY:999999,

-- 
Bob Walton


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

Date: 15 Jun 2000 22:47:33 -0400
From: darkon@one.net (David Wall)
Subject: Re: regexp question
Message-Id: <8F54E1085darkononenet@206.112.192.118>

tadmc@metronet.com (Tad McClellan) wrote in 
<slrn8ki5hb.7c8.tadmc@magna.metronet.com>:

>On Thu, 15 Jun 2000 18:01:18 GMT, derekl <dlibby@lhs.com> wrote:
>>
>>I have a long string containing constructs similar to the following,
>>namely a dot followed by a string followed by a string in parantheses.
>>What I would like to do is interchange the strings so:
>>
>>    .string1(string2)
>>
>>would become:
>>    .string2(string1)
>>
>>Any ideas?
>
>
>   s/\.(\w+)\((\w+)\)/.$2($1)/g;   # all on one line
[snip]

Um, what if the string has non-word characters?  I tried it with 

my $str = '.string1$%@*(string2)';

and it didn't work.  'string1$%*' is still a legitimate string even if you 
don't expect to find $%@* in words -- unless someone is cursing or writing 
Perl poetry. (Hmm, is there a difference?) Still, if the string only 
contains word characters, it's faster than the other solutions posted:

#!/usr/bin/perl -w
use strict;
use Benchmark;

timethese( 100000, 
{ # Lauren's solution was the same as the one I came up with, 
  # so I used my name :-)
	'David' => sub { 
		my $str = '.string1(string2)garbage.string3(string4)'; 
		$str =~ s/\.(.*?)\((.*?)\)/.$2($1)/g; 
	},
	'Derek'=> sub { 
		my $str = '.string1(string2)garbage.string3(string4)'; 
		$str =~ s{\.   # dot
          	([^\(]*)       # string1 $1
  	  	\( ([^\)]*) \) # (string2) $2
		}{.$2($1)}gx;
	},
	'Tad' => sub {
	    my $str = '.string1(string2)garbage.string3(string4)'; 
	    $str =~ s/\.(\w+)\((\w+)\)/.$2($1)/g;
	}
});


Benchmark: timing 100000 iterations of David, Derek, Tad...
     David:  6 wallclock secs ( 5.55 usr +  0.00 sys =  5.55 CPU) @ 
18018.02/s (n=100000)
     Derek:  5 wallclock secs ( 4.61 usr +  0.00 sys =  4.61 CPU) @ 
21691.97/s (n=100000)
       Tad:  3 wallclock secs ( 4.51 usr +  0.00 sys =  4.51 CPU) @ 
22172.95/s (n=100000)

Not surprising, I guess, since it makes another assumption about the data.  
I like Derek's solution best as a general solution, since it makes no 
assumptions and doesn't have the expensive .*? in it.

-- 
David Wall
darkon@one.net


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

Date: Thu, 15 Jun 2000 18:09:54 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: relocation error
Message-Id: <Pine.GSO.4.10.10006151809180.5301-100000@user2.teleport.com>

On Thu, 15 Jun 2000, Ken Pszonka wrote:

> I am trying to make my own module, by dynamically linking Oracle ProC
> to my Perl module.  Everything complies but when I try to run the
> application I get a relocation error on my module name.  I am not
> using GNU ld or as.

What error message are you getting, and does either perldiag or your
system's documentation tell you what it means? Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 15 Jun 2000 19:03:53 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Sorting a ':' delimeted file by a field value/surname.
Message-Id: <MPG.13b32ade18b9c01198ab87@nntp.hpl.hp.com>

[Removed alt.perl, which my newsfeed doesn't carry, and which I presume 
isn't worth much attention in any case.]

In article <394952B2.CE3D9035@sti.com.br>, fabion@sti.com.br says...
> well, first..split the file
> while <BLA> {
> ...
> ($arr[0], $var[1], $var[2]) = split (/:/, $_);
> 
> }
> 
> then , to sort the array in alphabetical order try
> 
> @arr = sort { $a cmp $b } @arr;

1.  Please don't quote the entire article you are responding to, 
especially not *after* your comments.

2.  Please post Perl code, not pseudo-code, unless specifically labeled 
as such.

  while <BLA> {

is not Perl code.

3.  Please post tested code, unless specifically labeled as such.  Even 
correcting for your misnaming of the variables, what you posted has no 
relation to the problem.  You split out a few fields of each line into 
an array @arr, then overwrite it for each line of the file.  At the end, 
you sort the three elements of the last array.

Several useful responses were posted hours before yours.  Posts like 
yours just add noise here.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Fri, 16 Jun 2000 06:43:53 +0300
From: "Ivo Zdravkov" <ivoz@starmail.com>
Subject: Re: Sorting a ':' delimeted file by a field value/surname.
Message-Id: <3949a244_1@news.nwlink.com>

WARNING: Hashes can't hold non unique keys

"Michael D. Kirkpatrick" <wizard@psychodad.com> wrote in message
news:3949089C.E3454D9E@psychodad.com...
> Easiest way to do it is to put the entire file in an array.
>
> Example:
> open (DB, "your_file.db");
> while (<DB>){
>     chop($_);
>     ($trash,$trash,$trash,$trash,$key,$trash) = split (/\:/,$_);
> #make the key your 5th item to be sorted by
>     $my_array{$key} = $_;
> }
> close (DB);
>
> foreach $key(sort keys(%my_array)){
>     $current_record = $my_array{$key};
> #do what ever you want with the record...
> #as it loops through, all the records will be
> #sorted in alphebetical order of the key.
> }
>
>
> Quick and easy...
>
>
> Jimmy Lantz wrote:
>
> > Hi,
> > I'm looking for a way to sort a text file (example below),
> > it's delimited by : I need to sort lines according to surname.
> > I'm working with Macperl, and I'm trying to do all the coding my self
> > (not using that many fancy Modules due to "portability".
> > Has anyone any Ideas on how to sort the lines in alphabetical order, A-Z
> > (to add extra spice I need to sort the swedish chars едц as well).
> >
> > Is there a man on this, I've been browsing a lot looking for one.
> > So I have RTFM but I still dont see how I can make this work.
> > Could anyone give me any pointers on how to go about doing it ?
> >
> > Also if someone know about some tutorials on how to make searches on
> > Datafiles I would appreciat a link or two.
> >
> > ############# Exampleline from file. ##############
> > KIN231:111111-1111:John:Burnes:jburnes@hotmail.com:555121212:greenway
> > 21:PO 251:Bournesporth:Scolarship:YES
> >                         ^^^^^^
> > Needs to sort file according to the fifth field in the line.
> >
> > Yours sincerely
> > Jimmy Lantz
> > Sweden
> >
> > ---------------
> > I hope this isn't too much a newbie q for y'all.
>




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

Date: Thu, 15 Jun 2000 18:08:49 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: SSL stand-alone module?
Message-Id: <Pine.GSO.4.10.10006151807430.5301-100000@user2.teleport.com>

On Thu, 15 Jun 2000 robb4444@my-deja.com wrote:

> Is there an SSL stand-alone module in Perl?
> I'm talking somthing compatible with Activestate Perl.
> Something you can drop right in.

Drop right in to what? A CGI program, to instantly make it secure? Nothing
like that....

If there's a module which does what you want, it should be listed in
the module list on CPAN. If you don't find one to your liking, you're
welcome and encouraged to submit one! :-)  Hope this helps!

    http://search.cpan.org/
    http://www.cpan.org/

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 15 Jun 2000 18:29:01 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: strict variable declaration in subroutines
Message-Id: <Pine.GSO.4.10.10006151826270.5301-100000@user2.teleport.com>

On Thu, 15 Jun 2000, egghead wrote:

> Is there a way of setting the default for subroutines to require
> strict variable declaration?  

Sure: Just put 'use strict;' at the top of your source file. :-)

> Is there a way to:
> 1) require subroutines to be declare all variables, or
> 2) not allow a subroutine to affect variables in the main
> program?

Define your subs in a separate source file, or before you've declared the
lexical variables. But if a lexical is in scope when a sub is defined,
it's available to the sub. Oh, well! :-)

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 16 Jun 2000 09:48:29 +0800
From: "Lucas Tsoi" <lucas@cplhk.com>
Subject: Re: uploading files problem
Message-Id: <8ic12a$coh7@imsp212.netvigator.com>

Thanks you.

the problem is, i can't "chown" unless i log into as root.

I think CGI dealing with uploading files and deleting the uploading files
is quite ordinary, is that right?

so are there some better ways for doing so?

That means, I can upload the file and delete the files, all by CGI.



Drew Simonis <care227@attglobal.net> wrote in message
news:3949059F.9EA0C13D@attglobal.net...
> Lucas wrote:
> >
> > Hi all, i got some problems about uploading files (as the code
attached).
> >
> > It seemed work initially, but later i found that the authority of
> > the files that i upload are set to "nobody" as "group", "users" as
"user",
> > I cant even delete it manually unless login as root.
> > That make i have no ideas on record deleting function.
> >
> > Is that there are other better ways for uploading files?
> >
> This really has nothing to do with the actual uploading process,
> but instead is a consequence of the OS.  You are creating a file
> on a UNIX system.  Just as would happen if you logged on to the
> system directly, files created are owned initially by the UID
> that created them.
>
> Check the docs for the "chown" function.




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

Date: Fri, 16 Jun 2000 03:55:47 GMT
From: "Mark Meyer" <geeky2@gte.net>
Subject: using mail-sender with NT scheduler service
Message-Id: <6zh25.1511$YR2.543123@paloalto-snr1.gtei.net>

hello everyone..

environment: NT 4.0, SP5, ActivePerl version 5.005_03 - binary build 517

i have a small win32 perl app that uses Jenda's Mail-Sender lib.  the app
has been in production for almost a year now and working well.  my perl app
is invoked via a .bat file.  the .bat file is invoked by our operations
people by double-clicking on a an icon that i set up on the NT desktop.
very simple and effective.

recently - our customer mandated that we eliminate the need for human
intervention as much as possible.  to this end - i changed my environment
so that instead of the perl app being invoked by an operations person
double-clicking on an icon - i now have it being invoked by the NT scheduler
service.

i want to stress - that the only thing that has changed is: instead of a
human clicking on an icon that in turn calls a batch file - i have the AT
scheduler facility calling the .bat file directly.  see example below:

example:
AT 23:20 /interactive /every:M,T,W,TH,F
c:\appimport\apps\ai_log_check32\go_lc_cigi32.bat

here-in lies the problem.

it appears that when the AT scheduler kicks in the .bat file - it is NOT
giving the perl app enough time to connect and send the mail...this seems
like something simple that i am sure someone has come up against already..
unfortunately - i am at a loss to figure out how to "build in" more time so
that the
perl app can do it thing and send the mail.

please note:  the NT box that this is happening on - has a dedicated
connection to the
smtp server - so there is not "dial-up" time wasted.  even still - the perl
app can not send the
mail fast enough.


any feedback or help would be greatly appreciated
thx
mark





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

Date: Fri, 16 Jun 2000 01:43:56 GMT
From: funny@aol.com (Johnny)
Subject: Where are the error logs?
Message-Id: <wDf25.68336$nl3.245040@typhoon.ne.mediaone.net>

Hi,

I'm using Perl on an NT IIS server and can't seem to find the error logs that I 
was hoping would help me debug my perl scripts. 

Any ideas where they are?



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

Date: Fri, 16 Jun 2000 02:20:20 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Where are the error logs?
Message-Id: <39498DDA.69311391@rochester.rr.com>

Johnny wrote:
 ...
> I'm using Perl on an NT IIS server and can't seem to find the error logs that I
> was hoping would help me debug my perl scripts.
> 
> Any ideas where they are?
Nope.  Maybe if you tried an IIS newsgroup someone there might know?


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

Date: Thu, 15 Jun 2000 18:26:15 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: why does this code print two spaces?
Message-Id: <Pine.GSO.4.10.10006151825260.5301-100000@user2.teleport.com>

On Thu, 15 Jun 2000, mark rowlands wrote:

> print "@gone has disappeared from  $ch_here\n";
> Print "@new  has shown up at $oh_here\n";

perl has no Print function. Please, if you want us to help you, show us
the code you're actually using. Thank you.

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 15 Jun 2000 18:03:09 -0700
From: Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov>
Subject: Re: Writing Matlab files via Perl
Message-Id: <39497CCD.A615174E@jpl.nasa.gov>

David Paul Wipf wrote:
> Does anyone know how to create Matlab .mat files via Perl.  Thanks

Check http://search.cpan.org for Matlab modules.  If nothing there fits
the bill, why not write your own and submit it?  You will need the
Matlab file specification.

Jon
-- 
Knowledge is that which remains when what is
learned is forgotten. - Mr. King


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

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


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