[29891] in Perl-Users-Digest
Perl-Users Digest, Issue: 1134 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 21 00:09:42 2007
Date: Thu, 20 Dec 2007 21:09:06 -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 Thu, 20 Dec 2007 Volume: 11 Number: 1134
Today's topics:
5.10 threads :: shared message <grg2@comcast.net>
Re: 5.10 threads :: shared message <joost@zeekat.nl>
Re: 5.10 threads :: shared message <ben@morrow.me.uk>
Re: 5.10 threads :: shared message <ben@morrow.me.uk>
Re: 5.10 threads :: shared message <grg2@comcast.net>
Re: A problem with Perl 5.10.0 installation <rwxrxrx@gmail.com>
A problem with storing a filehandle as an instance vari <esniff@gmail.com>
Re: FAQ 4.3 Why isn't my octal data interpreted correct <brian.d.foy@gmail.com>
Re: FAQ 4.3 Why isn't my octal data interpreted correct <brian.d.foy@gmail.com>
How about csh-like (nested, etc)? Re: How to get the st (David Combs)
Re: PID of Service <thepoet_nospam@arcor.de>
Search Engine Marketing (SEM), SEM Firm India, Internet visioninfosyslinks@gmail.com
SEM Firm India visioninfosyslinks@gmail.com
Web Hosting Packages India - Cheap Web Hosting Hyderaba visioninfosyslinks@gmail.com
Which editor for Perl hacking are you using <john@castleamber.com>
Win32::Daemon <bol@adv.magwien.gv.at>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 20 Dec 2007 08:00:44 -0800 (PST)
From: Abble <grg2@comcast.net>
Subject: 5.10 threads :: shared message
Message-Id: <0138adc3-1676-4344-8b32-f10846928f38@e6g2000prf.googlegroups.com>
I get:
"Bizarre copy of HASH in aassign at DiskSpeeds.pl line 10."
when I do:
use strict; use English; use warnings;
use Time::HiRes;
use threads;
use threads :: shared;
use Net::Ping;
my( %Times, %Samples, %Time, %Avg ) : shared = 1; ## line 10
my( @Vols, $Begins );
Any ideas???
------------------------------
Date: Thu, 20 Dec 2007 17:07:14 +0100
From: Joost Diepenmaat <joost@zeekat.nl>
Subject: Re: 5.10 threads :: shared message
Message-Id: <87abo5pcy5.fsf@zeekat.nl>
Abble <grg2@comcast.net> writes:
> I get:
>
> "Bizarre copy of HASH in aassign at DiskSpeeds.pl line 10."
Why are you assigning 1 to a list of hashes?
my( %Times, %Samples, %Time, %Avg ) : shared;
Doesn't give the error. I haven't checked if you can actually assign
attributes this way, though.
Joost.
------------------------------
Date: Thu, 20 Dec 2007 18:07:33 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: 5.10 threads :: shared message
Message-Id: <5knq35-h77.ln1@osiris.mauzo.dyndns.org>
Quoth Abble <grg2@comcast.net>:
> I get:
>
> "Bizarre copy of HASH in aassign at DiskSpeeds.pl line 10."
>
> when I do:
>
> use strict; use English; use warnings;
> use Time::HiRes;
> use threads;
> use threads :: shared;
> use Net::Ping;
>
>
> my( %Times, %Samples, %Time, %Avg ) : shared = 1; ## line 10
>
>
> my( @Vols, $Begins );
Bug in threads::shared. A simpler example is
use threads;
use threads::shared;
my ($x, @y) :shared = (1);
This also existed in 5.8.8, it isn't new in 5.10. The threads::shared
implementation of shared arrays and shared hashes is an evil stinking
mess, made necessary by the fact that perl's magic system isn't really
OO, it just kinda looks that way if you don't look too closely :).
Ben
------------------------------
Date: Thu, 20 Dec 2007 21:40:39 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: 5.10 threads :: shared message
Message-Id: <n34r35-4oh.ln1@osiris.mauzo.dyndns.org>
Quoth Ben Morrow <ben@morrow.me.uk>:
> Quoth Abble <grg2@comcast.net>:
> > I get:
> >
> > "Bizarre copy of HASH in aassign at DiskSpeeds.pl line 10."
> >
> > when I do:
<snip>
>
> Bug in threads::shared. A simpler example is
>
> use threads;
> use threads::shared;
>
> my ($x, @y) :shared = (1);
Having looked into this further: the bug isn't in threads::shared, it's
in the attribute-handling code. Although this
use Attribute::Handlers;
sub Foo : ATTR {
warn "Applying :$_[3]";
}
my ($x, @y) :Foo = (1);
doesn't give an error with 5.8.8, it does with 5.10.0; and in both cases
it fails to set $x. I've reported this to p5p...
Ben
------------------------------
Date: Thu, 20 Dec 2007 08:57:57 -0800 (PST)
From: Abble <grg2@comcast.net>
Subject: Re: 5.10 threads :: shared message
Message-Id: <fe629156-bedd-4bd7-bfd3-277dc5be9f12@j20g2000hsi.googlegroups.com>
On Dec 20, 10:07 am, Joost Diepenmaat <jo...@zeekat.nl> wrote:
> Abble <g...@comcast.net> writes:
> > I get:
>
> > "Bizarre copy of HASH in aassign at DiskSpeeds.pl line 10."
>
> Why are you assigning 1 to a list of hashes?
>
> my( %Times, %Samples, %Time, %Avg ) : shared;
>
> Doesn't give the error. I haven't checked if you can actually assign
> attributes this way, though.
>
> Joost.
Oh, the example I saw had the shared = 1 bizness; Will try it
without.
Thanks!
------------------------------
Date: Thu, 20 Dec 2007 11:23:14 +0800
From: Scott <rwxrxrx@gmail.com>
Subject: Re: A problem with Perl 5.10.0 installation
Message-Id: <fkdnqc$a0b$1@news.cn99.com>
Joost Diepenmaat 写道:
> "Scott.zhou" <rwxrxrx@gmail.com> writes:
>
>> when i run make tool, i got such problem
>>
>> perl.c:(.text+0x47f2): undefined reference to `SOCKSinit'
>>
>> AND i could not search SOCKSinit definition in /usr/include/*
>> how could i fix this problem
>
> Did you enable "SOCKS support" during the sh Configure stage?
> It's disabled by default and I think you'd know if you need it.
>
> I just did a
>
> $ sh Configure
> ( chose defaults for everything except that I enabled threads )
> $ make
> .... (lots of output)
> Everything is up to date. Type 'make test' to run test suite.
>
> Or did you mean something else by "run make tool"?
>
> See also the INSTALL file.
>
> HTH,
> Joost.
Done!
When I firstly chose interactively installation, I said "yes" to enable
"SOCKS support".
Thanks very much to all friends.
------------------------------
Date: Thu, 20 Dec 2007 17:53:20 -0800 (PST)
From: Sniff <esniff@gmail.com>
Subject: A problem with storing a filehandle as an instance variable
Message-Id: <e4924f25-d9ab-45d9-b36f-fb89d22cb7c2@x69g2000hsx.googlegroups.com>
I have been working with Perl for a few months now and in my latest
program I decided to give Perl OO a try. :-)
In an object I'm trying to use a Filehandle (or Glob) which is uses to
communicate with a child. I have been trying to keep these handles in
an instance variable but it doesn't seem to work. I have tried a few
different ways but I think I'm having issues dereferencing the
variables.
Here are some of the ways I have tried to do this:
In my class constructor I do this:
my $fhw = *write{FILEHANDLE};
$self->{"WRITE"} = $fhw;
# ... repeated for READ, ERROR ...
# Then I call open3 with those 3 handles
open3( $self->{"WRITE"}, $self->{"READ"}, $self->{"ERROR"},
"worker.pl" );
Later in a method I tried :
print $self->{"WRITE"} "$someMessage\n" ; # this creates a syntax
error, why?
I also tried this:
In the class constructor:
$self->{"WRITE"} = \*WRITE; #using a reference to a globtype
#later on I call open3 as I did above
Then in a method I tried :
print {$self->{"WRITE"}} "$message\n" ; #No error but I don't
think it worked
My first version of all this code was written in non-OO style and it
works fine, but I was using a bareword (i.e. *WRITE) for the file
handles. Any help would be appreciated.
------------------------------
Date: Thu, 20 Dec 2007 09:59:10 -0600
From: brian d foy <brian.d.foy@gmail.com>
Subject: Re: FAQ 4.3 Why isn't my octal data interpreted correctly?
Message-Id: <201220070959109028%brian.d.foy@gmail.com>
In article <47695b7e$0$13929$fa0fcedb@news.zen.co.uk>, RedGrittyBrick
<RedGrittyBrick@SpamWeary.foo> wrote:
> brian d foy wrote:
> > In article <slrnfmg4dg.go9.hjp-usenet2@hrunkner.hjp.at>, Peter J.
> > Holzer <hjp-usenet2@hjp.at> wrote:
> >
> >>> I still say that Perl numbers are decimal unless we say
> >>> otherwise.
> >> That's easy to disprove:
> >>
> >> % perl -l -e 'for ($i = 0; $i != 1; $i += 0.1) { print $i }'
> >
> > I see Perl using the digits 0 to 9.
> [snip]
> > When you talk about binary, you're talking about computer storage.
> > That's something external to Perl. I'm just talking about Perl.
>
> You and Peter seem to be arguing at cross-purposes. I believe Peter was
> objecting to the final words of this part of the FAQ:
That would make sense. I couldn't (an still can't) tell that from his
original message, which quoted the entire answer.
------------------------------
Date: Thu, 20 Dec 2007 10:03:56 -0600
From: brian d foy <brian.d.foy@gmail.com>
Subject: Re: FAQ 4.3 Why isn't my octal data interpreted correctly?
Message-Id: <201220071003566174%brian.d.foy@gmail.com>
In article <slrnfmisf0.n0u.hjp-usenet2@hrunkner.hjp.at>, Peter J.
Holzer <hjp-usenet2@hjp.at> wrote:
> On 2007-12-19 17:11, brian d foy <brian.d.foy@gmail.com> wrote:
> > In article <slrnfmg4dg.go9.hjp-usenet2@hrunkner.hjp.at>, Peter J.
> > Holzer <hjp-usenet2@hjp.at> wrote:
> >
> >> > I still say that Perl numbers are decimal unless we say otherwise.
> >>
> >> That's easy to disprove:
> >>
> >> % perl -l -e 'for ($i = 0; $i != 1; $i += 0.1) { print $i }'
> >
> > I see Perl using the digits 0 to 9.
> >
> > There are underlying implementation details based on the architecture,
> > but that's implementation. The language is not the processor or the
> > storage. That there is some round-off error because of the limitations
> > of computers doesn't change the fact that Perl is using the digits 0 to
> > 9.
>
> You are confusing Source code and run-time. I was talking about
> run-time.
I'm not confusing them at all. The run time is not the implementation.
You're not talking about run time either. You're talking about the
implementation on binary computers. The run time is just the bit that
does what the op codes say. By that time, Perl has already decided to
parse numbers. It's not a problem with phase.
I now see where the our confusion is. In your original message, you
quote the entire FAQ answer. It's much easier to establish context if
you trim it to the parts that you're responding too.
The answer does need some work, and I'll look at that.
------------------------------
Date: Fri, 21 Dec 2007 03:38:19 +0000 (UTC)
From: dkcombs@panix.com (David Combs)
Subject: How about csh-like (nested, etc)? Re: How to get the string Cartesian Products of 2 list
Message-Id: <fkfcfb$70m$1@reader1.panix.com>
In article <3bc8b657-828f-4cde-bbf5-9d9c09b8e59f@s8g2000prg.googlegroups.com>,
<xueweizhong@gmail.com> wrote:
>Give 2 string list such as: a..b and 1..3, i want to get a list which
>is (a1, a2, a3, b1, b2, b3). Is there an elegant way in perl to
>fullfill this withou using loop BLOCK? Or Is there a elegant one line
>expression to get this?
Lots of neat solutions to *this* problem in this thread!
Now, how about generalizing it to eg what csh, etc, has:
{a, b, c, {e, f, g}{1,2}, x}{" hello", "goodbye"} etc
How to even *approach* this problem, or even *think* about it.
A whole set of coroutines or generators or something?
Any ideas?
Thanks
David
Not that I really need a solution -- seems to me
like a very interesting problem, various possible data structures,
various possible control structures, ...
------------------------------
Date: Thu, 20 Dec 2007 09:44:58 +0100
From: Christian Winter <thepoet_nospam@arcor.de>
Subject: Re: PID of Service
Message-Id: <476a2b8a$0$13122$9b4e6d93@newsspool2.arcor-online.net>
Ferry Bolhar schrieb:
> Christian Winter:
>
>> You can gather that info from the WMI (quick'n'dirty):
>
> [...]
>
> Looks great! Does this work from other hosts as well?
Certainly, though with the docs for DBD::WMI alternating between
lacking and plain wrong, it's not that easy to guess:
my $dbh = DBI->connect('dbi:WMI:' . $hostname);
will do the trick.
-Chris
------------------------------
Date: Thu, 20 Dec 2007 00:33:39 -0800 (PST)
From: visioninfosyslinks@gmail.com
Subject: Search Engine Marketing (SEM), SEM Firm India, Internet Marketing Services India Hyderabad
Message-Id: <2e1cb06f-7722-4013-8dec-5f3d65c394de@s19g2000prg.googlegroups.com>
SEM Firm India - Vision Infosys - is a Search Engine Optimization
Company in India Hyderabad which involves in Local Search Marketing,
SEO Marketing, Search Engine Marketing (SEM) India, PayPer Click
advertising and global internet marketing Solutions
SEM Firm India, Internet Marketing Services India, Web Designing,
website design India, Web Development, web marketing, internet
marketing India, Search Engine Optimization India, SEO Hyderabad, web
design Hyderabad, Search Engine Marketing, search engine submission,
SEO tools, search engine methodology, SEM India, Pay Per Click
advertising, internet marketing tools, E-Commerce solutions, Internet
Marketing Firm, Internet Marketing Firm India, Internet Marketing
Solutions, India SEO expert, SEO services India, SEO company in India,
cheap Web Hosting, Domain Registration
For More Deteails Click at: http://www.vision-infosys.com
------------------------------
Date: Thu, 20 Dec 2007 00:35:56 -0800 (PST)
From: visioninfosyslinks@gmail.com
Subject: SEM Firm India
Message-Id: <b22fc2cd-bd1a-4bbd-818c-2c4febd45d1d@d4g2000prg.googlegroups.com>
SEM Firm India, Internet Marketing Services India, Web Designing,
website design India, Web Development, web marketing, internet
marketing India, Search Engine Optimization India, SEO Hyderabad, web
design Hyderabad, Search Engine Marketing, search engine submission,
SEO tools, search engine methodology, SEM India, Pay Per Click
advertising, internet marketing tools, E-Commerce solutions, Internet
Marketing Firm, Internet Marketing Firm India, Internet Marketing
Solutions, India SEO expert, SEO services India, SEO company in India,
cheap Web Hosting, Domain Registration
For More Deteails Click at: http://www.vision-infosys.com
------------------------------
Date: Thu, 20 Dec 2007 00:37:43 -0800 (PST)
From: visioninfosyslinks@gmail.com
Subject: Web Hosting Packages India - Cheap Web Hosting Hyderabad
Message-Id: <ac8cfc88-fc4e-409d-aa75-fa41991f7ccc@i12g2000prf.googlegroups.com>
Vision Infosys Provides Web Hosting Packages, Cheap Web Hosting
Services in India HyderabadWeb Hosting Packages India, Cheap Web
Hosting Hyderabad, Web Designing, website design India, Web
Development, web marketing, internet marketing India, Search Engine
Optimization India, SEO Hyderabad, web design Hyderabad, Search Engine
Marketing, search engine submission, SEO tools, search engine
methodology, SEM India, Pay Per Click advertising, internet marketing
tools, E-Commerce solutions, Internet Marketing Firm, Internet
Marketing Firm India, Internet Marketing Solutions, India SEO expert,
SEO services India, SEO company in India, cheap Web Hosting, Domain
Registration
For More Deteails Click at: http://www.vision-infosys.com
------------------------------
Date: 21 Dec 2007 04:52:26 GMT
From: John Bokma <john@castleamber.com>
Subject: Which editor for Perl hacking are you using
Message-Id: <Xns9A0CE8B10A2Ecastleamber@130.133.1.4>
Please no editor war, but I am curious, what's the editor of choice you're
using to write Perl, and why (if you want to share).
I am currently using Textpad, but in the very near future I am moving to
GNU/Linux. I've some experience with using vi(m) for editing work, and
have printed both the emacs and vim manual, but not sure which one to
start reading first.
I've had a short peek at Komodo Edit, but considered the start up time way
too high. Ages ago I had a peek at Eclipse, but not sure if I am the IDE
kind of guy (I manage quite ok with a "perldoc" keymark in Firefox, and
perldoc on the cli most of the time).
--
John
http://johnbokma.com/mexit/2007/12/20/
------------------------------
Date: Thu, 20 Dec 2007 12:10:03 +0100
From: "Ferry Bolhar" <bol@adv.magwien.gv.at>
Subject: Win32::Daemon
Message-Id: <1198149034.435265@proxy.dienste.wien.at>
Good day,
has anyone experience with the modulen named in the subject, especially
with its SetServiceBits() function?
A service can use this function to declare a computer as "responsible"
for a specific task (for example, as a Microsoft SQL Server) by setting
a particular bit given as argument. There are, however, 10 bits available
for user-specific purpopes.
I want to use this function to register systems on which a special service
is installed. Using the Win32::NetAdmin::GetServers() function, I could
then specify the approbiate bit in its $flag argument to obtain just a list
of systems on which my service is installed:
In my service:
use Win32::Daemon;
...
Win32::Daemon::SetServiceBits(USER_SERVICE_BITS_1);
In the script to lookup for systems running my service:
use Win32::NetAdmin;
use Win32::Daemon;
my $dom = 'Wien1';
my $pdc = 'MASTER';
Win32::NetAdmin::GetServers($pdc, $dom, USER_SERVICE_BITS_1, \my @servers);
In my service code, I can invoke SetServiceBits() without problems.
The function returns 1, indicating success.
However, when running the above lookup script, I get no error, but the
@servers array remains empty, indicating that the system on which my
service is running wasn't found.
What's wrong here? Have I made a mistake?
In addition, can someone explain the purpose of the Win32::Daemon
ShowService() and
HideService()
functions?
Many thanks for your answers & kind greetings,
--
Ing Ferry Bolhar
Magistrat der Stadt Wien - MA 14
A-1010 Wien
E-Mail: ferdinand.bolhar-nordenkampf@wien.gv.at
------------------------------
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 V11 Issue 1134
***************************************