[25594] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7838 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Feb 28 06:05:56 2005

Date: Mon, 28 Feb 2005 03:05:23 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 28 Feb 2005     Volume: 10 Number: 7838

Today's topics:
    Re: How to convert latin1 to utf8 <vek@station02.ohout.pharmapartners.nl>
    Re: maximum size of a hash table <postmaster@castleamber.com>
    Re: maximum size of a hash table <spamtrap@dot-app.org>
    Re: maximum size of a hash table <postmaster@castleamber.com>
    Re: maximum size of a hash table <spamtrap@dot-app.org>
    Re: maximum size of a hash table (Anno Siegel)
        mysql list all db name <alexj@floor.ch>
    Re: mysql list all db name <spamtrap@dot-app.org>
    Re: mysql list all db name <mkorte@gmx.de>
    Re: mysql list all db name <alexj@floor.ch>
    Re: Perl script timeout problem (sipitai)
    Re: Perl script timeout problem (sipitai)
    Re: Perl script timeout problem (sipitai)
    Re: Perl script timeout problem <nobull@mail.com>
    Re: Perl script timeout problem <nobull@mail.com>
    Re: Pure Perl OpenSSL Library <marc.dkm@kataplop.net>
    Re: sequences of numbers <ihatespam@hotmail.com>
    Re: sequences of numbers <nobull@mail.com>
    Re: sequences of numbers <ihatespam@hotmail.com>
    Re: sequences of numbers <do-not-use@invalid.net>
    Re: The meaning of @ <postmaster@castleamber.com>
    Re: The meaning of @ <bigiain@mightymedia.com.au>
    Re: The meaning of @ <newspost@kohombanDELETE.net>
    Re: The meaning of @ <lesliev@NOSPAMicoc.co.za>
        thread trouble <alexj@floor.ch>
    Re: thread trouble <phaylon@dunkelheit.at>
    Re: thread trouble <alexj@floor.ch>
    Re: thread trouble <alexj@floor.ch>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 28 Feb 2005 08:17:34 GMT
From: Villy Kruse <vek@station02.ohout.pharmapartners.nl>
Subject: Re: How to convert latin1 to utf8
Message-Id: <slrnd25ksu.oh.vek@station02.ohout.pharmapartners.nl>

On 25 Feb 2005 07:53:47 -0800,
    francescomoi@europe.com <francescomoi@europe.com> wrote:


> Hi.
>
> I've got some texts in Latin1 and like to convert to UTF-8.
>
> Is this possible with 'Unicode::String'???
>

In combination with Unicode::Map it works on version 5.005

use Unicode::Map();
use Unicode::String qw(utf8 utf16);
my $CHARSET = 'ISO-8859-1';
my $Map = new Unicode::Map($CHARSET);
sub latin_to_utf8 { utf16($Map->to16($_[0]))->utf8; }
sub utf8_to_latin { $Map->to8(utf8($_[0])->utf16); }


Villy


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

Date: 28 Feb 2005 04:24:47 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: maximum size of a hash table
Message-Id: <Xns960AE3FFA64Ccastleamber@130.133.1.4>

Anno Siegel wrote:

> John Bokma  <postmaster@castleamber.com> wrote in comp.lang.perl.misc:
>> Anno Siegel wrote:
>> 
>> > John Bokma  <postmaster@castleamber.com> wrote in
>> > comp.lang.perl.misc: 
>> >> Anno Siegel wrote:
>> >> 
>> >> > John Bokma  <postmaster@castleamber.com> wrote in
>> >> > comp.lang.perl.misc: 
> 
> [hashes]
> 
>> >> I am happy with constant avg length of c, and hence O(1) look up.
>> > 
>> > Fine.  My point is that there are useful applications of hash
>> > tables also in the O(n) range.
>> 
>> Uhm, like? (Ok, memory stress testing is one).
> 
> It's a simple space/time tradeoff.  You only get constant access time
> when collisions are rare, so the number of buckets must be larger than
> the number of keys.

All depends on the hash function of course, but if the size is big (n)
and the number of collisions is small (constant), you still have O(1)
access. 

