[19008] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1203 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 27 09:05:55 2001

Date: Wed, 27 Jun 2001 06:05:12 -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: <993647112-v10-i1203@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 27 Jun 2001     Volume: 10 Number: 1203

Today's topics:
    Re: 文憑 , 副學士 , 學士及碩士遙距進修課程 <crud_alex@yahoo.com>
        -e url <superbla3000@gmx.net>
    Re: -e url <pne-news-20010627@newton.digitalspace.net>
    Re: -e url nobull@mail.com
    Re: =?iso-8859-2?Q?=A4=E5=BE=CC?= , =?iso-8859-2?Q?=B0= <laszlo.gerencser@portologic.com>
    Re: Browser interface to Perl program? <boa@aaanet.ru>
        Case issue replacing a string with the contents of a va (James Anderson)
    Re: Case issue replacing a string with the contents of  (Anno Siegel)
    Re: Case issue replacing a string with the contents of  <wyzelli@yahoo.com>
        Convert DD-MM-YYYY to age <bkesuma@REMOVE.CAPITALS.yahoo.com>
    Re: Convert DD-MM-YYYY to age nobull@mail.com
    Re: Convert DD-MM-YYYY to age <jonni@ifm.liu.se>
    Re: Convert DD-MM-YYYY to age <pne-news-20010627@newton.digitalspace.net>
    Re: How do I cope with pound (currency) sign? <flavell@mail.cern.ch>
    Re: Localtime Error ?! (Bernard El-Hagin)
        looking for conference in Ontario in August <jon@actcom.co.il>
        MSA modification <i8rgood@hotmail.com>
    Re: MSA modification <pne-news-20010627@newton.digitalspace.net>
        New knowledgebase site - looking for authors, articles  <info@kbaseonline.com>
    Re: newbie directory question <gnarinn@hotmail.com>
    Re: newbie regex <simon.andrews@bbsrc.ac.uk>
    Re: perl compilation on HPUX-11 <h.m.brand@hccnet.nl>
    Re: Perl variable (Anno Siegel)
        Perl-Mysql - inserting long fields <gtoomey@usa.net>
    Re: Perl-Mysql - inserting long fields <carlos@plant.student.utwente.nl>
    Re: Perl-Mysql - inserting long fields <pne-news-20010627@newton.digitalspace.net>
        Range operator <rovf@feriasonline.pt.invalid>
    Re: Range operator <bart.lateur@skynet.be>
    Re: Scanning a file in CGI <gnarinn@hotmail.com>
    Re: Scanning a file in CGI <daniel.hendrickx@alcatel.be>
        Search Patterns <blnukem@hotmail.com>
    Re: sorting a hash <buggs-clpm@splashground.de>
        Starting Browser Windows (Grod)
    Re: Starting Browser Windows <pne-news-20010627@newton.digitalspace.net>
    Re: Upgrading a File Lock (What do you think this is, a nobull@mail.com
    Re: Upgrading a File Lock (What do you think this is, a (Anno Siegel)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 27 Jun 2001 19:41:10 +0800
From: "Alex Lam" <crud_alex@yahoo.com>
Subject: Re: 文憑 , 副學士 , 學士及碩士遙距進修課程
Message-Id: <9hcgon$ic7$1@taliesin.netcom.net.uk>

you know, this is a spam post in chinese...

"Laszlo Gerencser" <laszlo.gerencser@portologic.com> 撰寫於郵件
news:3B39BB45.D7031943@portologic.com...
> maymay@hotmail.com wrote:
> >
> > 請提供文憑 , 副學士 , 學士及碩士遙距進修課程資料, 謝謝!
> Well, this syntax is incorrect.
> But not so bad for a first regexp attempt:-)
> Don't give up!
>
> --
> Laszlo Gerencser
> PortoLogic Ltd.




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

Date: Wed, 27 Jun 2001 12:22:57 +0200
From: joerg pfeiffer <superbla3000@gmx.net>
Subject: -e url
Message-Id: <3B39B401.DA0A5B23@gmx.net>

hello,
i'm absolute beginner, and I only need a very simple script.
I'd like to check if a file exists, but with an url:
if (-e "http://www.domain.de/$var.html")
doesn't work.
Could you tell me the syntax????

Would be very nice
joerg




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

Date: Wed, 27 Jun 2001 13:33:38 +0200
From: Philip Newton <pne-news-20010627@newton.digitalspace.net>
Subject: Re: -e url
Message-Id: <3vgjjtccmeplf2uqkp9cakbk5f5imqjdke@4ax.com>

On Wed, 27 Jun 2001 12:22:57 +0200, joerg pfeiffer
<superbla3000@gmx.net> wrote:

> I'd like to check if a file exists, but with an url:

URLs aren't files. (At least, not necessarily.) As such, "existence" is
not as strongly defined. (Does http://www.example.com/cgi-bin/script.cgi
'exist'? If you access it, it may produce output, but that output may
not have existed before you accessed it and may be gone immediately
afterwards. And there may not even be a file called script.cgi since the
web server may handle that URL completely internally.)

> if (-e "http://www.domain.de/$var.html")
> doesn't work.
> Could you tell me the syntax????

You could issue a HEAD request to the web server for the document and
see whether you get status 200 back.

Use LWP::UserAgent or LWP::Simple, for example (part of LWP =
libwww-perl).

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: 27 Jun 2001 12:40:51 +0100
From: nobull@mail.com
Subject: Re: -e url
Message-Id: <u9sngm177g.fsf@wcl-l.bham.ac.uk>

joerg pfeiffer <superbla3000@gmx.net> writes:

> i'm absolute beginner, and I only need a very simple script.

If you are an absolute beginner how are you able to judge complexity
of the script that will be needed to accomplish your goal?

What you want to do would actually be quite complex task if you tried
to do it in raw Perl. Fortunately there's a module you can install
that does it all for you.

> I'd like to check if a file exists, but with an url:
> if (-e "http://www.domain.de/$var.html")
> doesn't work.

Why would you expect it to?  A URL is not a file.

> Could you tell me the syntax????

use LWP::Simple;
if (head "http://www.domain.de/$var.html")

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Wed, 27 Jun 2001 10:52:53 GMT
From: Laszlo Gerencser <laszlo.gerencser@portologic.com>
Subject: Re: =?iso-8859-2?Q?=A4=E5=BE=CC?= , =?iso-8859-2?Q?=B0=C6=BE=C7=A4h?= ,  =?iso-8859-2?Q?=BE=C7=A4h=A4=CE=BA=D3=A4h=BB=BB=B6Z=B6i=AD=D7=BD=D2=B5=7B?=
Message-Id: <3B39BB45.D7031943@portologic.com>

maymay@hotmail.com wrote:
> 
> 請提供文憑 , 副學士 , 學士及碩士遙距進修課程資料, 謝謝!
Well, this syntax is incorrect.
But not so bad for a first regexp attempt:-)
Don't give up!

