[16236] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3648 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 13 03:10:26 2000

Date: Thu, 13 Jul 2000 00:10:17 -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: <963472217-v9-i3648@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 13 Jul 2000     Volume: 9 Number: 3648

Today's topics:
    Re: Newbies cry for help <peter.sundstrom@eds.com>
    Re: Newbies cry for help <ecco64@chello.nl>
        Oh my word another stupid troll ( was Re: ATTENTION PER <gellyfish@gellyfish.com>
    Re: parsing CSV file <akurczyn@usa.net>
    Re: parsing CSV file <jekov@cig.nml.mot.com>
        perl counter on MS IIS server bobbyng@my-deja.com
    Re: perl counter on MS IIS server <cal@iamcal.com>
    Re: Raise Exception when failure occurs ?? <gellyfish@gellyfish.com>
    Re: Reading lines of a file within a loop? (Bernard El-Hagin)
    Re: Reading perl packets ? <gellyfish@gellyfish.com>
    Re: stupid perl question <gellyfish@gellyfish.com>
        Whelp <ecco64@chello.nl>
    Re: write to database <yosikim@lgeds.lg.co.kr>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 13 Jul 2000 17:00:45 +1200
From: "Peter Sundstrom" <peter.sundstrom@eds.com>
Subject: Re: Newbies cry for help
Message-Id: <8kjiff$s6v$1@hermes.nz.eds.com>


Ecco wrote in message ...
>> >Greetings guru's! I just recently started programming with Perl, and
>I'm>looking for a script that pop-ups a new browser-window, but I have NO
>clue
>> >how to do that... Thanx 4 ur time,
>> >    ~ecco~
>> >
>> >
>> try
>> <a href="somelink" target=_blank>some text</a>
>> ps this is not perl but HTML.
>
>Thanx, but the reason I want it in a Perl-script is; I need to create a
>profile in a chat-box that pops-up the window. It only allows limited HTML
>and NO JAVA, it does except Perl-scripts though.

print qq(<a href="somelink" target=_blank>some text</a>\n);





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

Date: Thu, 13 Jul 2000 06:30:43 GMT
From: "Ecco" <ecco64@chello.nl>
Subject: Re: Newbies cry for help
Message-Id: <nmdb5.367428$k22.1586840@flipper>

Peter, you rock!

--
-----------------------------------------------------
Click here for Free Video!!
http://www.gohip.com/free_video/

"Peter Sundstrom" <peter.sundstrom@eds.com> wrote in message
news:8kjiff$s6v$1@hermes.nz.eds.com...
>
> Ecco wrote in message ...
> >> >Greetings guru's! I just recently started programming with Perl, and
> >I'm>looking for a script that pop-ups a new browser-window, but I have NO
> >clue
> >> >how to do that... Thanx 4 ur time,
> >> >    ~ecco~
> >> >
> >> >
> >> try
> >> <a href="somelink" target=_blank>some text</a>
> >> ps this is not perl but HTML.
> >
> >Thanx, but the reason I want it in a Perl-script is; I need to create a
> >profile in a chat-box that pops-up the window. It only allows limited
HTML
> >and NO JAVA, it does except Perl-scripts though.
>
> print qq(<a href="somelink" target=_blank>some text</a>\n);
>
>
>




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

Date: 12 Jul 2000 22:25:28 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Oh my word another stupid troll ( was Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!!)
Message-Id: <8kino8$7tt$1@orpheus.gellyfish.com>

On Wed, 12 Jul 2000 02:19:11 GMT p3rlc0dr@my-deja.com wrote:
> In article <8kgfbu$74i$1@bcrkh13.ca.nortel.com>,
>   bmetcalf@nortelnetworks.com wrote:
>> p3rlc0dr@my-deja.com writes:
>>
>>  >
>>  > I read a nice book of Matt Wright.  Matt says Perl is the web code.
>>
>> Isn't that nice.  The majority of all Perl code written has nothing to
>> do with the web or cgi.  I don't know the exact quote from Matt's
> book,
>> but you are misunderstanding what he meant.
> 
> Matt is nice.  He explained me about localtime and 19100 and why
> guestbook will do okay without file locking.
> 

Thats it.  I was going to stay out of this, but you have now gone to
far.  Matt Wrights little scripts are almost singlehandedly responsible
for causing all of the so called Y2K problems that have been experienced
with Perl.  The guestbook as he has designed it *cant* use file locking
as it would rely on some web server co-operating.  Many people have
designed things that work better and safer and can usefully use file
locking.  And yes the guestbook *does* has a concurrency problem.

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: Wed, 12 Jul 2000 23:10:29 -0500
From: "Alejandro Kurczyn" <akurczyn@usa.net>
Subject: Re: parsing CSV file
Message-Id: <396d40a2$1_2@excalibur.gbmtech.net>

Check if the Text::ParseWords module is available on your installation, I
believe it is on the Windows one, it evens detects commas inside quote or
double-quotes.

Now, if anybody knows of the best (meaning fastest) way of parsing a CSV
into arrays or hashes I'll appreciate it :-)

Regards,
Alejandro

"Nickolay" <kolya3@rocketmail.com> escribió en el mensaje
news:396CFCE7.E3EC944F@rocketmail.com...
> Hello all,
>
> I am trying to parse a CSV file on a line by line basis.
> In otherwords I want to parse a line, where each field is separated with
> a
> comma. I want to store all these fields in an array.
>
> Unfortunatelly splitting the line simply by commas does not work
> since some of the field values themselves contain commas.
>
> I am new to Perl so please bear with me.
>
> Does anyone have a good reg expression that they've already come up with
>
> for this sort of parsing?
>
> Thanks for your time.
>
> -N.
>
>




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

Date: Fri, 14 Jul 2000 02:12:53 +0900
From: Stoyan Jekov <jekov@cig.nml.mot.com>
Subject: Re: parsing CSV file
Message-Id: <396DF894.64037E3C@cig.nml.mot.com>

There is Text::CSV and Text::CSV_XS (extended) perl modules for parsing CSV
files.
For use see for example perlhoo:
http://www.webreference.com/perl/xhoo/index.html

My suggestion is to use separator other than comma. For example '|'. Or if
you prefer comma,
before saving some field from array to file, convert all commas in it to ';'
and when read it - convert
';' back to comma.

Regards,
Stoyan

Nickolay wrote:

> Hello all,
>
> I am trying to parse a CSV file on a line by line basis.
> In otherwords I want to parse a line, where each field is separated with
> a
> comma. I want to store all these fields in an array.
>
> Unfortunatelly splitting the line simply by commas does not work
> since some of the field values themselves contain commas.
>
> I am new to Perl so please bear with me.
>
> Does anyone have a good reg expression that they've already come up with
>
> for this sort of parsing?
>
> Thanks for your time.
>
> -N.



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

Date: Thu, 13 Jul 2000 04:05:40 GMT
From: bobbyng@my-deja.com
Subject: perl counter on MS IIS server
Message-Id: <8kjf6l$u5d$1@nnrp2.deja.com>

I have been using a perl script which do the text
counter function on the unix server. There is a
line in the code which gets the filename of the
viewing page.

$count_page = "$ENV{'DOCUMENT_URI'}";

It works on unix servers. I do not want to use
ASP counter code as my webpage is html only. Do
anyone know how to do the same thing on a NT IIS
server?

Bobby


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 13 Jul 2000 07:46:25 +0100
From: "Cal Henderson" <cal@iamcal.com>
Subject: Re: perl counter on MS IIS server
Message-Id: <UAdb5.44$ma3.1007@news6-win.server.ntlworld.com>


> I have been using a perl script which do the text
> counter function on the unix server. There is a
> line in the code which gets the filename of the
> viewing page.
>
> $count_page = "$ENV{'DOCUMENT_URI'}";
>
> It works on unix servers. I do not want to use
> ASP counter code as my webpage is html only. Do
> anyone know how to do the same thing on a NT IIS
> server?

Depending on how you are using it, you might be looking for:

$count_page = "$ENV{'SCRIPT_NAME'}";

--
Cal Henderson

sub a{my$a=reverse shift;$a=~y/b-z/a-y/;unshift@a,$a;}sub b{$c.=reverse
shift;while(length($c)>=$b[0]){a(
substr($c,0,$b[0]));$c=substr($c,$b[0]);shift@b;}}@b=(6,3,5,4,10,6,4,4,2,1);
$a="l?jouipv"."ezvmxpbuxih";
$a.=",jofoqqibmzamsfsfxfjtuiIg";while($a ne
""){b(substr($a,0,2));$a=substr($a,2);}print join(" ",@a);




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

Date: 13 Jul 2000 08:16:29 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Raise Exception when failure occurs ??
Message-Id: <8kjqcd$pbj$1@orpheus.gellyfish.com>

On Wed, 12 Jul 2000 11:53:14 +0200 Ed Bras wrote:
> Iain Chalmers <bigiain@mightymedia.com.au> wrote in message
> news:bigiain-1207001835470001@bigman.mighty.com.au...
>> In article <8kh9gs$8uk$1@enterprise.cistron.net>, "Ed Bras"
>> <e.bras@hccnet.nl> wrote:
>>
>> >What I really "miss" (or at least don't know how to do it) in Perl, is
> that
>> >when an runtime exception occurs the script just dies, without giving you
>> >the oppurtonity to handle the exception, just like delphi, java or visual
>> >basic.
>> >
>> >What can I do to overcome this problem in perl ?
>>
>> perldoc -f eval
>>
>> cheers
>>
> 
> Buuuut, I know eval, but is that THE proper way to do it ??
> I mean does it work ok, to put eval around about hundred statement for
> example ??? Isn't there a more elegant way to do it ??
> 

It is the way that it is done.  If you want to lose the granularity of
wrapping every critical section in and eval you could put your whole
program in a subroutine and then wrap that in an eval - you could even
examine $@ n detail to determine what went wrong ...

eval {
       main_program();
     }
if ( $@ )
{
    # do whatever it is you have to do
}

sub main_program
{

 ....

}


Of course having each individual statement of concern wrapped in an eval
might prove to be simpler for a more complex program as you know implicitly
by the context what resources have been allocated and what needs to be
put right at that point - whereas in the above example you will have to
go to some lengths to determine where it failed and what it is you have
to put back.

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: Thu, 13 Jul 2000 06:18:17 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Reading lines of a file within a loop?
Message-Id: <slrn8mqngn.9rf.bernard.el-hagin@gdndev25.lido-tech>

On 12 Jul 2000 15:38:41 GMT, Ilmari Karonen <iltzu@sci.invalid> wrote:
>In article <slrn8mosle.9rf.bernard.el-hagin@gdndev25.lido-tech>,
>Bernard El-Hagin wrote:
>>>	my $speed = $1;
>>>>      if ($speed >= 500 )
>>            ^^^^^^
>>This is where "use strict" will cause the script to die unless you make
>>$speed global.
>
>Eh? I see no closing brace between those two lines, so how could
>$speed go out of scope between them?
>
>Admittedly, the code has been quoted and edited so much I can't be
>100% sure I (or someone else) didn't snip out something relevant.

I was referring to this situation (which got lost in the quoting, I
think):

if (/bla/)
{
	my $speed = 2;
}
if ($speed == 2)
{
	print "I won't compile with 'use strict'";
}

Bernard
--
Look, man, I'm telling you I can't find .signature: No such file or
directory.


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

Date: 13 Jul 2000 08:19:09 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Reading perl packets ?
Message-Id: <8kjqhd$prj$1@orpheus.gellyfish.com>

On Wed, 12 Jul 2000 11:37:54 +0200 Ed Bras wrote:
> Which rights must a packets have to be able to be read/executed by another
> perl program ?
> 
> Do a perl program executes a packets or reads it when you include a packets
> with "use <packetname>
> 
> The problem I am having that at my local server, the rights must at least
> include "read" for other, as the apache server is executed as nobody.
> 
> Hoever as the isp where I put everyting online the rights must be at least
> execute for the group, as the apache server is in the same group. The
> strange thing that I don't understand is that at the isp the packets files
> don't need read rights for the group, such that the webserver is able to use
> it, instead as my local server needs this ??
> 

Who knows, your ISPs server might be running SuExec - however you probably
want to ask about this in some group that talks about the configuration
of web servers as it isnt really a Perl question at all seeing how it
would be the same if your CGI program was written in any other language.

/J\

-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: 12 Jul 2000 22:46:00 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: stupid perl question
Message-Id: <8kiouo$br8$1@orpheus.gellyfish.com>

On Tue, 11 Jul 2000 17:04:22 +0100 Cal Henderson wrote:
> "EPROM" <eprom007@hotmail.com> wrote...
>> ok...
>>
>> this should be simple:
>>
>> what is the equivelent of the shell command `ls` in Perl?
>>
>> I've tried opendir( )
>>
>> such as:
>>
>> % ls
>> total 23
>> drwx--x--x     9 eprom  guest     512 Jul 11 11:54 .
>> drwxr-xr-x  7406 root   wheel  121344 Jul  6 22:29 ..
>> drwxr-xr-x     2 eprom  guest     512 Jul 11 11:55 .cfdir
>> -rw-------     1 eprom  guest     300 Jul  7 13:56 .cshrc
>> drwx------     2 eprom  guest     512 Mar 15  1999 .elm
>> -rwxr-xr-x     1 eprom  guest      44 Jul 10 13:15 .forward
>> %
>>
>>
>> oh..and no I haven't read the man pages...but I did get the
>> book "learning perl" (the llama book) and its clear as mud.
>>
>> Thanks,
> 
> read up on opendir, readdir and closedir
> 

And stat and localtime and getpwuid .... ;-}

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: Thu, 13 Jul 2000 06:27:20 GMT
From: "Ecco" <ecco64@chello.nl>
Subject: Whelp
Message-Id: <cjdb5.367369$k22.1586732@flipper>

K, I know it's a JAVA trick, and I know it's also possible to use HTML and
JAVA in Perl, but HOW??? Does anyone have any concrete examples of the
JAVA-script to pop-up a new browser-windows? I suck at Java even more than I
do at Perl right now... And how exactly do you use it in a Perl-script??? As
you probably noticed when I said "Newbie" I sure as hell mean "Newbie"...




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

Date: Thu, 13 Jul 2000 13:09:16 +0900
From: Yongsik Kim <yosikim@lgeds.lg.co.kr>
Subject: Re: write to database
Message-Id: <396D40EC.D130A293@lgeds.lg.co.kr>

Have you ever see the following?

http://www.symbolstone.org/technology/perl/DBI/index.html


pooh23@my-deja.com wrote:
> 
> Hello,
> Does anyone know of tutorials on how to write to database from perl?
> 
> Thanks.
> 
> Sent via Deja.com http://www.deja.com/
> Before you buy.


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

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


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