[17557] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4977 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 28 09:05:27 2000

Date: Tue, 28 Nov 2000 06:05:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <975420309-v9-i4977@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 28 Nov 2000     Volume: 9 Number: 4977

Today's topics:
        (no subject) <jingzx@sinaman.com>
        ActivePerl 620 problem with installation, grep or Unico <jbo@dator.dk>
    Re: Authorising net access? nobull@mail.com
        checking variable type (B Gannon)
    Re: checking variable type (B Gannon)
    Re: checking variable type (Bernard El-Hagin)
    Re: checking variable type (B Gannon)
    Re: checking variable type nobull@mail.com
    Re: foreach output manipulation help (Bernard El-Hagin)
        Getting Client Address with HTTP::Daemon (Wyzelli)
        Help needed on win32::tieregistry. <Mikew@here.and.now>
    Re: Help Needed: SORT function <bart.lateur@skynet.be>
        how to determine the image size by perl? <jingzx@sinaman.com>
    Re: how to determine the image size by perl? (brian d foy)
    Re: how to determine the image size by perl? <bart.lateur@skynet.be>
    Re: how to determine to url of an image in a html file (brian d foy)
    Re: How to find what is between n'th and the next tab? <kumpu@mit.tut.fi>
    Re: How to find what is between n'th and the next tab? <bart.lateur@skynet.be>
    Re: how to recieve the search result from google.com? (brian d foy)
        How to rsh from cgi? bdesany@my-deja.com
        making varialbles private to a module <marc.nospam.logghe@devgen.com>
    Re: Perl + MySQL Tutorial Homepage <bart.lateur@skynet.be>
        Perl and IIS <luis.guillot@servicom2000.com>
    Re: Posting Guidelines? <bart.lateur@skynet.be>
    Re: Reading a csv file <bart.lateur@skynet.be>
    Re: Spell Checker?? <b_nospam_ill.kemp@wire2.com>
    Re: system() and backticks working intermittently on Tr (Anno Siegel)
    Re: Wrong code snippet in "ActivePerl 620 problem with  <jbo@dator.dk>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 28 Nov 2000 04:56:43 +0800
From: jin zengxiang <jingzx@sinaman.com>
Subject: (no subject)
Message-Id: <3A22CA8B.18D0C39A@sinaman.com>

Hi,there:
I want to develop a personal image search engineering that can "borrow"
the images I want to my local disk ,but I
found that many images are not really useful because the size of them is
too small ,so does any one know how to
determine the image size by perl modules? thanks very much.

Rgds ,
Alan Jin Z.X.



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

Date: Tue, 28 Nov 2000 09:19:32 +0100
From: "Jesper Bork" <jbo@dator.dk>
Subject: ActivePerl 620 problem with installation, grep or Unicode ?!
Message-Id: <3a236aa8$0$22627$73beb97d@news.dk.uu.net>

I'm trying to run a large Perl application on ActivePerl 620 instead of 521
and have a weird problem with statements involving grep making Perl exit
with an error. All statements like the following produces the problem:

if (grep(@INC, $find) == 0) {
    ...
}

The error message is:

Can't find unicode character property definition via main->a or a.pl in
unicode/Is/a.pl line 0.

Running the same code snippet in a script by itself does not produce the
problem which is why I haven't reported the bug to ActiveState. Any ideas
what I might be looking for ?

Any help is greatly appreciated before I transform all my grep statements
into other solutions,
best regards,
Jesper





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

Date: 28 Nov 2000 08:49:33 +0000
From: nobull@mail.com
Subject: Re: Authorising net access?
Message-Id: <u9pujgpgwg.fsf@wcl-l.bham.ac.uk>

philhibbs@my-deja.com writes:

> I believe that I need LWP:UserAgent and that it will allow authenticated
> communication but I cannot find how to use this.  The perldoc pages are
> not very readable.

