[26613] in Perl-Users-Digest
Perl-Users Digest, Issue: 8725 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Dec 3 00:05:52 2005
Date: Fri, 2 Dec 2005 21:05: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 Fri, 2 Dec 2005 Volume: 10 Number: 8725
Today's topics:
A question of hashes in a module. <invalid@nowhere.com>
How can I use GD module in Windows XP ? <smilebang@dreamwiz.com.nospam>
Re: How can I use GD module in Windows XP ? <see.sig@rochester.rr.com>
Perl DBD-My with SQL 5.0 <anton.vandersteen@chello.nl>
Re: Perl DBD-My with SQL 5.0 <glex_no-spam@qwest-spam-no.invalid>
Re: Perl DBD-My with SQL 5.0 <sherm@dot-app.org>
Re: URL Parsing <toddrw69@excite.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 02 Dec 2005 22:25:15 -0600
From: Don Gatlin <invalid@nowhere.com>
Subject: A question of hashes in a module.
Message-Id: <pan.2005.12.03.04.25.13.193532@nowhere.com>
A couple of questions on a hash inside of a module. Actually I have just
started to learn object perl.
Here is the module (shortened for clarity). Not a real program, just a
test to try to understand it.
###################################### 1 package Initalise;
2
3 sub new {
4 my $class = shift;
5 my $ref = {
6 Hammer => {
7 price => 10,
8 color => 'Blue',
9 weight => 2,
10 },
11 Wrench => {
12 price => 5,
13 color => 'Silver',
14 weight => 1,
15 },
16 };
17 bless($ref, $class);
18 return $ref;
19 #---------------------------
20 sub start_structures {
21 my $self = shift;
22 my $key;
23 my $value;
24 while ( ($key, $value) = each %$self) { 25 if ($self{$key}{color}
eq 'Silver') { 26 #do something
27 }
28 }
29 return $z;
30 }
31 }
32 1;
#####################################
I have been playing with hashes and hashes of hashes in normal procedural
"Hello World" type of programming but this works somewhat differently. In
line 24, why is the hash called %$self rather than the usual hash name of
%self ? And in the debugger looking at %self gives just a hash id, but
$self gives the whole hash value tree. In an ordinary MAIN program, %hash
gives the whole value tree and $hash just gives the values for that one
key.
What I have in the new{} part is what looks like to me to be a normal hash
of hashes. In fact that is what it looks like to my debugger.
In the bottom subroutine I can look at the value of $self (in the debugger
- again, why not %self?) and it shows to a hash of hashes with the proper
values from above, but line 25 doesn't work - ($self{$key}{'color'} is
always undef, although in a normal procedural context (an ordinary MAIN
program, that is) that is a way to get the value of a particular value in
a hash of hashes. What I can do is get the entire value of the desired
$key from the object and parse it outside of the object but that is
obviously a kludge.
So, I am not understanding the differences between a hash outside or
inside of a module/object and my books so far aren't helping.
Insights anyone?
Thanks
krf
------------------------------
Date: Sat, 3 Dec 2005 11:55:57 +0900
From: "À̹淡" <smilebang@dreamwiz.com.nospam>
Subject: How can I use GD module in Windows XP ?
Message-Id: <dmr19s$ghe$1@news2.kornet.net>
Dear Sir!
I'm a beginner in perl programming.
My os is Windows xp home edition and I want to create some graphic images
with perl module.
I downloaded the GD-2.30 moduel at CPAN but I can't install.
the error message say that I should use libgd 2.0.28 or higher. so I
downloaded gdwin32 at www.boutell.com
but the website say that I should use ANSI C compiler. At some message, gcc
is free and we can get c compiler at ftp://ftp.cygnus.com, but I can't get
anything.
How can I use GD module in Windows XP system?
Sincerely
------------------------------
Date: Sat, 03 Dec 2005 03:17:55 GMT
From: Bob Walton <see.sig@rochester.rr.com>
Subject: Re: How can I use GD module in Windows XP ?
Message-Id: <D78kf.60110$uC3.2912@twister.nyroc.rr.com>
À̹淡 wrote:
...
> My os is Windows xp home edition and I want to create some graphic images
> with perl module.
>
> I downloaded the GD-2.30 moduel at CPAN but I can't install.
>
> the error message say that I should use libgd 2.0.28 or higher. so I
> downloaded gdwin32 at www.boutell.com
>
> but the website say that I should use ANSI C compiler. At some message, gcc
> is free and we can get c compiler at ftp://ftp.cygnus.com, but I can't get
> anything.
>
> How can I use GD module in Windows XP system?
You don't say what version of Perl you are using on your XP
system. If you are using ActiveState Perl, try:
ppm install GD
at a command prompt. That should download and install the GD
module and all the other modules it may require. Then look in
the module's docs ( perldoc GD ) and try some of the examples to
be sure it works.
--
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl
------------------------------
Date: Sat, 3 Dec 2005 00:50:58 +0100
From: "Anton van der Steen" <anton.vandersteen@chello.nl>
Subject: Perl DBD-My with SQL 5.0
Message-Id: <5584$4390dde5$d4bb4dfa$5692@news.chello.nl>
Hey guys,
I tried to make a connection with MySQL 5.0 using
Perl DBD-MySQL from ActiveState.
I got following Error message:
Client does not support authentication requested by server; consider
upgrading MySQL at client.
But upgrading to what, with what????????
That is the big question.
Looking forward to any help.
Thankx
------------------------------
Date: Fri, 02 Dec 2005 18:29:02 -0600
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Perl DBD-My with SQL 5.0
Message-Id: <hF5kf.603$_y6.1375@news.uswest.net>
Anton van der Steen wrote:
> Hey guys,
>
> I tried to make a connection with MySQL 5.0 using
> Perl DBD-MySQL from ActiveState.
>
> I got following Error message:
> Client does not support authentication requested by server; consider
> upgrading MySQL at client.
>
> But upgrading to what, with what????????
> That is the big question.
Upgrade/Install the MySQL client on your machine, which includes all of
the MySQL libraries that communicate with the MySQL server. See
http://www.mysql.com and download the MySQL client for your particular OS.
You'll probably need to upgrade/reinstall DBD-mysql, after installing
the client.
------------------------------
Date: Fri, 02 Dec 2005 20:21:34 -0500
From: Sherm Pendley <sherm@dot-app.org>
Subject: Re: Perl DBD-My with SQL 5.0
Message-Id: <m2iru7vuu9.fsf@Sherm-Pendleys-Computer.local>
"Anton van der Steen" <anton.vandersteen@chello.nl> writes:
> Hey guys,
>
> I tried to make a connection with MySQL 5.0 using
> Perl DBD-MySQL from ActiveState.
>
> I got following Error message:
> Client does not support authentication requested by server; consider
> upgrading MySQL at client.
>
> But upgrading to what, with what????????
> That is the big question.
>
> Looking forward to any help.
More of a workaround than a solution, but you can reset the password in
question to an old-style password:
mysql>set password for 'some_user'@'some_host' = OLD_PASSWORD('passwd');
The actual solution is to upgrade the client - i.e. the MySQL C library, and
the DBD::MySQL module that's linked against it - to use a newer (>= 4.1)
version of the MySQL client library. But if you're relying on pre-packaged
modules rather than building them yourself, that may not be a realistic
option for you.
Here's the relevant docs:
<http://dev.mysql.com/doc/refman/5.1/en/old-client.html>
This has nothing to do with Perl, btw - any client app that uses the MySQL
client library will face the same issue, whether it's written in Perl, C,
Python, Ruby... whatever.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Sat, 03 Dec 2005 03:26:45 GMT
From: "Todd W" <toddrw69@excite.com>
Subject: Re: URL Parsing
Message-Id: <Vf8kf.900$Zm4.862@newssvr31.news.prodigy.com>
"Francis Sylvester" <francis@nospam.com> wrote in message
news:jc4kf.125678$Es4.14897@fe2.news.blueyonder.co.uk...
> Hi,
>
> I'm trying to parse a URL string with the help of the CGI module. I'm sure
> this is really simple but I just can't seem to retrieve the first variable
> after the question mark in the URL - my code returns nothing for this
> variable - variables after this are printed as expected. I've tried
looking
> at the perldoc but I still can't figure out why this isn't working... Any
> help appreciated!
>
> Thanks,
> Francis.
>
> # Example Code
>
> use warnings;
> use strict;
> use CGI;
>
> my $URL =
>
"http://.someurl.com/somepath?test1=testresult1&test2=testresult2&test3=test
result3";
>
> my $test = new CGI($URL);
> print $test -> param('test1');
> print $test -> param('test2');
> print $test -> param('test3');
>
>
None of the constructors documented at
http://search.cpan.org/~lds/CGI.pm-3.11/CGI.pm support accepting a full URL
as an argument. What would make you think what you are trying to do is
possible?
CGI.pm does provide a constructor that accepts a query string as an
argument, so you could pass the part after the "?" to ->new and your code
would work as desired.
Todd W.
------------------------------
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 8725
***************************************