> Say you expect a million keys and linear search
> is too slow by a factor of 100.  Use a hash with 100 buckets (some
> more to compensate overhead).

It all depends on what you want. If linear search is slow, and you need
a lot of access it might be way smarter to sort ( O(n log n) ) and use
binary search for the look ups ( O( log n ) ). 

With 100 buckets you get 100 lists of 10,000 items each. So it takes
average 5,000 steps to find something. 

Compare that with binary search :-D.

> That gives you the necessary speedup with
> almost no memory overhead, as opposed to a hash of more than a million
> buckets for constant access time.  That's a useful hash application
> well in the linear range.

See above.

-- 
John                   Small Perl scripts: http://johnbokma.com/perl/
               Perl programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html
                        


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

Date: Mon, 28 Feb 2005 00:56:46 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: maximum size of a hash table
Message-Id: <8pqdnbAh3uA9L7_fRVn-rg@adelphia.com>

John Bokma wrote:

> The poor result I was talking about was when the 32 bit limit on the hash
> code results in O(n) hash look ups because there is a lot of data in the
> hash. :-D.

That's not the result of having a lot of *data* - it's the result of having
a lot of *collisions*. It can be avoided by choosing a hashing function
that results in fewer collisions.

BTW - *what* 32-bit limit? Perl uses native ints for hash codes, so on any
system where sizeof(void*)<=sizeof(int), there can be at least as many
buckets as there are bytes of memory. Each bucket uses more than one byte
of memory, so that's a theoretical limit that can't be reached in practice.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: 28 Feb 2005 06:36:39 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: maximum size of a hash table
Message-Id: <Xns960B6372EF00castleamber@130.133.1.4>

Sherm Pendley wrote:

> John Bokma wrote:
> 
>> The poor result I was talking about was when the 32 bit limit on the
>> hash code results in O(n) hash look ups because there is a lot of
>> data in the hash. :-D.
> 
> That's not the result of having a lot of *data* - it's the result of
> having a lot of *collisions*.

Caused by a lot of data.

> It can be avoided by choosing a hashing
> function that results in fewer collisions.

Again I was talking of a 32 bit limit. You can probably do the math about 
how much data I am talking.

> BTW - *what* 32-bit limit? Perl uses native ints for hash codes, so on
> any system where sizeof(void*)<=sizeof(int), there can be at least as
> many buckets as there are bytes of memory. Each bucket uses more than
> one byte of memory, so that's a theoretical limit that can't be
> reached in practice. 

Yeah, that has been answered a few days back. Maybe read the whole thread 
before you start some very creative snipping and replying.

-- 
John                   Small Perl scripts: http://johnbokma.com/perl/
               Perl programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html
                        


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

Date: Mon, 28 Feb 2005 03:28:51 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: maximum size of a hash table
Message-Id: <p66dnY1rEujYS7_fRVn-pg@adelphia.com>

John Bokma wrote:

> Sherm Pendley wrote:
> 
>> That's not the result of having a lot of *data* - it's the result of
>> having a lot of *collisions*.
> 
> Caused by a lot of data.

Is too... Is not... Is too... Is not! :-)

As I (mis?)understand it, the size of a list - *in and of itself* - does not
cause collisions. Perl's hash codes are native ints. The exact width varies
with architecture, but it's always wide enough to assign a unique code to
each and every byte of memory.

Therefore my assertion, that if you have duplicates it's not the result of
having more data elements than possible buckets. That, by definition,
cannot happen with any list that will fit in RAM. So if you have duplicates
it must therefore be the result of a hashing function that's failing to
generate as many unique codes as it should, for the given data.

> Yeah, that has been answered a few days back. Maybe read the whole thread
> before you start some very creative snipping and replying.

I don't have an education in formal CS theory, and I'm well aware that there
could be flaws in my logic. If so, enlighten me and I'll thank you for it.
But please do stick to logic - the attitude's uncalled-for.