Can you go into more detail on the difficulty you have reading the
LWP::UserAgent perldoc?  Simply saying "are not very readable" doesn't
help anyone improve them.

       $ua->credentials($netloc, $realm, $uname, $pass)
           Set the user name and password to be used for a realm.

OK I'm guessing. Is this the bit that you are having difficulty with?

The semantics of $realm, $uname, $pass are fairly obvious if you know
about HTTP authentication.  (If you don't know about HTTP
authentication then read about it in documents about HTTP - it is not
the job of the LWP documents to explain HTTP.)

The major flaw here is that it does not explain that $netloc is of
the form "host:port", i.e. for http://www.foo.com/bar it is
"www.foo.com:80".

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


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

Date: 28 Nov 2000 10:18:36 GMT
From: admin@kopnews.co.uk (B Gannon)
Subject: checking variable type
Message-Id: <9000ps$4l2$1@news.liv.ac.uk>

Hello how can a check to see what type a variable is 

ie:-

$var=1;

if ($var is a number) 

{
 print "$var is a number";
}




-----------------------------------
B Gannon
http://www.kopnews.com
http://www.kopnews.co.uk
Home of the LFC Prediciton League
-----------------------------------



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

Date: 28 Nov 2000 10:53:38 GMT
From: admin@kopnews.co.uk (B Gannon)
Subject: Re: checking variable type
Message-Id: <9002ri$4l2$2@news.liv.ac.uk>

It okay I have got it

$var=1;

if ($var =~ /^[+-]?\d+$/)
{
print $var is a number;

}


-----------------------------------
B Gannon
http://www.kopnews.com
http://www.kopnews.co.uk
Home of the LFC Prediciton League
-----------------------------------



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

Date: Tue, 28 Nov 2000 11:10:13 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: checking variable type
Message-Id: <slrn9274dj.cag.bernard.el-hagin@gdndev25.lido-tech>

On 28 Nov 2000 10:53:38 GMT, B Gannon <admin@kopnews.co.uk> wrote:
>It okay I have got it
>
>$var=1;
>
>if ($var =~ /^[+-]?\d+$/)
>{
>print $var is a number;
>
>}

And what if $var = 1.5? Read the FAQ.

Cheers,
Bernard
--
perl -le '$#="Just Another Perl Hacker"; print \Bernard'


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

Date: 28 Nov 2000 12:57:14 GMT
From: admin@kopnews.co.uk (B Gannon)
Subject: Re: checking variable type
Message-Id: <900a3a$8bf$1@news.liv.ac.uk>


The regular expression would need to be ammended. However in this case the 
number can only be a whole number, so I dont have to worry about decimal 
places.


-----------------------------------
B Gannon
http://www.kopnews.com
http://www.kopnews.co.uk
Home of the LFC Prediciton League
-----------------------------------



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

Date: 28 Nov 2000 13:00:18 +0000
From: nobull@mail.com
Subject: Re: checking variable type
Message-Id: <u9n1ekp7z1.fsf@wcl-l.bham.ac.uk>

bernard.el-hagin@lido-tech.net (Bernard El-Hagin) writes:

> On 28 Nov 2000 10:53:38 GMT, B Gannon <admin@kopnews.co.uk> wrote:
> >It okay I have got it
> >
> >$var=1;
> >
> >if ($var =~ /^[+-]?\d+$/)
> >{
> >print $var is a number;
> >
> >}
> 
> And what if $var = 1.5? Read the FAQ.