--
Laszlo Gerencser
PortoLogic Ltd.


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

Date: Wed, 27 Jun 2001 15:10:17 +0400
From: "Oleg Bakiev1425878565" <boa@aaanet.ru>
Subject: Re: Browser interface to Perl program?
Message-Id: <9hceqf$26al$1@pa.aaanet.ru>


"David Coppit" <newspost@coppit.org> ???????/???????? ? ???????? ?????????:
news:Pine.SUN.4.33.0106270051320.13257-100000@mamba.cs.Virginia.EDU...
>
> Which brings up an interesting question -- has anyone implemented a
> CGI-capable web server in Perl? ;)
>
HTTP::Daemon




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

Date: 27 Jun 2001 04:48:58 -0700
From: James.2.Anderson@bt.com (James Anderson)
Subject: Case issue replacing a string with the contents of a variable.
Message-Id: <1aecebf1.0106270348.4744b45f@posting.google.com>

Hi all,

Learning Perl at the moment and I've ran across a slight speed bump
thats been plaguing me for a while.

Writing a simple program to search for a word and mark every instance
of it within a document.

if ($searchstring !~ /\*/)
   {
   s/\b$searchstring\b/($searchstring)/gi;
   }

This is giving me a problem.  I need it to replace the string found
with the same string in brackets, but at the moment it replaces it
with the $searchstring variable in brackets.  If $searchstring is
"this" and the word found is "This", it will replace it with "(this)"
and not "(This)".

How do I keep the case when I replace the original word?
______________________________

  James Anderson
  BT Ignite Solutions
  Internal IT Support
  Network Change Coordinator
______________________________

Disclaimer:  The contents of this post are in no way affiliated with,
or written on behalf of, BT Ignite Solutions.


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

Date: 27 Jun 2001 11:56:37 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Case issue replacing a string with the contents of a variable.
Message-Id: <9hchll$3vf$1@mamenchi.zrz.TU-Berlin.DE>

According to James Anderson <James.2.Anderson@bt.com>:
> Hi all,
> 
> Learning Perl at the moment and I've ran across a slight speed bump
> thats been plaguing me for a while.

Well, if you hit a speed bump it's probably because you're going
too fast.

> Writing a simple program to search for a word and mark every instance
> of it within a document.
> 
> if ($searchstring !~ /\*/)
>    {
>    s/\b$searchstring\b/($searchstring)/gi;
>    }
> 
> This is giving me a problem.  I need it to replace the string found
> with the same string in brackets, but at the moment it replaces it
> with the $searchstring variable in brackets.  If $searchstring is
> "this" and the word found is "This", it will replace it with "(this)"
> and not "(This)".
> 
> How do I keep the case when I replace the original word?

Look through perlre again and look for the keyword "capture".  It
will point you to a way of solving this.

Anno


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

Date: Wed, 27 Jun 2001 22:43:17 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Case issue replacing a string with the contents of a variable.
Message-Id: <UMk_6.8$PG1.468@vic.nntp.telstra.net>