You posted, I replied, you replied back, I replied again. Each time I quoted
the relevant bits of the message I was replying to. Nothing "creative"
about that, at least not in the derogatory sense you're implying. And the
answer from a few days back was mine, where I pointed out the definition of
U32 in handy.h, and the comment there that says it's not fixed at 32 bits.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: 28 Feb 2005 10:51:33 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: maximum size of a hash table
Message-Id: <cvut3l$kri$1@mamenchi.zrz.TU-Berlin.DE>

John Bokma  <postmaster@castleamber.com> wrote in comp.lang.perl.misc:
> Anno Siegel wrote:
> 
> > John Bokma  <postmaster@castleamber.com> wrote in comp.lang.perl.misc:
> >> Anno Siegel wrote:
> >> 
> >> > John Bokma  <postmaster@castleamber.com> wrote in
> >> > comp.lang.perl.misc: 
> >> >> Anno Siegel wrote:
> >> >> 
> >> >> > John Bokma  <postmaster@castleamber.com> wrote in
> >> >> > comp.lang.perl.misc: 
> > 
> > [hashes]
> > 
> >> >> I am happy with constant avg length of c, and hence O(1) look up.
> >> > 
> >> > Fine.  My point is that there are useful applications of hash
> >> > tables also in the O(n) range.
> >> 
> >> Uhm, like? (Ok, memory stress testing is one).
> > 
> > It's a simple space/time tradeoff.  You only get constant access time
> > when collisions are rare, so the number of buckets must be larger than
> > the number of keys.
> 
> All depends on the hash function of course, but if the size is big (n)
> and the number of collisions is small (constant), you still have O(1)
> access. 

Collisions *can't* be rare when the number of keys exceeds the number
of buckets, no matter what the hash function.

> > Say you expect a million keys and linear search
> > is too slow by a factor of 100.  Use a hash with 100 buckets (some
> > more to compensate overhead).
> 
> It all depends on what you want. If linear search is slow, and you need
> a lot of access it might be way smarter to sort ( O(n log n) ) and use
> binary search for the look ups ( O( log n ) ). 
>
> With 100 buckets you get 100 lists of 10,000 items each. So it takes
> average 5,000 steps to find something. 
> 
> Compare that with binary search :-D.

You must keep the list sorted.  When insertions and/or deletions are
frequent, you lose the advantage.

What's the point?  I'm not saying that hashes with large load factors
are a super trick that solves everything.  They can be, and have been
used that way.  You asked for an example.

Anno


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

Date: Mon, 28 Feb 2005 10:23:33 +0100
From: Alexandre Jaquet <alexj@floor.ch>
Subject: mysql list all db name
Message-Id: <cvunug$ue$1@news.hispeed.ch>

Hi could anyone let me know how to list all database name of a mysql server

thx in advance


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

Date: Mon, 28 Feb 2005 04:35:12 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: mysql list all db name
Message-Id: <8t-dnSnd2oZPeL_fRVn-jA@adelphia.com>

Alexandre Jaquet wrote:

> Hi could anyone let me know how to list all database name of a mysql
> server

Have a look at the DBI module on CPAN.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Mon, 28 Feb 2005 11:30:46 +0100
From: "Michael Korte" <mkorte@gmx.de>
Subject: Re: mysql list all db name
Message-Id: <cvursn$34p$1@pentheus.materna.de>


> Alexandre Jaquet wrote:

> > Hi could anyone let me know how to list all database name of a mysql
> > server

#connect your dbh, then :
$dbh->prepare("show databases");
$dbh->execute();
# then you can fetch your result.

HTH
Michael




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

Date: Mon, 28 Feb 2005 11:48:42 +0100
From: Alexandre Jaquet <alexj@floor.ch>
Subject: Re: mysql list all db name
Message-Id: <cvusu4$581$2@news.hispeed.ch>

Michael Korte a écrit :
>>Alexandre Jaquet wrote:
> 
> 
>>>Hi could anyone let me know how to list all database name of a mysql
>>>server
> 
> 
> #connect your dbh, then :
> $dbh->prepare("show databases");
> $dbh->execute();
> # then you can fetch your result.
> 
> HTH
> Michael
> 
> 
thx =)


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