And, of course, this is one of the well known instances where the FAQ
is wrong (or at least the answer it gives doesn't match the question).

$var = 1.5; # $var is a number
$var = "1.5"; # $var is a string (that looks like a number)

if ( ~$var ne ~"$var") {
  print '$var is a number';
} 

Of course the big question is: why do you think you want to check the
type of a variable?  99% of the time when people think they want to
check variable type in Perl they are wrong.

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


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

Date: Tue, 28 Nov 2000 10:30:44 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: foreach output manipulation help
Message-Id: <slrn92723m.cag.bernard.el-hagin@gdndev25.lido-tech>

On 28 Nov 2000 05:22:28 GMT, Stephen Braswell <sbraswe1@email.unc.edu>
wrote:
>Hello,
>
>I have a script that performs an LDAP search and prints out the results
>using a foreach statement.  I want to manipulate the data that is
>displayed by "$entry->dump" (see below) using Unix grep, cut, and sort
>before it gets displayed to the screen.  I know how to do this on the
>command-line (i.e. script.pl | grep blah | cut -f2 -d: | sort) but I want
>to do all of that within the perl script.

[snip]

>$ldap = new Net::LDAP('ldap.foobar.com');
>
>$ldap->bind;
>
>$mesg = $ldap->search (
>                        base   => "o=MyCorp,c=US",
>                        filter => "(ou=*)"
>
>                       ) or die ("Failed on search.$!");
>
>foreach $entry ($mesg->entries) { $entry->dump; }
>
>$ldap->unbind;

You can do all of this in Perl which would make your code more portable:

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

my $entry_dump = <<EOF;
aaa:ccc1:bbb:blah
zzz:aaa2:xxx:blah
mmm:ddd3:aaa:no bla[h]
aaa:bbb4:ddd:blah
EOF

print join "\n", 
sort map {(split/:/)[1]} grep /blah/, split/\n/, $entry_dump;
------------------

Result:
aaa2
bbb4
ccc1

The grep part of your command is done with the, you guessed it, grep.
The format of the grep function is:

grep EXPRESSION, LIST

The result of grep is a list of elements from LIST which evaluated to
TRUE in the EXPRESSION. The input list to grep came from:

split /\n/, $entry_dump;

which just split $entry_dump into lines.

Next, we take each element which passed the grep and pass it into map
which has the format:

map EXPR, LIST

The map function is just a fancy way of going through each element of
LIST and doing EXPR on it. The result is a LIST of thus transformed
elements which, in turn, we pass on to sort. This is an ASCII sort, by
default, so if you want a different sort look in the FAQ:

perldoc -q sort

Cheers,
Bernard
--
perl -le '$#="Just Another Perl Hacker"; print \Bernard'


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

Date: Tue, 28 Nov 2000 08:40:58 GMT
From: wyzelli@yahoo.com (Wyzelli)
Subject: Getting Client Address with HTTP::Daemon
Message-Id: <Xns8FFABEE65wyzelliyahoocom@203.39.3.131>


The following is a snippet of code slightly modified from the anonymous proxy 
written by Randal Schwartz 
http://web.stonehenge.com/merlyn/WebTechniques/col11.html

I have used this as a starting example for a small project and am trying to 
acquire the address of the client to be logged (or directed elsewhere).

According the the HTTP:Daemon docs, the accept method is the same as 
IO::Socket, which reports that in scalar context it returns the socket, but in 
array context it returns a two element array containing the new socket and the 
peer address.

However, when using the code below, I am getting the 'uninitialised value' 
which tells me that $host is not getting set.

Any ideas what I need to do to get the client address (IP or Hostname)?

## Code snippet
$HOST and $PORT set earlier.

{                               ### MAIN ###
  use HTTP::Daemon;

  my $master = new HTTP::Daemon
    LocalAddr => $HOST, LocalPort => $PORT;
  my ($slave,$host);
  while (($slave,$host) = $master->accept){
  	print $host; # uninitialised
	&handle_connection($slave); # processes requests fine
  }
  exit 0;
} 

Otherwise, it all seems to be working quite well.

Thanks for any pointers.

Wyzelli

-- 
#beer v2
($a,$b,$w,$t)=(' bottle',' of beer',' on the wall','Take one down, pass it 
around');
for(reverse(1..100)){$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n$_$a$s$b\n$t\n";
$_--;$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n\n";}print"$c*hic*";


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

Date: Tue, 28 Nov 2000 08:01:24 +0000
From: MikeW <Mikew@here.and.now>
Subject: Help needed on win32::tieregistry.
Message-Id: <3A236654.5387E813@here.and.now>

Hi.
Im trying to write a perl script that will change the cdrom drive
letter on a windows 2000 system. Im using win32::tieregistry.

The problem I am having is that, although i can change the DATA in the
registry string..(HTLM\System\mounted\devices\\dosdevices\d: )
denoting current drive letter for cdrom is the D: drive), I cannot
work out how to rename the D: in the name to R: (for eg if I want the
drive letter to be r:).
I also have to change the delimiter because the '\dosdevices\D:' bit
is just one single name, so..in my script I use '/' as a registry
delimiter, and then reference the string as
'HKLM/system/MountedDevices/\DosDevices\D: (why DID miscrosoft use the
'\' as a part of the key name anyway???)
Its easy enough manually..you just right click on the key name, select
'rename' and change the d: to an r:..and it works.
But using perl I am getting nowhere.
anyone any ideas?..or could point me to a suitable win32:tieregistry
primer?.(I find the help files that come with perl not very
helpfull!.)
many thanks
Mike Warren.




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

Date: Tue, 28 Nov 2000 11:05:46 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Help Needed: SORT function
Message-Id: <f9472tktabkb316o95mld8d6jsoj7d8hcm@4ax.com>

Genesis Montano wrote:

>However, my problem is I want to sort in aphabetical order.

You can either do

	@sorted = sort { lc $a cmp lc $b } @unsorted;

but maybe this works for you too.

	{
	    use locale;
	    @sorted = sort @unsorted;
	}

On some (?) systems, this sorts case insensitive (and it places accented
letters close to their unaccented counterparts).

-- 
	Bart.


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

Date: Tue, 28 Nov 2000 04:57:18 +0800
From: jin zengxiang <jingzx@sinaman.com>
Subject: how to determine the image size by perl?
Message-Id: <3A22CAAE.DA17CC86@sinaman.com>

Hi,there:
I want to develop a personal image search engineering that can "borrow"
the images I want to my local disk ,but I
found that many images are not really useful because the size of them is
too small ,so does any one know how to
determine the image size by perl modules? thanks very much.

Rgds ,
Alan Jin Z.X.



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

Date: Tue, 28 Nov 2000 06:54:37 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: how to determine the image size by perl?
Message-Id: <brian-ya02408000R2811000654370001@news.panix.com>

In article <3A22CAAE.DA17CC86@sinaman.com>, jin zengxiang <jingzx@sinaman.com> posted:

> I want to develop a personal image search engineering that can "borrow"
> the images I want to my local disk ,but I
> found that many images are not really useful because the size of them is
> too small ,so does any one know how to
> determine the image size by perl modules?

i think the Image::Size module does that, despite its odd name.

   http://search.cpan.org

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>


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

Date: Tue, 28 Nov 2000 14:04:34 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: how to determine the image size by perl?
Message-Id: <1re72t4qpvab1lvfr8mg4ngeravk53c0d7@4ax.com>

jin zengxiang wrote:

>so does any one know how to
>determine the image size by perl modules?

The module Image::Size can do that. You will have to "download" the
images to your local system, before you can use it.

-- 
	Bart.


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

Date: Tue, 28 Nov 2000 06:58:10 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: how to determine to url of an image in a html file
Message-Id: <brian-ya02408000R2811000658100001@news.panix.com>

In article <3A21B67F.8EE77A4B@sinaman.com>, jin zengxiang <jingzx@sinaman.com> posted:

> I want to get image's url in an html ,normal in html ,we have
> <IMG src="some where is the web" ....................>

HTML::SimpleLinkExtor will do it with the fuss of HTML::Parser 
(which it sub-classes for you).

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>


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

Date: Tue, 28 Nov 2000 10:27:57 +0200
From: Pekka Kumpulainen <kumpu@mit.tut.fi>
Subject: Re: How to find what is between n'th and the next tab?
Message-Id: <3A236C8C.12E15B84@mit.tut.fi>

Pekka Kumpulainen wrote:

Thans a lot for all answers.
The regex-things seemed to be the fastest here. I have no idea how they
work, but I will try to figure it out. At last some motivation to spend time
learning regex.
Here are some results from a small testfile and column 160:
--
  $stuff = $1 if $_ =~ /([^\t]*(\t|$)){$colnum}/;
28 sec
--
 $stuff = (split /\t/, $_, $colnum+2)[$colnum];
34 sec
--
  $_ =~ s/([^\t]*\t){$n}//o;    # discard the first 42 columns
   my ($stuff) = split /\t/, $_; # discard all columns after 43
22 sec
--
  $_ =~ qr/(?:[^\t]*\t){$colnum}([^\t]*)(?:\t|$)/;
22 sec
--
  ($piece) = $data =~ /(?:\S*\s){$n}(\S+)/;
  ($piece) = $data =~ /(?:\S*\s){$n}(\S+)/o;
  ($piece) = $data =~ ( $regex_cache{$n} ||= qr/(?:\S*\s){$n}(\S+)/ );
all these 19 sec





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

Date: Tue, 28 Nov 2000 12:09:13 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: How to find what is between n'th and the next tab?
Message-Id: <l9672tk67qegtq6ojivth1jrecv9ajimv7@4ax.com>

Anno Siegel wrote:

>Another approach uses a regex: qr/(?:[^\t]*\t){$col}([^\t]*)(?:\t|$)/;
>deposits the $col'th column in $1.  This requires compilation of a
>regex for each column.

I think 'd try that with the /o option. And your regex can use some
clean-up. A: you don't want to match newlines. B: '(?:\t|$)' is
superfluous, because of greedy matching, '[^\t]*' will slurp in as much
as possible -- until the next tab, or the end of the string.

If you need more than one column, I might use a closure (custom sub).
From 5.6 on, /o works properly inside a closure.

	sub get_column {
	    my $col = shift;
	    return sub {
	        shift =~ /^(?:[^\t]*\t){$col}([^\t\n]*)/o;
	        $1;
	    };
	}

	my $sub = get_column(5);
	$_ = join "\t", 'A' .. 'Z';
	print $sub->($_);
-->
	F

In pre-5.6, you need an eval for the sub, so that every closure contains
it's own regex -- instead of a common one.

	sub get_column {
	    my $col = shift;
	    return eval 
	    'sub {
	        shift =~ /^(?:[^\t]*\t){$col}([^\t\n]*)/o;
	        $1;
	    }';
	}

I haven't benchmarked it.

-- 
	Bart.


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

Date: Tue, 28 Nov 2000 07:03:15 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: how to recieve the search result from google.com?
Message-Id: <brian-ya02408000R2811000703150001@news.panix.com>

In article <3A2130CE.693A8CD4@sinaman.com>, jin zengxiang <jingzx@sinaman.com> posted:


> open(OUTHTML,">result.html");
> print  OUTHTML $result;
> close(OUTHTML);
> ..................................
> by above codes ,I can print the html page ,but it seems that there is
> something wrong

check the return value of open.

   open OUT, "> result.html" or die "could not open: $!";

you should really try to help yourself before posting. :)

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>


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