"James Anderson" <James.2.Anderson@bt.com> wrote in message
news:1aecebf1.0106270348.4744b45f@posting.google.com...
> Hi all,
>
> Learning Perl at the moment and I've ran across a slight speed bump
> thats been plaguing me for a while.
>
> Writing a simple program to search for a word and mark every instance
> of it within a document.
>
> if ($searchstring !~ /\*/)
>    {
>    s/\b$searchstring\b/($searchstring)/gi;
>    }
>
> This is giving me a problem.  I need it to replace the string found
> with the same string in brackets, but at the moment it replaces it
> with the $searchstring variable in brackets.  If $searchstring is
> "this" and the word found is "This", it will replace it with "(this)"
> and not "(This)".
>
> How do I keep the case when I replace the original word?

You need to captured the matched word and then rplace it with itself
surrounded by brackets.

To capture something you use the parens and the corresponding special
variable, first parens stores its capture into $1, second into $2 and so on.
The details are in perlre but to demonstrate...

s/\b($searchstring)\b/($1)/gi;

The parens capture what is matched, and then $1 contains the matched word so
it fits within the brackets.  Note that the brackets perform capturing and
grouping functions on the left side of the s/// operator, but are just
characters on the right.

Wyzelli
--
#Modified from the original by Jim Menard
for(reverse(1..100)){$s=($_==1)? '':'s';print"$_ bottle$s of beer on the
wall,\n";
print"$_ bottle$s of beer,\nTake one down, pass it around,\n";
$_--;$s=($_==1)?'':'s';print"$_ bottle$s of beer on the
wall\n\n";}print'*burp*';




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

Date: Wed, 27 Jun 2001 19:58:20 +0900
From: Batara Kesuma <bkesuma@REMOVE.CAPITALS.yahoo.com>
Subject: Convert DD-MM-YYYY to age
Message-Id: <20010627195820.6af75a4e.bkesuma@REMOVE.CAPITALS.yahoo.com>

Hi,

I am trying to convert DD-MM-YYYY to the age of the person now. I tried to
change the birthday to epoch second with timelocal, and then change the
time now to epoch second, and then subsctract it, and change the seconds
to years. But it doesn't work fot birthday before 1970. Is there any other
way to do this? Thank you very much.

--bk


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

Date: 27 Jun 2001 12:55:33 +0100
From: nobull@mail.com
Subject: Re: Convert DD-MM-YYYY to age
Message-Id: <u9pubq16iy.fsf@wcl-l.bham.ac.uk>

Batara Kesuma <bkesuma@REMOVE.CAPITALS.yahoo.com> writes:

> I am trying to convert DD-MM-YYYY to the age of the person now.

You are not the first, this is FAQ: "How can I compare two dates and
find the difference?"

> I tried to change the birthday to epoch second with timelocal, and then change the
> time now to epoch second, and then subsctract it,

As per the first answer offered in the FAQ.

> [...] timelocal [...] doesn't work [...] before 1970.

1970?

AFIAK it works 1902 - 2037 inclusive.

Epoch second is a _signed_ integer.

Of course, even 1902 can be a problem.

AFIAK the alternative solution to this question (also given in the FAQ
alongside the timelocal solution) does not suffer that limitation.

FAQs are a wonderfull resource.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Wed, 27 Jun 2001 14:21:32 +0200
From: "Jonas Nilsson" <jonni@ifm.liu.se>
Subject: Re: Convert DD-MM-YYYY to age
Message-Id: <9hcj06$je5$1@newsy.ifm.liu.se>

> I am trying to convert DD-MM-YYYY to the age of the person now. I tried to
> change the birthday to epoch second with timelocal, and then change the
> time now to epoch second, and then subsctract it, and change the seconds
> to years. But it doesn't work fot birthday before 1970. Is there any other
> way to do this? Thank you very much.

Add 1000 to the birthdate year, and then add 1000 years to the age?
=>  $date=~s/(\d{4})$/$1+1000/e;

--
_______________________________
Jonas Nilsson
"Batara Kesuma" <bkesuma@REMOVE.CAPITALS.yahoo.com> wrote in message
news:20010627195820.6af75a4e.bkesuma@REMOVE.CAPITALS.yahoo.com...




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

Date: Wed, 27 Jun 2001 14:32:08 +0200
From: Philip Newton <pne-news-20010627@newton.digitalspace.net>
Subject: Re: Convert DD-MM-YYYY to age
Message-Id: <ggkjjtkokqtt6cck9npa41nss8sqjhkb8j@4ax.com>

On 27 Jun 2001 12:55:33 +0100, nobull@mail.com wrote:

> Batara Kesuma <bkesuma@REMOVE.CAPITALS.yahoo.com> writes:
> 
> > [...] timelocal [...] doesn't work [...] before 1970.
> 
> 1970?
> 
> AFIAK it works 1902 - 2037 inclusive.

It doesn't on my ActivePerl build 623 (Perl 5.6.0) as gmtime() (which is
used internally by Time::Local::timelocal to confirm guesses) does not
handle negative arguments.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: Wed, 27 Jun 2001 11:48:15 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: How do I cope with pound (currency) sign?
Message-Id: <Pine.LNX.4.30.0106271138010.12055-100000@lxplus003.cern.ch>