Date: 27 Feb 2005 21:06:40 -0800
From: sipitai@hotmail.com (sipitai)
Subject: Re: Perl script timeout problem
Message-Id: <76360ac4.0502272106.53f0edb5@posting.google.com>

"Jürgen Exner" wrote...

> Are you using alarm() in you program?
> If not then it's the environment that is triggering the timeout.

Im not using alarm() anywhere in the script.

And do I realise its the environment that's actually triggering the
time out, rather than the script. Although what I was trying to ask in
my original statement was, is it more likely that there is a problem
with the environment that requires some sort of fix, or is it more
likely that there is a problem with the script that requires some sort
of fix (For example, I figure that perhaps the script might need to be
updated to somehow let the server know that it is transferring data,
or that it is still running, etc. to prevent the time out from
occurring) ?


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

Date: 27 Feb 2005 21:17:04 -0800
From: sipitai@hotmail.com (sipitai)
Subject: Re: Perl script timeout problem
Message-Id: <76360ac4.0502272117.470ae05@posting.google.com>

"Jürgen Exner" wrote...

> Do you have a Perl question, too?
> Otherwise I would suggest you head over to the CGI NGs because your question 
> has _very_little_ to do with Perl but a _whole_lot_ with CGI and web 
> authoring.

Yes, check out my original post. I just added this description for
those people who wanted to do a bit of lateral thinking and suggest
some alternative methods of implementing a solution.


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

Date: 27 Feb 2005 21:22:50 -0800
From: sipitai@hotmail.com (sipitai)
Subject: Re: Perl script timeout problem
Message-Id: <76360ac4.0502272122.739a16e6@posting.google.com>

Brian McCauley wrote...

> You put the file in a directory that where it would be directly 
> accessible by a URL but don't tell anyone the directory.
> 
> Your CGI script then sends a CGI  response to the web server that tells 
> it to  genereate an HTTP response as if it had gotten a simple GET 
> request for the file.
> 
> You may even be able to configure your web server so that requests to 
> the secret directory that do not come via an internal redirect are 
> declined. This way wouldn't need to keep it secret.
> 
> (Nore of this, of course, has the slightest thing to do with Perl).
> 
> One way for a Perl script to send an internal redirect CGI response 
> would be:
> 
> print "Location: /some/non/published/path/$file\n\n";
> 
> Note that an internal redirect does have the 
> 'http://someserver.example.com/' prefix but starts at the '/' that is 
> the root of the current (virtual) server.
> 
> You could possibly use the redirect() method from CGI.pm rather than a 
> raw print() but this also generates a "Status:" header and I suspect 
> this may confuse some web servers into generating an external redirect.
> 
> You need to ensure that you web server software is configured not to 
> include 'helpful' Content-location headers that contain the true URL of 
> HTTP entities that resolve via internal redirects.

That is a fairly good idea, although it requires the files to be
located directly on the hard disk, where as in this case the files are
are stored in a blob field in a MySQL database.

So as far as I know im still going to require a script to allow the
user to download the files, unless I start writing temporary files to
the hard disk, which is something I would like to avoid doing. But its
possible I might have missed something here.

Perhaps another way of looking at this problem would be to ask, what
is the most reliable way of allowing a user to download a file stored
in a blob field in a MySQL database, without having to write a
temporary file to the hard disk?


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

Date: Mon, 28 Feb 2005 08:41:13 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Perl script timeout problem
Message-Id: <cvul56$rfv$1@sun3.bham.ac.uk>



sipitai wrote:

> Perhaps another way of looking at this problem would be to ask, what
> is the most reliable way of allowing a user to download a file stored
> in a blob field in a MySQL database, without having to write a
> temporary file to the hard disk?

When serving up entities of non-trivial size there are all sorts of 
considerations about entitity tags and partial responses if you want to 
do it properly.  None of this relates to Perl and is oft discussed in 
newsgroups where it is on-topic.



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

Date: Mon, 28 Feb 2005 08:52:15 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Perl script timeout problem
Message-Id: <cvulpq$ror$1@sun3.bham.ac.uk>