Date: Tue, 28 Nov 2000 12:21:26 GMT
From: bdesany@my-deja.com
Subject: How to rsh from cgi?
Message-Id: <900802$j0c$1@nnrp1.deja.com>

I have a weak web server and a powerful "application" server. I would
like to process requests via CGI on the web server and then issue a
resulting command to the application server. Then the user would click
on a link that would show the contents of the file produced by the
command that the application server just ran.

The CGI script is running under httpd username (I don't know how to
change it, and don't know if I'd want to).

I have been trying to do this in the following way:

my $COMMAND = "rsh";
local *PIPE;
my $pid = open PIPE, "-|";
croak "Couldn't fork $!" unless defined $pid;
unless ($pid) {
  exec $COMMAND, "appserver", "-l", "my_own_username", "command" or
croak "Cannot open pipe to rsh!\n";
}
etc...

Now, this doesn't work (permission denied) if I put an entry in
my .rhosts file on the app server for the webserver and user httpd. And
I don't know the ramifications for this security-wise if I did get it
to work.

Does anyone have any ideas on how to accomplish what I am trying to do
here in a secure way, whether it is refinements of the way I've tried
or something completely different? Thanks,

-Brian.


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


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

Date: Tue, 28 Nov 2000 10:13:25 GMT
From: "Marc Logghe" <marc.nospam.logghe@devgen.com>
Subject: making varialbles private to a module
Message-Id: <9zLU5.40270$zF6.575548@afrodite.telenet-ops.be>