On Tue, 26 Jun 2001, James Taylor wrote:

> Alan J. Flavell <URL:mailto:flavell@mail.cern.ch> wrote:
> >
> > I can't agree.  Perl source code is text, and as such deserves to be
> > transcoded at the character stream level when transferred between
> > systems which use different character storage codings.
>
> Ah, that's what I hadn't appreciated. Thanks.

No problem.  Just in case I hadn't expressed myself clearly enough:
when I said "at the character stream level" I was trying to make the
point that this is a purely formal process on a text "file",
irrespective of what that text may represent (it could be Perl source
code, HTML, whatever) and without any parsing of the contents: thus a
character which is standing for itself would get translated into the
new character coding scheme (let's say for example iso-8859-1 into
EBCDIC), but any characters that were represented internally (examples
in Perl might be constants representing characters in octal or
hexadecimal, or chr($n) or suchlike) would remain untranslated, which
in Perl would usually not be what you want.[1]

Take a look at "perldoc perlport" for more on this issue.

Apologies if that was all obvious.

[1] In HTML the &#number; representation always relates to Unicode
values, no matter what the character coding, and so in HTML you do
_not_ want to translate those numbers.  But that's OT here :-}

-- 

          "All their apostrophes are badly-hung. Send them a
          byte-sized plumbline forthwith." - Alfred Armstrong



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

Date: Wed, 27 Jun 2001 10:05:46 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Localtime Error ?!
Message-Id: <slrn9jjbkv.112.bernard.el-hagin@gdndev25.lido-tech>

On Wed, 27 Jun 2001 11:39:15 +0200, Patrick Steiner
<patrick.steiner@alcatel.ch> wrote:
>Hi
>I have a problem with localtime.
>
>My Script:
>
>#####################
>#!/usr/bin/perl
>
>@jetzt = localtime(time);
>     foreach $wert (@jetzt) {
>                 print "Wert ist $wert\n";
>     }
>########################
>
>This produce the following output:
>
>Wert ist 36
>Wert ist 32
>Wert ist 11
>Wert ist 27
>Wert ist 5     <--
>Wert ist 101
>Wert ist 3
>Wert ist 177
>Wert ist 1
>
>
>But when i run the command "date", the output is:
>
>Wed Jun 27 11:32:36 CEST 2001
>          ^
>why does i have e different between the month (Jun is the 6. not the 5.)

Did you bother to read the documentation on localtime?

perldoc -f localtime
	
>Sorry for my bad english

Sorry for my bad German.

Cheers,
Bernard
--
perl -l54e's yyw q q tvmrx "h\ywx ersxliv zivp legoiv"qiy;y #a-zA-Z#d-gu-z#
chefghijklmnopqrstuvwxyzcJab-def-uPwxyzc;s j j s u u s t t s r r s
ppevalpereeteueje'


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

Date: Wed, 27 Jun 2001 15:48:44 +0200
From: Yehuda Berlinger <jon@actcom.co.il>
Subject: looking for conference in Ontario in August
Message-Id: <3B39E43C.F49F147E@actcom.co.il>

Anyone know of any Perl/XML/Internet/etc... conferences
or events in the lower Ontario (Niagara to Ottawa) area
in August, 2001? Any tips on where I could find such
information?

Yehuda


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

Date: Wed, 27 Jun 2001 06:14:12 -0500
From: "John Fisher" <i8rgood@hotmail.com>
Subject: MSA modification
Message-Id: <9hcfvr$c09$1@nntp9.atl.mindspring.net>

Does anyone have an example of how I might be able to modify the formmail
example from http://www.mattsscriptarchive.com to send to a specific email
address based on one of the form fields and also to append the contents of
every form submission to a .CSV file for reporting later in MS Excel.

I'm not being lazy; just under a very heavy time crunch and would appreciate
the help from someone with more expertise than me.  I am far from a Perl
guru.

Thanks for *any* help (please!),
John




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

Date: Wed, 27 Jun 2001 14:23:02 +0200
From: Philip Newton <pne-news-20010627@newton.digitalspace.net>
Subject: Re: MSA modification
Message-Id: <88hjjt0dl1im5vh3uneveptr9fd8pq0lr3@4ax.com>

On Wed, 27 Jun 2001 06:14:12 -0500, "John Fisher" <i8rgood@hotmail.com>
wrote:

> append the contents of every form submission to a .CSV file

One way of handling CSV files is with DBD::CSV, which uses the standard
DBI interface. Then it's basically as simple as setting up the data
source and 'INSERT INTO table (column1, column2) VALUES (123, "foo")'.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: Wed, 27 Jun 2001 04:50:50 -0700
From: KBaseonline.com <info@kbaseonline.com>
Subject: New knowledgebase site - looking for authors, articles or tips about Perl
Message-Id: <k2ijjtoiggv85e172tq53rsuibbpko2p3i@4ax.com>

Hello Everyone,

We are launching a new free knowledgebase website 
http://www.kbaseonline.com.  It will be a place where you can 
ask questions and get answers, read articles, tips and tutorials!