sipitai wrote:

> Perhaps another way of looking at this problem would be to ask, what
> is the most reliable way of allowing a user to download a file stored
> in a blob field in a MySQL database, without having to write a
> temporary file to the hard disk?

Are you slurping the whole BLOB into a Perl variable?  Perhaps you are 
having problems with your CGI process going swap-bound.  Try reading it 
in chunks.  (How you'd do this is SQL-dialect specific).



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

Date: Mon, 28 Feb 2005 09:13:46 +0100
From: "Marc" <marc.dkm@kataplop.net>
Subject: Re: Pure Perl OpenSSL Library
Message-Id: <4222d2ab@epflnews.epfl.ch>

Big and Blue <No_4@dsl.pipex.com> writes:

> Marc wrote:
>>>
>> My system will receive burst of thousand and more request within short
>> period (seconds/minutes), so I want to avoid forks as much as possible.
>
>     Requests for what?  I presume you aren't going to be
> creating/issuing thousands of certificates within minutes.

Yes, I will.

>     If you are trying to validate an "incoming" SSL cerrtificate in
> Apache you should use mod_ssl.  But what are you actually trying to do?

Already using that ;)

I'm writing a system that will be able to identify node's clusters, so I
will have lots and lots certificate requests at startup, then only https
requests, handled by mod_ssl.

Marc


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

Date: Mon, 28 Feb 2005 00:40:29 -0500
From: Big Daddy <ihatespam@hotmail.com>
Subject: Re: sequences of numbers
Message-Id: <cvumoe$7pn$1@news.chatlink.com>