Hi,
I have a question concerning an example in the Perl Cookbook.
I tried the following example with Perl version 5.005_03 built for
i386-linux and v5.6.0 built for MSWin32-x86-multi-thread:
package Alpha;
my $aa = 10;
   $x = "azure";

package Beta;
my $bb = 20;
   $x = "blue";

package main;
print "$aa, $bb, $x, $Alpha::x, $Beta::x\n";


In the first case I got the answer given in the book:
10, 20, , azure, blue
In the latter I got, unexpectedly:
 , , , azure, blue
Does this mean you now have in v5.6.0 invisible block boundaries so that $aa
and $bb go out of scope?
Thanks,
Marc





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

Date: Tue, 28 Nov 2000 08:36:08 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Perl + MySQL Tutorial Homepage
Message-Id: <gjq62t4qvrgfke7p89012ng2nqmrrr3vpm@4ax.com>

Rudy Hermawan wrote:

>Pls help me find the Perl + MySQL Tutorial Homepage.

There's a pretty decent introductory tutorial for MySQL, with a Perl
angle at WebMonkey: 

<http://hotwired.lycos.com/webmonkey/backend/databases/tutorials/tutorial1.html>

-- 
	Bart.


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

Date: Tue, 28 Nov 2000 09:38:19 +0100
From: "Luis Guillot" <luis.guillot@servicom2000.com>
Subject: Perl and IIS
Message-Id: <8vvqf4$1hg$1@talia.mad.ttd.net>

