[28599] in Perl-Users-Digest
Perl-Users Digest, Issue: 9963 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 13 18:10:18 2006
Date: Mon, 13 Nov 2006 15:10:09 -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, 13 Nov 2006 Volume: 10 Number: 9963
Today's topics:
Re: Problems with Net::MySQL... chriswaltham@gmail.com
Re: Problems with Net::MySQL... <micmath@gmail.com>
Re: Problems with Net::MySQL... <micmath@gmail.com>
Re: Problems with Net::MySQL... chriswaltham@gmail.com
Re: simple regular expression <tzz@lifelogs.com>
Re: SOAP::LITE <glex_no-spam@qwest-spam-no.invalid>
Re: SSH Module: Accessing CLI box using SSH and not get <glex_no-spam@qwest-spam-no.invalid>
Re: Threads and sockets <m@remove.this.part.rtij.nl>
Re: Threads and sockets <m@remove.this.part.rtij.nl>
Re: Unix Scripting Education Survey <justin.0611@purestblue.com>
Re: What is more detailled than $^O ? <emschwar@pobox.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 13 Nov 2006 08:07:55 -0800
From: chriswaltham@gmail.com
Subject: Re: Problems with Net::MySQL...
Message-Id: <1163434075.521499.113650@b28g2000cwb.googlegroups.com>
Well I see it, but I don't believe it!
I removed Net::MySQL 0.09 and replaced it with Net::MySQL 0.08. And
everything works now.
[root@csc-web2 admin]# /usr/local/perl/bin/perl test.pl
First column: localhost Next column: root
First column: csc-web2.pressherald.com Next column: root
First column: localhost Next column:
First column: csc-web2.pressherald.com Next column:
First column: localhost Next column: cscuser
First column: 172.16.1.179 Next column: cscuser
First column: * Next column: cscuser
*sigh*
I'll try email the author of the module (again) to see what he thinks.
He never replied when I was trying to get it started in the first
place. Thanks for your help, Michael!
Chris
------------------------------
Date: 13 Nov 2006 08:11:18 -0800
From: "Michael" <micmath@gmail.com>
Subject: Re: Problems with Net::MySQL...
Message-Id: <1163434278.753756.47110@f16g2000cwb.googlegroups.com>
On Nov 13, 3:57 pm, chriswalt...@gmail.com wrote:
> I wouldn't mind using DBD, but unfortunately this module is pretty
> large & I don't think I know enough perl to go through it & rewrite all
> the calls from Net::MySQL to DBD::mysql...
If you can use the same credentials to successfully access the database
via the mysql CLI, then logically the problem must be in the module,
right? Simplifying the problem a bit: what do you get when you enter
the absolute minimal script possible in the terminal (should be all on
one line with no breaks)?
/usr/bin/perl -MNet::MySQL -e'print
Net::MySQL->new(database=>"mysql",user=>"root",password=>"secret");'
------------------------------
Date: 13 Nov 2006 08:16:03 -0800
From: "Michael" <micmath@gmail.com>
Subject: Re: Problems with Net::MySQL...
Message-Id: <1163434563.074228.44930@e3g2000cwe.googlegroups.com>
On Nov 13, 4:07 pm, chriswalt...@gmail.com wrote:
> Well I see it, but I don't believe it!
>
> I removed Net::MySQL 0.09 and replaced it with Net::MySQL 0.08. And
> everything works now.
Heh. Would you believe that was going to be the very next thing I
suggested? ;-) Anyway, I'm just glad you got it going finally. I hate
to hear of anyone trying to move to the Most Sweet Mac platform and
having problems.
Regards,
Michael
------------------------------
Date: 13 Nov 2006 11:20:07 -0800
From: chriswaltham@gmail.com
Subject: Re: Problems with Net::MySQL...
Message-Id: <1163445607.032162.152190@m7g2000cwm.googlegroups.com>
Michael wrote:
> On Nov 13, 4:07 pm, chriswalt...@gmail.com wrote:
> > Well I see it, but I don't believe it!
> >
> > I removed Net::MySQL 0.09 and replaced it with Net::MySQL 0.08. And
> > everything works now.
>
> Heh. Would you believe that was going to be the very next thing I
> suggested? ;-) Anyway, I'm just glad you got it going finally. I hate
> to hear of anyone trying to move to the Most Sweet Mac platform and
> having problems.
>
> Regards,
> Michael
Thanks again for your help, Michael. Yep, I'm a big Mac fan, so it was
great to get this one solved! I was beginning to tear my hair out. Now
I just have to make sure it works against perl-5.8.6, as well as the
webserver built into OS X Server (apache 2.x?).
I'll try the script you pasted with both Net::MySQL 0.08 and 0.09, and
send both to the maintainer. I think it's a bug somewhere.
Interestingly enough, the script failed completely when connecting to a
4.x or 5.0 MySQL server, which limits where we can go in the future...
Chris
------------------------------
Date: Mon, 13 Nov 2006 19:06:21 +0000
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: simple regular expression
Message-Id: <g69lkmfrwsy.fsf@lifelogs.com>
On 11 Nov 2006, hjp-usenet2@hjp.at wrote:
On 2006-11-10 18:05, Ted Zlatanov <tzz@lifelogs.com> wrote:
> On 8 Nov 2006, asandstrom@accesswave.ca wrote:
>>> There's a time and a place for regular expressions. But the string
>>> functions exist for a reason and sometimes they're better.
>>
>> Are there any cases (within the scope of intended usage--fixed offsets
>> and search strings) that index, length, and substr are slower than
>> regular expressions? I don't know of any, and I'm curious.
>
> Note that he wrote "better", not "faster". "Better" in code is usually a
> mixture of several aspects and readability and maintainability are often
> considered more important than performance.
I think speed is the only aspect of code that everyone can agree on.
Ted
------------------------------
Date: Mon, 13 Nov 2006 10:40:39 -0600
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: SOAP::LITE
Message-Id: <4558a01f$0$61929$815e3792@news.qwest.net>
neil.holmes@zoom.co.uk wrote:
> Thanks for this. I have 0.60 on both Windows and Linux.
>
> I have added debug to my script :-
>
> #!perl -w
> use SOAP::Lite +trace =>
> qw(debug);
> print SOAP::Lite
> -> service('http://neilvmes3:8082/ws/EcsAddEntry?wsdl')
> -> TK_ADD_ENTRY("Neil Holmes",'Greatest
> Hits','CD','9.99','www.proiv.com');
>
> And the output is as follows :-
>
> SOAP::Transport::HTTP::Client::send_receive: POST
> http://neilvmes3:8082/ws/EcsAddEntry HTTP/1.1
> Accept: text/xml
> Accept: multipart/*
> Content-Length: 679
> Content-Type: text/xml; charset=utf-8
> SOAPAction: "http://neilvmes3:8082/ws/EcsAddEntry"
>
> <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
> xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/1999/XMLSchema"
> SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><TK_ADD_ENTRY
> xmlns="">
<parameters>Neil Holmes</parameters><c-gensym4
> xsi:type="xsd:string">Greatest Hits</c-gensym4><c-gensym6
> xsi:type="xsd:string">CD</c-gensym6><c-gensym8
> xsi:type="xsd:float">9.99</c-gensym8><c-gensym10
> xsi:type="xsd:string">www.proiv.com</c-gensym10>
That looks odd.. Why "Neil Holmes" isn't a string.
>
> <SOAP-ENV:Envelope
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Client</faultcode><faultstring>Error
> identifying Web Service: class
> com.northgateis.proiv.ws.servlet.WebServiceIdentificationException:
> Parameter ARTIST had 0 entry in the message part. Expecting
> 1.</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
>
> This seems to be telling me that there is no value in the Parameter
> (the first value in the Method). How can this be ? I am particularly
> puzzled as there clearly is on Windows.
>
> Your advise is much appreciated.results
Run it from the host that works and compare the output.
Since you have a WSDL, you could also try using 'stubmaker.pl',
which comes with SOAP::Lite, to create a class, which you can
use or peruse it for any helpful code. See 'stubmaker' in
perldoc SOAP::Lite.
Maybe use SOAP::Data to set the properties for all of the attributes:
my @params = (
SOAP::Data->name( ARTIST => 'Neil Holmes' )->type( 'string' ),
SOAP::Data->name( ALBUM => 'Greatest Hits')->type( 'string' ),
etc..
);
print SOAP::Lite
-> service('http://neilvmes3:8082/ws/EcsAddEntry?wsdl')
-> TK_ADD_ENTRY( @params );
Just a guess though. I have to do that when working with services
written in .NET. (
http://www.oreilly.com/catalog/progwebsoap/chapter/ch03.html )
You will be able to get more SOAP::Lite specific help at
http://tech.groups.yahoo.com/group/soaplite/
------------------------------
Date: Mon, 13 Nov 2006 10:08:26 -0600
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: SSH Module: Accessing CLI box using SSH and not getting the return output??
Message-Id: <45589892$0$497$815e3792@news.qwest.net>
Deepika wrote:
> Hi Everyone,
>
> I am trying to write a perl code to access and run few commands on a
> Secure CLI-Box using SSH module in Perl.After installing the Perl
> module with a lot of difficulty I am facing the following issue. I am
> able to log-into the box but I don't get any results back for the
> commands I am trying to run on the box.
> If I use the same perl code to log-into another linux machine and do
> an"ls" I get the result back with no problems at all. Here is the debug
> message while trying to access the CLI-box and running the commands.
>
> Any Help will be really appreciated. I have been struck at the same
> issue for about a month and my code is due soon and I have no clue how
> to fix it.
Showing your code would help.
First, run the ssh from the command line:
ssh machine ls
Does that work for both machines?
------------------------------
Date: Mon, 13 Nov 2006 21:27:10 +0100
From: Martijn Lievaart <m@remove.this.part.rtij.nl>
Subject: Re: Threads and sockets
Message-Id: <pan.2006.11.13.20.27.10.31193@remove.this.part.rtij.nl>
On Mon, 13 Nov 2006 13:36:28 +0000, zentara wrote:
> On 12 Nov 2006 23:38:29 GMT, xhoster@gmail.com wrote:
>
>>Martijn Lievaart <m@remove.this.part.rtij.nl> wrote:
>
>>> Or should the socket be marked shared?
>>
>>I get an error message "Cannot share globs yet" when I try.
>>
>>> Or will this not work
>>> at all? Or depending on the OS (I'm using Linux).
>
> A couple of quick ideas( I may be missing your problem entirely) :-)
(snip)
Thanks. Very informative.
M4
--
Redundancy is a great way to introduce more single points of failure.
------------------------------
Date: Mon, 13 Nov 2006 21:45:19 +0100
From: Martijn Lievaart <m@remove.this.part.rtij.nl>
Subject: Re: Threads and sockets
Message-Id: <pan.2006.11.13.20.45.18.990735@remove.this.part.rtij.nl>
On Mon, 13 Nov 2006 15:06:59 +0000, xhoster wrote:
> Martijn Lievaart <m@remove.this.part.rtij.nl> wrote:
>>
>> >> I want to make the server concurrent by using ithreads,
>> >> creating n threads and distributing the requests over the threads
>> >> using Threads::Queue. The thread itself should send back the result to
>> >> the client.
>> >
>> > Why not just use another Thread::Queue to put the answer in, and have
>> > the main thread send all the responses?
>>
>> Because I don't see how I can both select() and dequeue() in the main
>> thread. Or do you see another solution?
>
> You could open a pipe from socket to itself. Have the slaves print one byte
> to it when they have just enqueued something. Then use select on both the
> accept handle and on the semaphor handle--when you get the semaphor thread
> you know you should check the queue.
(seen your other post, got the correction).
Yes, that's an idea. A very good idea at that, as I can pass perl data
through the queue, but should Data::Dumper it to get it across a socket.
>> This has another advantage. It makes signal handling much simpler. I
>> think signals and threads cannot be used (simple) together so this is
>> probably a better solution overall.
And this promisses to be the killer. Threads and signals don't go
together. I need timeouts.
>> The problem here is that I also want some kind of caching, that is why I
>> looked at threads in the first place. Oh well, I can use an on disk cache
>> as well.
>
> Checking the cache should be fast, right? With the forking method, you
> could only fork if the thing wasn't in the cache, and then use a pipe so
> the child can tell the parent how to update it's cache. Of course, if your
> cache is going to be (or likely become in the forseeable future) bigger
> than memory, then there is no reason to go to lengths to avoid a disk
> cache.
Well I was thinking about preforking, not forking, so the penalty
shouldn't be to bad. Using a cache only in the main thread would also
work but shifts some work back to the main thread, so this would mean some
re-coding the existing worker routine. Oh well, it actually is somewhat
cleaner, even if somewhat less efficient on a cache miss (which will be
frequent, the pattern is most of the time no cache hit, but sometimes a
lot of cache hits).
>> >> Now I understand the basics of :shared. I just cannot wrap this around
>> >> to sockets.
>> >>
>> >> For TCP: Can I just enqueue a socket and use it in the thread that
>> >> dequeues it?
>> >
>> > I don't think so. You can't enqueue objects. You could enqueue some
>> > kind
>>
>> I could not find that in the docs, do you have a pointer?
>
> Mostly I just got it from the error messages. Actually, you can enqueue
> objects, as long as they are "shared" before you try to enqueue them. But
> sharing objects isn't necessarily well supported, especially file handles,
> it seems
Right. Noted. Thanks. Sucks.
This is getting way to complex (see also the note about signals). I'll
settle for a preforked server, send responses back to the client in the
parent proces and somehow get the data over a socket from parent to
children and back.
Actually the rewrite I mentioned above makes this more possible.
The server is a very simple DNS server. It should be driven from bind
trough a forward statement. The questions are alway a simple string. The
answers are always A or TXT records, or an errorcode. No glue records,
SOAs or other complications. These are faily simple to pass along a socket
using a line oriented protocol which also makes debugging much simpler.
The parent can then encode the RR and send it to the client.
/me switches to desktop 5 and starts coding.
Thanks for all the pointers
M4
--
Redundancy is a great way to introduce more single points of failure.
------------------------------
Date: Mon, 13 Nov 2006 21:36:50 +0000
From: Justin C <justin.0611@purestblue.com>
Subject: Re: Unix Scripting Education Survey
Message-Id: <justin.0611-53FE73.21365013112006@stigmata>
In article <1163422504.234888.118920@k70g2000cwa.googlegroups.com>,
octomancer@blueyonder.co.uk wrote:
> Justin C wrote:
> > In article <1163289401.939625.199500@m7g2000cwm.googlegroups.com>,
> > "AndrewS" <pillyponka@gmail.com> wrote:
> > > Survey: http://www.surveymonkey.com/s.asp?u=743662789831
> > *and* you expect me to visit "surveymonkey"?
>
> It seems (from the quotes around the name) that you have decided that
> surveymonkey.com is not worth visiting based on the domain. In fact,
> Surveymonkey is a perfectly respectable site which has been offering a
> do-it-yourself survey toolkit for years, in the same vein as Zoomerang,
> SurveyShack, ConfirmIt and many others.
>
> > Do we *look* like idiots here?
>
> More often than is necessary, unfortunately.
LOL, TY for the reality check.
--
Justin C, by the sea.
------------------------------
Date: 13 Nov 2006 11:40:56 -0700
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: What is more detailled than $^O ?
Message-Id: <87slgn9olj.fsf@aragorn.emschwar>
"Peter J. Holzer" <hjp-usenet2@hjp.at> writes:
> On 2006-11-06 23:24, Eric Schwartz <emschwar@pobox.com> wrote:
> > If one is writing an installer, it might be useful to know if one is
> > to use yum, apt-get, or yast to install any dependencies,
>
> So test for the availability of these tools.
This doesn't necessarily give you what you need. For instance, RHEL3
may need packages a-1.3.rpm, b-2.4.rpm, and so on, but RHEL4 might
need a-1.9.rpm, and b-3.7.rpm. Also, I frequently have Debian systems
with rpm installed, and as you point out, below, many RPM-based
distros have apt tools available. So knowing the tools available
doesn't tell you anything about which set of dependent packages to
install, which is usually the hard problem.
> A stock redhat system hasn't any of these tools, but the sysadmin
> might have installed yum or apt (most of my redhat systems have
> apt). it might even be possible to deinstall yast on a suse system.
Right-- which means that testing for the tools may not tell you want
you want to know, because, depending on the ordering of the check, you
may end up deciding you're on the wrong sort of system.
> > or which package to prompt the user to install.
>
> Yes, but it generally needs quite special knowledge which changes
> frequently.
"Frequently", in the context I'm thinking of, is "every two years or
so", which is fairly manageable.
> A feature provided by package X in version n might be provided by
> package Y in version n+1.
This is trivially handle-able. Which is why it's useful to know these
things.
> So as a hint for the user that's helpful ("I can't find libfoo,
> since you are on a Redhat system, it is probably included in the
> foo2-devel package", or something like that), but the same
> information could just be contained in the README without any real
> loss of functionality.
I disagree; being forced to handle something manually which could be
handled automatically counts as a real loss of functionality in my
book. That's not to say it's either a) fun or b) a good idea in all
cases, but there are times it's good to know these things, and to be
able to handle them without resorting to making an end-user work
around it for you.
A suggestion such as you make is nice if you're trying to make your
installer forward-compatible with distros you don't know about when
the installer is written, but if you can know the answer, why not use
that information?
> To adapt the behaviour of the program to its environment, there are
> usually more direct and reliable indicators than the distribution.
Usually-- but not always, which was more or less my point.
-=Eric
------------------------------
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 9963
***************************************