We are looking for articles, tips or tutorials on the Perl programming
language.  

If you have any articles that you would like to have published 
on our site or if you are a first time author and would like the
world to see your technical expertise please visit our site at
http://www.kbaseonline.com.

Also with any article, tip or tutorial that submit or write for 
us you will receive full credit and a link to your homepage.

Any comments or suggestions are welcome and appreciated.


Thank for your interest,



KBaseonline.com


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

Date: Wed, 27 Jun 2001 10:05:02 +0000
From: gnari <gnarinn@hotmail.com>
Subject: Re: newbie directory question
Message-Id: <993636302.0386524884961545.gnarinn@hotmail.com>

In article <9hc78r$fm1$2@news.panix.com>,
Jason Goodrow  <goodrow@opencity.com> wrote:
>Can perl tell the difference between files read from a directory?
>say opendir - readdir - do something if file is a hash
>?

Do you mean can perl tell the type of content of a file?

Then the answer is no, but there may be tools that can.

for example, under linux, the command 'file' can recognise a number
of filetypes based on their 'magic number' (first few bytes of the file),
so you may use something like

$_=`/usr/bin/file $myfile`;
if (/Berkeley DB Hash file/) {
  # do something
}


gnari





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

Date: Wed, 27 Jun 2001 12:14:55 +0100
From: Simon Andrews <simon.andrews@bbsrc.ac.uk>
Subject: Re: newbie regex
Message-Id: <3B39C02F.9271DEA4@bbsrc.ac.uk>

Jason Goodrow wrote:
> 
> sorry I know I should hunt longer but my brain gave up -
> 
> I want to match files with two digits at the begining
> 
> if ($file =~ /\d\d.+/)

close.  Try...

if ($file =~ /^\d\d/)

Use the ^ to anchor the two digits to the start of the pattern.  You
don't need the .+ at the end unless you specifically care that the
filename is not *just* two digits.

"perldoc perlre" for all the gory details you could ever want.


Simon.


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

Date: Wed, 27 Jun 2001 14:28:57 +0200
From: "H. Merijn Brand" <h.m.brand@hccnet.nl>
To: comp.lang.perl.misc
Subject: Re: perl compilation on HPUX-11
Message-Id: <Xns90CD935391740Merijn@192.0.1.90>

"H. Merijn Brand" <h.m.brand@hccnet.nl> wrote in
news:Xns90CBBB57728B7Merijn@192.0.1.90: 

>> I tried to compile Perl Version 5.5003 on HPUX-10 using g++ compiler but
>> it could not compile ext/ODBM_File/ODBM_File.xs. It says that the
>> implicit declaration functions of dbminit() and store(). Is there any
>> solution for this problem? 
> 
> We're working on a transparant gcc port for HP-UX 11.00, but more of
> those problems like you describe pop up on a regular basis. There ain't
> no standard solution for this yet.

Just succeeded in building gcc-3.0 native 64 bit, also supporting 32 bit, on 
HP-UX 11.00 (hppa-2.0w) and built bleadperl with it, now passing *ALL* tests

hists will be patched to support gcc-3.0 accordingly soon

> If you've got some bandwidth left, visit for a fully functional 64bit GNU
> development environment:
> 
> http://devresource.hp.com/OpenSourcebin/hppa2.0w-hp-hpux11.00.tar.Z (88
> Mb) 