I have a script in Perl for download a file with data that I have obtained
from a database, but when it ask me if  I'd like save or see it, when
dowload the file it is corrupted and empty, and the same if I try say it. My
server is IIS and it function fine because it ask me for save the file.
Why is it? Some idea?

Thanks.





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

Date: Tue, 28 Nov 2000 08:17:13 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Posting Guidelines?
Message-Id: <0cq62t0ir4gsu6nurh0rdskquvuf1u9hiv@4ax.com>

Tad McClellan wrote:

>We would need a volunteer that people would trust. That could
>be pretty hard to come by.

I would think of Tom Phoenix. In fact, Tom has an autopost, "how to find
the Perl FAQ". This post, or a new sibling, could contain guidelines
such as "post in plain text" and "don't post in jeopardy style".

-- 
	Bart.


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

Date: Tue, 28 Nov 2000 11:31:45 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Reading a csv file
Message-Id: <6r572tcm3ip7kr079lqifuncb1oq7mmutu@4ax.com>

David Wall wrote:

>He'd probably be better off using Text:CSV_XS to parse the CSV file, unless 
>he knows ahead of time that this code will work.

Oh yeah?

If Text::CSV_XS rejects your input, there's nothing you can do about it.
It happens.

At least, with your own parsing code in Perl, you can *make it work*.

(Only half joking)

-- 
	Bart.


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