Thank you for your help.  I found this works provided that all my numbers 
are positive numbers. (I know, I didn't portray that in my original data). 
Can this be easily modified to work for negative numbers as well?














Abigail wrote:

> Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMMMCXCVII
> September MCMXCIII in <URL:news:cvpmjb$g04$1@mamenchi.zrz.TU-Berlin.DE>:
> ::  Big Daddy  <ihatespam@hotmail.com> wrote in comp.lang.perl.misc:
> :: > If I have an array that has elements of the following form
> :: > 
> :: > 
> :: > #!usr/bin/perl
> :: > 
> :: > my @array;
> :: > 
> :: > $array[0] = "0 1 2 3 4 4 5";
> :: > 
> :: > $array[1] = "0 2 2 2 3 4 5";
> :: > 
> :: > $array[2] = "0 2 2 2 2 3 4";
> :: > 
> :: > $array[3] = "0 2 6 8 9 10 12";
> :: > 
> :: > How would I get rid of any elements of the array that have 4 or more
> :: > adjacent alike elements?  For example, in the above array, I would
> :: > want to
> ::  
> ::      my @sel = map { chop; $_} grep !/(\d+ )\1{3}/, map "$_ ", @array;
> 
> You might want to change the regex to:
> 
>     /\b(\d+ )\1{3}\b/
> 
> or it will filter out
> 
>     "12 2 2 2"
> 
> 
> Abigail



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

Date: Mon, 28 Feb 2005 09:03:15 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: sequences of numbers
Message-Id: <cvumeg$s1p$1@sun3.bham.ac.uk>

Big Daddy rudely spits TOFU in our faces:

[ rudeness corrected ]

 > Abigail wrote:
 >
 >>Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote:
 >>::
 >>::      my @sel = map { chop; $_} grep !/(\d+ )\1{3}/,
 >>::                  map "$_ ", @array;
 >>
 >>You might want to change the regex to:
 >>
 >>    /\b(\d+ )\1{3}\b/
 >>
 >>or it will filter out
 >>
 >>    "12 2 2 2"
 >
> Thank you for your help.

Please express your gratitude by _not_ spitting in our faces.

>  I found this works provided that all my numbers 
> are positive numbers. (I know, I didn't portray that in my original data). 
> Can this be easily modified to work for negative numbers as well?

Actually the regex solution knows nothing of numbers, it works on 
_strings_ and happens to constrain itself to strings that consist 
entirely of digits.

You could make it handle any non-whitespace string by simply changing 
"digit" to "non-whitespace character".

Please try to understand the solutions you are given rather than simply 
transcribe them by rote.




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

Date: Mon, 28 Feb 2005 02:01:40 -0500
From: Big Daddy <ihatespam@hotmail.com>
Subject: Re: sequences of numbers
Message-Id: <cvurgf$8i2$1@news.chatlink.com>

Well, no offense, but I thought the original post was quite clear. I 
obviously thought the problem was complex, hence the posting. The solution 
provided doesn't work. Here's why:

Try it on this:

$array[0] = ("-10 10 30 30 30 30");
$array[1] = ("-10 -10 -10 -10 20 30");
$array[2] = ("-12 2 2 2 20 30");
$array[3] = ("10 20 30");

Then, 

@stack = map{chop;$_} grep !/\b(\d+ )\1{3}\b/,map "$_", @array;

will yield @stack with 2 elements still.

I do understand the above, I couldn't figure out how to modify it to work 
properly.

The regular expression /\b(\d+ )\1{3}\b/ only works provided there is a 
space after the digit, which isn't the case for the last number in the 
string.  I never depicted a space after the last number in each string in 
the original post and it isn't trivial (at least for me) how to modify this 
to work when it is possible that the repeated number in the string could 
occur over the last four numbers of the string.

In other words, if the solution was trivial, someone would have figured it 
out by now, and they haven't.  In fact, your idea of using a non-whitespace 
character doesn't appear to work either. So please don't flame me for 
posting a question which has clearly been very difficult for even the best 
Perl programmers in the world to figure out.
 
Thank you

Brian McCauley wrote:

> Big Daddy rudely spits TOFU in our faces:
> 
> [ rudeness corrected ]
> 
>  > Abigail wrote:
>  >
>  >>Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote:
>  >>::
>  >>::      my @sel = map { chop; $_} grep !/(\d+ )\1{3}/,
>  >>::                  map "$_ ", @array;
>  >>
>  >>You might want to change the regex to:
>  >>
>  >>    /\b(\d+ )\1{3}\b/
>  >>
>  >>or it will filter out
>  >>
>  >>    "12 2 2 2"
>  >
>> Thank you for your help.
> 
> Please express your gratitude by _not_ spitting in our faces.
> 
>>  I found this works provided that all my numbers
>> are positive numbers. (I know, I didn't portray that in my original
>> data). Can this be easily modified to work for negative numbers as well?
> 
> Actually the regex solution knows nothing of numbers, it works on
> _strings_ and happens to constrain itself to strings that consist
> entirely of digits.
> 
> You could make it handle any non-whitespace string by simply changing
> "digit" to "non-whitespace character".
> 
> Please try to understand the solutions you are given rather than simply
> transcribe them by rote.



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

Date: 28 Feb 2005 11:27:38 +0100
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: sequences of numbers
Message-Id: <yzdzmxpvv1h.fsf@invalid.net>


Big Daddy <ihatespam@hotmail.com> writes:
> In other words, if the solution was trivial, someone would have figured it 
> out by now, and they haven't.  In fact, your idea of using a non-whitespace 
> character doesn't appear to work either. So please don't flame me for 
> posting a question which has clearly been very difficult for even the best 
> Perl programmers in the world to figure out.

Even the best Perl programmer in the world can only guess what the
format of the input is when you don't provide a definition, only a few
examples.


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

Date: 28 Feb 2005 04:26:55 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: The meaning of @
Message-Id: <Xns960AE45C0493castleamber@130.133.1.4>

GreenLeaf wrote:

 > Didn't she 

She?

-- 
John                   Small Perl scripts: http://johnbokma.com/perl/
               Perl programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html
                        


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

Date: Mon, 28 Feb 2005 15:53:07 +1100
From: Iain Chalmers <bigiain@mightymedia.com.au>
Subject: Re: The meaning of @
Message-Id: <bigiain-CB465D.15530728022005@individual.net>

In article <coidnfLRX9b3AbzfRVn-rw@is.co.za>,
 Leslie Viljoen <leslievNO@SPAMicoc.co.za> wrote:

> This is the center of the expression in a few places: ${@}
> Are we dereferencing the @? What does the @ on its own mean?

Just like ${foo} means the same thing as $foo (search for 'disambiguate' 
in perldata), so ${@} is equivalent to $@, which perlvar tells us is the 
short name for $EVAL_ERROR

>Presumeably the die puts the error message in the @ in some format.

Almost, die puts the error message into $@.

see:
perldoc perldata
perldoc perlvar

cheers,

big
-- 
On my tombstone they will carve, "IT NEVER GOT FAST 
ENOUGH FOR ME."' - Hunter S Thompson, 1937-2005 RIP


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

Date: Mon, 28 Feb 2005 14:02:26 +0800
From: GreenLeaf <newspost@kohombanDELETE.net>
Subject: Re: The meaning of @
Message-Id: <38fqi3F5mc1doU1@individual.net>

John Bokma wrote:
> GreenLeaf wrote:
> 
>  > Didn't she 
> 
> She?
> 

http://groups-beta.google.com/groups?q=abigail+%2Bshe+perl

How that information got _registered_ in my mind, I'm not sure. I guess 
someone referred to Abigail as (she|her) in some other recent post.

Cheers,
sat


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

Date: Mon, 28 Feb 2005 10:22:03 +0200
From: Leslie Viljoen <lesliev@NOSPAMicoc.co.za>
Subject: Re: The meaning of @
Message-Id: <KOOdne7zQb42Sb_fRVn-oA@is.co.za>

GreenLeaf wrote:
> John Bokma wrote:
> 
>> GreenLeaf wrote:
>>
>>  > Didn't she
>> She?
>>
> 
> http://groups-beta.google.com/groups?q=abigail+%2Bshe+perl
> 
> How that information got _registered_ in my mind, I'm not sure. I guess 
> someone referred to Abigail as (she|her) in some other recent post.

Hmmm, I apologise for that assumption. Abigail is an exclusively female 
name in South Africa AFAIK. Well, half the world thinks I am female too,
going by my name.


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

Date: Mon, 28 Feb 2005 11:47:24 +0100
From: Alexandre Jaquet <alexj@floor.ch>
Subject: thread trouble
Message-Id: <cvusrn$581$1@news.hispeed.ch>

Hi I could not understant why I got the following error message :

This Perl has neither ithreads nor 5005threads at 
/usr/local/lib/perl5/5.8.6/Thread.pm line 335
BEGIN failed--compilation aborted at 
/usr/local/lib/perl5/5.8.6/Thread.pm line 335.
Compilation failed in require at close_session.pl line 4.

with the following piece of code :

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

my $db_user = 'dbmaster';
my $db_password = 'xxx';
my $db_host = '192.168.123.90';
my $dbh = connectToServer ($db_host,$db_user, $db_password);
my @dbs = getDatabases ();


sub connectToServer {
     warn "Connection to server ..\n";
     my $dbname = shift || '';
     my $dbusername = shift || '';
     my $dbpassword = shift || '';
     $dbh = DBI->connect($db_host, $dbusername, $dbpassword);
     if (!$dbh) {
        warn("DBI: !! Unable to connect to dbname:$dbusername...");
     }
      else {
             print "connected";
        }
      kill 9, $$ unless $dbh;
    return \$dbh;
}

sub getDatabases {
     warn "Get databases ...";
     my @dbs = ();
     my ($c)=$dbh->prepare("SHOW DATABASES") or
             die "Sql has gone to hell\n";
     if(not ($c->execute())) {
        my $err=$dbh->errstr;
        return undef;
	}
     (@dbs)=$c->fetchrow();
      $c->finish();
     return @dbs;
}

sub closeSessions {
   warn "close sessions";
   Thread->new(\&execute())->join() foreach @dbs;
}

sub execute {
     my $db = shift || '';
     warn $db ." current \n";
     my $dbh = DBI->connect($db, $db_user, $db_password);
     if (!$dbh->do("UPDATE sessionlist SET status='lost' WHERE moddate < 
                DATE_SUB(NOW() , '60 Minute' AND status='open'")) {
     my $err=$dbh->errstr;
  }
}

thx in advance


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

Date: Mon, 28 Feb 2005 11:53:39 +0100
From: phaylon <phaylon@dunkelheit.at>
Subject: Re: thread trouble
Message-Id: <pan.2005.02.28.10.53.38.974121@dunkelheit.at>

Alexandre Jaquet wrote:

> This Perl has neither ithreads nor 5005threads

There's your answer, I would say.

-- 
http://www.dunkelheit.at/
I want, therefore I can.



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

Date: Mon, 28 Feb 2005 11:58:08 +0100
From: Alexandre Jaquet <alexj@floor.ch>
To: phaylon <phaylon@dunkelheit.at>
Subject: Re: thread trouble
Message-Id: <4222F940.8090803@floor.ch>

phaylon a écrit :
> Alexandre Jaquet wrote:
> 
> 
>>This Perl has neither ithreads nor 5005threads
> 
> 
> There's your answer, I would say.
> 

I 've open module Thread :

  311 BEGIN {
     312     if ($ithreads) {
     313         if ($othreads) {
     314             require Carp;
     315             Carp::croak("This Perl has both ithreads and 
5005threads (serious malconfiguration)");
     316         }
     317         XSLoader::load 'threads';
     318         for my $m (qw(new join detach yield self tid equal list)) {
     319             no strict 'refs';
     320             *{"Thread::$m"} = \&{"threads::$m"};
     321         }
     322         require 'threads/shared.pm';
     323         for my $m (qw(cond_signal cond_broadcast cond_wait)) {
     324             no strict 'refs';
     325             *{"Thread::$m"} = \&{"threads::shared::${m}_enabled"};
     326         }
     327         # trying to unimplement eval gives redefined warning
     328         unimplement(qw(done flags));
     329     } elsif ($othreads) {
     330         XSLoader::load 'Thread';
     331     } else {
     332         require Carp;
     333         Carp::croak("This Perl has neither ithreads nor 
5005threads");
     334     }
     335 }

I've checked if Carp was installed but don't understand why :s


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

Date: Mon, 28 Feb 2005 12:02:06 +0100
From: Alexandre Jaquet <alexj@floor.ch>
Subject: Re: thread trouble
Message-Id: <cvutn8$5vg$1@news.hispeed.ch>

Alexandre Jaquet a écrit :
> phaylon a écrit :
> 
>> Alexandre Jaquet wrote:
>>
>>
>>> This Perl has neither ithreads nor 5005threads
>>
>>
>>
>> There's your answer, I would say.
>>
> 
> I 've open module Thread :
> 
>  311 BEGIN {
>     312     if ($ithreads) {
>     313         if ($othreads) {
>     314             require Carp;
>     315             Carp::croak("This Perl has both ithreads and 
> 5005threads (serious malconfiguration)");
>     316         }
>     317         XSLoader::load 'threads';
>     318         for my $m (qw(new join detach yield self tid equal list)) {
>     319             no strict 'refs';
>     320             *{"Thread::$m"} = \&{"threads::$m"};
>     321         }
>     322         require 'threads/shared.pm';
>     323         for my $m (qw(cond_signal cond_broadcast cond_wait)) {
>     324             no strict 'refs';
>     325             *{"Thread::$m"} = \&{"threads::shared::${m}_enabled"};
>     326         }
>     327         # trying to unimplement eval gives redefined warning
>     328         unimplement(qw(done flags));
>     329     } elsif ($othreads) {
>     330         XSLoader::load 'Thread';
>     331     } else {
>     332         require Carp;
>     333         Carp::croak("This Perl has neither ithreads nor 
> 5005threads");
>     334     }
>     335 }
> 
> I've checked if Carp was installed but don't understand why :s

I checked perl -V and got :

ummary of my perl5 (revision 5 version 8 subversion 6) configuration:
 ...
  -Dusethreads=n - is that the problem ?


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 7838
***************************************


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