Consider `upgrading' that download with binutils 2.11.2, because that suite is 
using binutils 2.9 which is far from compatible with gcc-3.0

> It's possible to build a working 64bitall perl in this environment, but
> some tests still fail. It's up to you to decide if it's enough.
> 
> For the moment, we advice you to use HP ANSI-C compiler if available.

That still holds
-- 
H.Merijn Brand    Amsterdam Perl Mongers (http://www.amsterdam.pm.org/)
using perl-5.6.1, 5.7.1 & 626 on HP-UX 10.20 & 11.00, AIX 4.2, AIX 4.3,
     WinNT 4, Win2K pro & WinCE 2.11 often with Tk800.022 &/| DBD-Unify
ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/


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

Date: 27 Jun 2001 10:08:56 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Perl variable
Message-Id: <9hcbbo$n7q$1@mamenchi.zrz.TU-Berlin.DE>

According to Bart Lateur  <bart.lateur@skynet.be>:
> Thierry wrote:
> 
> >with shell:
> >$ nb=`ps -ef|grep toto| wc -l`
> >$ echo $nb
> >3
> >
> >with perl ???
> >something like nb=system(ps -ef|grep toto|wc -l)
> That would be 
> 
> 	$nb=system("ps -ef|grep toto|wc -l");
> 
> but you loose all info sent to STDOUT from the program, as system()
> doesn't catch it. Instead, use
> 
> 	$nb=`ps -ef|grep toto| wc -l`;

 ...or use grep's ability to count:

        $nb=`ps -ef|grep -c toto`

Anno


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

Date: Wed, 27 Jun 2001 20:38:23 +1000
From: "Gregory Toomey" <gtoomey@usa.net>
Subject: Perl-Mysql - inserting long fields
Message-Id: <5si_6.3857$e5.22261@newsfeeds.bigpond.com>

Hi everyone. I'm sure that this has been asked lots of times before but bear
with me!

I just upgraded my web hosting to get Perl and mysql.

I want a general Perl script to insert/update mysql tables. I have found a
script called Mysqledb http://www.solution4web.com/mysqlwdb/ which works but
is very basic.
The problem is that the browser fields in this script are about 16 chars
long. I have some "text" fields my my database (length to 64K), and may need
to write a small essay!

Are there any Perl scripts that allow allow insert/update of mysql tables,
and will accommodate long text fields?

Thanks

Gregory Toomey




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

Date: Wed, 27 Jun 2001 14:29:11 +0200
From: "carlos" <carlos@plant.student.utwente.nl>
Subject: Re: Perl-Mysql - inserting long fields
Message-Id: <9hcjiv$f00$1@dinkel.civ.utwente.nl>

man DBI will help probably you out here

--
carlos
:wq

"Gregory Toomey" <gtoomey@usa.net> wrote in message
news:5si_6.3857$e5.22261@newsfeeds.bigpond.com...
> Hi everyone. I'm sure that this has been asked lots of times before but
bear
> with me!
>
> I just upgraded my web hosting to get Perl and mysql.
>
> I want a general Perl script to insert/update mysql tables. I have found a
> script called Mysqledb http://www.solution4web.com/mysqlwdb/ which works
but
> is very basic.
> The problem is that the browser fields in this script are about 16 chars
> long. I have some "text" fields my my database (length to 64K), and may
need
> to write a small essay!
>
> Are there any Perl scripts that allow allow insert/update of mysql tables,
> and will accommodate long text fields?
>
> Thanks
>
> Gregory Toomey
>
>




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

Date: Wed, 27 Jun 2001 14:37:03 +0200
From: Philip Newton <pne-news-20010627@newton.digitalspace.net>
Subject: Re: Perl-Mysql - inserting long fields
Message-Id: <sqkjjt49ririmgndmjqp7mp73u28vpocpi@4ax.com>

On Wed, 27 Jun 2001 20:38:23 +1000, "Gregory Toomey" <gtoomey@usa.net>
wrote:

> Are there any Perl scripts that allow allow insert/update of mysql tables,
> and will accommodate long text fields?

You can write your own using, for example, DBI and DBD::mysql.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: 27 Jun 2001 14:41:05 +0200
From: Ronald Fischer <rovf@feriasonline.pt.invalid>
Subject: Range operator
Message-Id: <7qf3d8mp02m.fsf@demchh2msx.icn.siemens.de>

The following program is supposed to print a part of standard input,
together with its line numbers. The part is indicated as a line number
range, so you can request (for instance) to print lines 10 to 20 of
standard input:

#!/usr/bin/perl -w
use strict;
my $from=$ARGV[0];
my $to=$ARGV[1];
die if $from > $to;
print "$from $to :\n";
while(<STDIN>)
{
        print "$.: $_" if ($from .. $to);
}

Strangely, it always prints *all* of standard input, though ($from
 .. $to) is used in a scalar context, and $. has the correct value. Can
someone explain me, what I did wrong? Of course I could manually check
($. >= $from) && ($. <= $to), but I thought the range operator would be
useful here too.

Ronald
-- 
To reduce spam in my inbox, the address given in the Reply-To: header is
not guaranteed to live longer than 1 month after the article was
posted. My permanent address is (after deleting the XXX): 
Ronald Otto Valentin Fischer <rovfXXX@operamail.com>


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

Date: Wed, 27 Jun 2001 12:56:24 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Range operator
Message-Id: <iqljjtkiensmppno2spiri8gjff7i7nv1t@4ax.com>

Ronald Fischer wrote:

>The following program is supposed to print a part of standard input,
>together with its line numbers. The part is indicated as a line number
>range, so you can request (for instance) to print lines 10 to 20 of
>standard input:

>while(<STDIN>)
>{
>        print "$.: $_" if ($from .. $to);
>}
>
>Strangely, it always prints *all* of standard input, though ($from
>.. $to) is used in a scalar context, and $. has the correct value. Can
>someone explain me, what I did wrong?

The magic doesn't work, if you're using a variable. It only works with
numeric literals. Therefore, the variables are treated as a boolean, and
since 10 and 20 are both true, everything is printed.

It's problems like this that make me question the value of Perl's DWIM.
Since you can't replace even a simple literal with a variable without it
breaking down, I wonder why it's there at all. It's not as if you need
this that often, do you? Enough to warrant a (confusing) shortcut?

So, a simple, explicit

	print "$.: $_" if ($.==$from .. $.==$to);

will do.

-- 
	Bart.


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

Date: Wed, 27 Jun 2001 09:54:57 +0000
From: gnari <gnarinn@hotmail.com>
Subject: Re: Scanning a file in CGI
Message-Id: <993635697.723064171150327.gnarinn@hotmail.com>

In article <3B39A0E1.5837118E@alcatel.be>,
Danny Hendrickx  <daniel.hendrickx@alcatel.be> wrote:
>Hello,
>
>I try to write a CGI program that scans a file line by line and prints
>out the parts of the line in different variables in a table (parts are
>separated by '|' in the file to be scanned).
>

You need to work on your debugging skills.

First you should have tried to simplify your problem. For example
you seem to assume that this problem has to do with CGI
You should have tried this as a non-CGI script by removing all CGI stuff,
and you would have found your problem was still there.

(snipped stuff)

>    open (I,"<s1docs.txt")||die "Cannot open s1docs.txt:$!";

(snipped more)

>
>    while(<I>)           #<== this part does not work
>     {
>      ($ref,$area,$doctitle,$docnr,$doclink,$catalog,$keyw)= split(/|/);

No, THIS is the part that does not work.
A simple debug print here would have shown you that the split failed

Now you should read the docs, in particular perldoc perlre
and you will find that some characters need to be quoted in regular
expressions. Your split should be: split(/\|/)


gnari


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

Date: Wed, 27 Jun 2001 13:39:40 +0200
From: Danny Hendrickx <daniel.hendrickx@alcatel.be>
To: gnari <gnarinn@hotmail.com>
Subject: Re: Scanning a file in CGI
Message-Id: <3B39C5FC.C717C181@alcatel.be>

Hello gnari,

you were right about the split. I _do_ know that some characters need to
quoted, but due to the CGI stuff I overlooked this error. Makes me think
of my first electronics project where I replaced all transistors because
I didn't know how they worked. The faulty component appeared to be a
capacitor later on.

But now that I've got it working, I took to the second phase of my
little project here, and that is a program that is able to add to the
s1docs.txt file, starting from some user parameters entered via some
textfield boxes and popup menus. 
Entering the parameters works well, but modifying the files doesn't.

This time I took your advice and ran the program without CGI and it
worked. However, under CGI it doesn't. What I'm seeing is that the
s1ccou.txt file never gets updated (or only once the first time) and
that the s1docs.txt never gets appended to.

Would you mind taking a look at the program ? I don't want to press you
though, so if you don't feel like helping me out, just tell me and I'll
understand.

I suspect it has got something to do with my program not having the
right to write these files on our server, but I don't get any error
messages from the server when I try to write the files.

Here's the program: 

#!/usr/local/bin/perl -w

use strict;

use CGI qw(:standard);

my (
    $TITLE,
    $HEADER,
    %arealist,
    $curcount
   );

$TITLE = "SS31 Document Overview";
$HEADER = "Add a document";

print header(),start_html($TITLE),h1($HEADER);

my $action = param("action");
my $docnr = param("docnr");
my $doctitle = param("doctitle");
my $docarea = param("docarea");
my $doclink = param("doclink");
my $keyword = param("keyword");

if (param())
  {
   if ($doctitle && $docnr && $docarea && $doclink)
     {
      my $doctitle=param("doctitle");
      my $docnr=param("docnr");
      my $docarea=param("docarea");

      open (I,"<s1ccou.txt")||die "Cannot open counter file for
reading:$!";
      $curcount=<I>;
      $curcount++;
      close I;

      open (O,">>s1docs.txt")||die "Cannot open docs file for
adding:$!";
      print O
$curcount,"|",$docarea,"|",$doctitle,"|",$docnr,"|",$doclink,"|NO\n";
      close O;

      open (O,">s1ccou.txt")||bail("Cannot open counter file for
writing:$!");
      print O $curcount;
      close O;

      print p("Document has been added to area $docarea, with internal
reference number $curcount.");
      print p("In order to catalog the document (so that it can be used
in the search engine),");
      print p("please send a mail to mailto:daniel.hendrickx\@alcatel.be
containing the information below.");
      print p("<br>Document title: $doctitle");
      print p("Document link: $doclink");
      print p("Internal reference number: $curcount");
     }
   else
     {
      print p("Please fill in all the fields before submitting");
      #backbutton
     }
   }
else
   {
    print hr();
    print start_form();
    %arealist=(
               PARM => "PARM",
               MISC => "MISCELLANEOUS",
               STAN => "STRING ANALYSIS",
               ROUT => "ROUTING",
               SUBS => "SUBSCRIBER");
    print p("Document title   : ", textfield ("doctitle"));
    print p("Document number  : ", textfield ("docnr"));
    print p("Link to document : ", textfield ("doclink"));
    print p("Area             : ", popup_menu ("docarea",\%arealist));
    print p("<br>");
    print p(submit("submit"),reset("clear"));
    print end_form(),hr();
   }
print end_html;


-- 
Regards,
                                                ________________
________________________________________________\              /_____
 Feature Development Team Leader WR2A team 7 Services and SAD /
 SW-Engineering - Routing - VJ33                Hendrickx Danny
 phone : +32-3-240 3916                         ALCATEL  TELECOM
 fax   : +32-3-240 9899                         Fr.Wellesplein 1
 mailto:daniel.hendrickx@alcatel.be           2018 Antwerp Belgium
______________________________________________________\  /___________
URL: http://www.se.bel.alcatel.be/CH_sector1/SS31/     \/
*********************************************************************
What happens if you get scared half to death twice?
*********************************************************************


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

Date: Wed, 27 Jun 2001 12:55:15 GMT
From: "Blnukem" <blnukem@hotmail.com>
Subject: Search Patterns
Message-Id: <TIk_6.15437$I22.1540721@news02.optonline.net>

Hi All

I'm trying to replace a string  of "filename **.dat" to "filename.txt" I can
get it to replace "filename **.dat" to ""filename *.txt"  with this:

$CATAGORY_DATA {$key} =~ s/ \*\.dat/.txt/g;

but I cant figure out how to replace two of the * in the string

$CATAGORY_DATA {$key} =~ s/ \*\*\.dat/.txt/g;

This don't work please help

Thanxs in Advance




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

Date: Wed, 27 Jun 2001 12:17:52 +0200
From: Buggs <buggs-clpm@splashground.de>
Subject: Re: sorting a hash
Message-Id: <9hcble$n3e$03$1@news.t-online.com>

tez wrote:

> Hi there,
>             I'm sure ppl have discussed this one here but i can't remember
> the result of the discussion...

No need to bother your mind ...

http://groups.google.com

Just write that on a Post-it
and stick it on your monitor.

http://groups.google.com

You can search the news of the last 5 years.

http://groups.google.com


Have fun,
Buggs


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

Date: 27 Jun 2001 04:45:42 -0700
From: ggrothendieck@volcanomail.com (Grod)
Subject: Starting Browser Windows
Message-Id: <ffd662ea.0106270345.4c36d3db@posting.google.com>

I would like to write a client side Perl program 
on Windows 2000 which starts up several Internet
Explorer browser windows with URLs that I calculate 
internally in my program.  

How can one do this in Perl?

Thanks.


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

Date: Wed, 27 Jun 2001 14:34:56 +0200
From: Philip Newton <pne-news-20010627@newton.digitalspace.net>
Subject: Re: Starting Browser Windows
Message-Id: <vjkjjt84lti9rb5rm8pec3o6us8hfkmban@4ax.com>

On 27 Jun 2001 04:45:42 -0700, ggrothendieck@volcanomail.com (Grod)
wrote:

> I would like to write a client side Perl program 
> on Windows 2000 which starts up several Internet
> Explorer browser windows with URLs that I calculate 
> internally in my program.  
> 
> How can one do this in Perl?

1) If Internet Explorer is your default browser, you might be able to
use something like  system("start $url")  to start it up

2) Or you could remote-control MSIE with DDE or OLE automation. Consult
the documentation for MSIE to find out whether that's possible. (I think
at least OLE automation is possible, and Perl can do that with
Win32::OLE, but I don't know the syntax that MSIE wants.)

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: 27 Jun 2001 12:32:40 +0100
From: nobull@mail.com
Subject: Re: Upgrading a File Lock (What do you think this is, a Holiday Inn?)
Message-Id: <u9vgli17l3.fsf@wcl-l.bham.ac.uk>

miko@idocs.com (Miko O'Sullivan) writes:

> There's the problem: the script can't get an exclusive lock while it currently
> has a shared-lock

It can on every OS I've used so long as it tries to upgrade the lock
on same filehandle rather than opening a new one and trying to take a
new lock on that.

There is, of course, a possible deadlock condition if two processes both
want to upgrade their read locks at the same time.  As others have
pointed out you can avoid this with an auxillary semaphore.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: 27 Jun 2001 12:28:35 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Upgrading a File Lock (What do you think this is, a Holiday Inn?)
Message-Id: <9hcjhj$6j5$1@mamenchi.zrz.TU-Berlin.DE>

According to  <nobull@mail.com>:
> miko@idocs.com (Miko O'Sullivan) writes:
> 
> > There's the problem: the script can't get an exclusive lock while it currently
> > has a shared-lock
> 
> It can on every OS I've used so long as it tries to upgrade the lock
> on same filehandle rather than opening a new one and trying to take a
> new lock on that.
 
When I tried this (on one platform) I found that the semantics of
"lock upgrading" is actually to release the current lock (if present)
and then to apply for another.  The only advantage over explicitly
unlocking is that there is no space between "unlock" and "relock"
where a maintainer could carelessly access the protected file.
The drawback is that the code *looks* like it never gives up the
lock, but actually does.  So, if you "upgrade" a shared lock to an
exclusive one, there is no guarantee the file will be unchanged.

If I remember the thread right, it was about a lengthy calculation
of an update that only needed to read the file, and the idea was
to upgrade a shared lock to exclusive only for the write.  With
the semantics as stipulated, this is unsafe.  The updating process
must keep an exclusive lock all the time.

> There is, of course, a possible deadlock condition if two processes both
> want to upgrade their read locks at the same time.  As others have
> pointed out you can avoid this with an auxillary semaphore.

The deadlock doesn't happen when the "upgrade" implicitly releases
the prior lock.

Anno


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

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.  

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


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