Date: Tue, 28 Nov 2000 10:00:05 -0000
From: "W K" <b_nospam_ill.kemp@wire2.com>
Subject: Re: Spell Checker??
Message-Id: <975405618.10948.0.nnrp-14.c3ad6974@news.demon.co.uk>

>I have a request from one of my users for a SPELL CHECKER for info from
>a TEXTAREA from a FORM. I am using Perl on a WinNT 4.0 server and I was
>wondering if anyone has pulled this off before? If so, please include a
>link so I can 'Take a look' to see how it works.
>
>Thanks, I maybe dreaming on this one...


even if there was a perl module that did spell checks...
I bet the user expects that you can make it work like the spell checker on
WORD.
Remember that if it is on the server side in Perl each suggestion and
correction would need to go across the internet - would they wait 10 seconds
for suggestions? and 10 seconds to see the correction?
Another thing - you'd need to do a lot of work maintaining the session -
would the user expect to see the same page again with the corrected text in
the TEXTAREA.

I would suggest that even if there is a Perl answer to this it becomes
rather impractical when its over the internet.




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

Date: 28 Nov 2000 12:31:34 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: system() and backticks working intermittently on Tru64 UNIX
Message-Id: <9008j6$hfl$1@lublin.zrz.tu-berlin.de>

Steve Bourgeois <sb299@netzero.net> wrote in comp.lang.perl.misc:
>
>I have an application written in perl that makes various calls out to the
>OS with system() and backticks.
>
>The problem is that hosting out to the OS occasionally does nothing when
>it is executed.
>
>For example, something like $results = `ps -ef |grep zz` will return a NULL
>string
>and STDERR is not set.

There is nothing unusual about this.  If grep doesn't match anything,
it will print nothing, not even to STDERR.

                         If I add this code to a loop with retry logic, it
>will eventually
>execute successfully after a few retries.

This behavior is typical for the Unix ps command, which shows a
snapshot of the process table:  Sometimes it will show processes
that are started along with itself (like "grep zz" in the pipeline
above), and sometimes it won't.  There's no guarantee either way.

>I have been seeing this problem with Digital/Tru64 UNIX versions 3.2 - > 5.1
>and
>perl versions 5.004 -> 5.6.  It also occurs more frequently as the hardware
>that
>we're running on has increased in horsepower...  

Sure, this behavior is dependent on many factors.  You'll see it more
with one machine and less with another, but it also depends on system
load.

                                                  Strangely enough, this code
>also
>runs on Windows NT and we have never seen this issue on that platform.

That's a completely different kind of task scheduler.  I guess it doesn't
have the problem (if it is a problem) of the typical Unix schedulers.

In summary, the effects you are seeing depend on the underlying OS, not
Perl.

Anno


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

Date: Tue, 28 Nov 2000 09:32:22 +0100
From: "Jesper Bork" <jbo@dator.dk>
Subject: Re: Wrong code snippet in "ActivePerl 620 problem with installation, grep or Unicode ?!"
Message-Id: <3a2372b0$0$22627$73beb97d@news.dk.uu.net>

Wrong code snippet, sorry. The correct snipped producing the error is of
course:

if (grep(/$find/i, @INC) == 0) {
    ...
}

Jesper

"Jesper Bork" <jbo@dator.dk> wrote in message
news:3a236aa8$0$22627$73beb97d@news.dk.uu.net...
> I'm trying to run a large Perl application on ActivePerl 620 instead of
521
> and have a weird problem with statements involving grep making Perl exit
> with an error. All statements like the following produces the problem:
>
> if (grep(@INC, $find) == 0) {
>     ...
> }
>
> The error message is:
>
> Can't find unicode character property definition via main->a or a.pl in
> unicode/Is/a.pl line 0.
>
> Running the same code snippet in a script by itself does not produce the
> problem which is why I haven't reported the bug to ActiveState. Any ideas
> what I might be looking for ?
>
> Any help is greatly appreciated before I transform all my grep statements
> into other solutions,
> best regards,
> Jesper
>
>
>




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

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


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