[31008] in Perl-Users-Digest
Perl-Users Digest, Issue: 2253 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 5 21:09:50 2009
Date: Thu, 5 Mar 2009 18:09:18 -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, 5 Mar 2009 Volume: 11 Number: 2253
Today's topics:
"system" with [ ] in filename <root@localhost>
Re: "system" with [ ] in filename <1usa@llenroc.ude.invalid>
Re: "system" with [ ] in filename <root@localhost>
Re: "system" with [ ] in filename <1usa@llenroc.ude.invalid>
Re: "system" with [ ] in filename <1usa@llenroc.ude.invalid>
Re: "system" with [ ] in filename <root@localhost>
Re: "system" with [ ] in filename <ben@morrow.me.uk>
Re: "system" with [ ] in filename <1usa@llenroc.ude.invalid>
Re: "system" with [ ] in filename <maustin@firstdbasource.com>
Re: "system" with [ ] in filename <1usa@llenroc.ude.invalid>
Re: "system" with [ ] in filename <root@localhost>
Access denied in remote mysql connection wes.tibular@yahoo.com
Re: Access denied in remote mysql connection <tim@burlyhost.com>
Re: Access denied in remote mysql connection wes.tibular@yahoo.com
Re: Access denied in remote mysql connection <tim@burlyhost.com>
Can one hash variable refer to another? <mrstevegross@gmail.com>
Re: Can one hash variable refer to another? <glex_no-spam@qwest-spam-no.invalid>
Re: Can one hash variable refer to another? <mrstevegross@gmail.com>
Re: Can one hash variable refer to another? (Tim McDaniel)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 5 Mar 2009 23:16:04 +0100
From: "Richard" <root@localhost>
Subject: "system" with [ ] in filename
Message-Id: <49b04f21$0$3118$dbd4d001@news.euronet.nl>
Hi all,
this is keeping me awake for the last days. Can someone shed some
light, or point me somewhere else if appropriate?
(Windows XP SP1, Perl v5.8.7 MSWin32-x86-multi-thread)
In a perl script I do this:
$cmd = "convert \"$source\" -resize \"160x160>\"
\"${thumbnail_prefix}${photonr}\"";
print "Command for shell is: ".$cmd."\n";
system ($cmd);
This works fine, as long as ${photonr} does NOT contain any square
brackets.
If ${photonr} turns out to be for example: IMG_8699[1].jpg then the
resulting system command takes an incredible lpng time to complete,
something like 5 to 10 minutes. (it does complete in the end...)
If no [] are present, then all is done in around half a second.
This is printed to the screen and looks ok to me:
Command for shell is: convert "C:\wwwroot\images\Import/104 Weekly Pix
from Supplier/07-090225 Handicraft Fair2/IMG_8699.jpg" -resize
"160x160>" "C:\wwwroot\images\ThumbNails\th_IMG_8699[5].jpg"
The question now is:
Do the [ ] have a special meaning to Perl in this context?
Or should I look for the problem in the way Windows handles the [5] in
the filename?
Or anything else to investigate?
I am sort of stuck. :(
Some more info:
The target directory has a lot of files, around 200.000
I used File Monitor (Sysinternals) to trace, and see that this
"convert" process is checking LOTS of files but can not find those.
Its mostly looking in the current dir (where the script is). Is this
an indication of anything?
This has been working for over a year, but has never given this
strange behaviour ( as far as I know !!) .
Anyone a hint?
Muchos thanks already,
Richard
------------------------------
Date: Thu, 05 Mar 2009 23:15:49 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: "system" with [ ] in filename
Message-Id: <Xns9BC5B9C728EF8asu1cornelledu@127.0.0.1>
"Richard" <root@localhost> wrote in news:49b04f21$0$3118$dbd4d001
@news.euronet.nl:
> Hi all,
>
> this is keeping me awake for the last days. Can someone shed some
> light, or point me somewhere else if appropriate?
>
> (Windows XP SP1, Perl v5.8.7 MSWin32-x86-multi-thread)
>
> In a perl script I do this:
>
> $cmd = "convert \"$source\" -resize \"160x160>\"
> \"${thumbnail_prefix}${photonr}\"";
> print "Command for shell is: ".$cmd."\n";
> system ($cmd);
>
> This works fine, as long as ${photonr} does NOT contain any square
> brackets.
> If ${photonr} turns out to be for example: IMG_8699[1].jpg then the
> resulting system command takes an incredible lpng time to complete,
> something like 5 to 10 minutes. (it does complete in the end...)
> If no [] are present, then all is done in around half a second.
What happens if you bypass the shell?
system convert => $source, '-resize', '160x160',
$thumbnail_prefix.$photonr;
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/
------------------------------
Date: Fri, 6 Mar 2009 00:31:55 +0100
From: "Richard" <root@localhost>
Subject: Re: "system" with [ ] in filename
Message-Id: <49b060e8$0$24239$dbd49001@news.euronet.nl>
"A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message
news:Xns9BC5B9C728EF8asu1cornelledu@127.0.0.1...
> "Richard" <root@localhost> wrote in news:49b04f21$0$3118$dbd4d001
> @news.euronet.nl:
>
>> Hi all,
>>
>> this is keeping me awake for the last days. Can someone shed some
>> light, or point me somewhere else if appropriate?
>>
>> (Windows XP SP1, Perl v5.8.7 MSWin32-x86-multi-thread)
>>
>> In a perl script I do this:
>>
>> $cmd = "convert \"$source\" -resize \"160x160>\"
>> \"${thumbnail_prefix}${photonr}\"";
>> print "Command for shell is: ".$cmd."\n";
>> system ($cmd);
>>
>> This works fine, as long as ${photonr} does NOT contain any square
>> brackets.
>> If ${photonr} turns out to be for example: IMG_8699[1].jpg then the
>> resulting system command takes an incredible lpng time to complete,
>> something like 5 to 10 minutes. (it does complete in the end...)
>> If no [] are present, then all is done in around half a second.
>
> What happens if you bypass the shell?
>
> system convert => $source, '-resize', '160x160',
> $thumbnail_prefix.$photonr;
>
> Sinan
>
> --
> A. Sinan Unur <1usa@llenroc.ude.invalid>
> (remove .invalid and reverse each component for email address)
>
> comp.lang.perl.misc guidelines on the WWW:
> http://www.rehabitation.com/clpmisc/
Hi,
I have just tried to execute the command in the shell directly, and
exactly the same thing happens :(
So, it has now become a shell / Windows issue, not Perl.
Thanks anyway.
Richard
------------------------------
Date: Thu, 05 Mar 2009 23:37:14 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: "system" with [ ] in filename
Message-Id: <Xns9BC5BD6864764asu1cornelledu@127.0.0.1>
"Richard" <root@localhost> wrote in news:49b060e8$0$24239$dbd49001
@news.euronet.nl:
>
> "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message
> news:Xns9BC5B9C728EF8asu1cornelledu@127.0.0.1...
>> "Richard" <root@localhost> wrote in news:49b04f21$0$3118$dbd4d001
>> @news.euronet.nl:
>>
...
>>> In a perl script I do this:
>>>
>>> $cmd = "convert \"$source\" -resize \"160x160>\"
>>> \"${thumbnail_prefix}${photonr}\"";
>>> print "Command for shell is: ".$cmd."\n";
>>> system ($cmd);
...
>>
>> What happens if you bypass the shell?
>>
>> system convert => $source, '-resize', '160x160',
>> $thumbnail_prefix.$photonr;
[ don't quote sigs ]
>
> Hi,
> I have just tried to execute the command in the shell directly, and
> exactly the same thing happens :(
> So, it has now become a shell / Windows issue, not Perl.
So, did you try bypassing the shell?
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/
------------------------------
Date: Thu, 05 Mar 2009 23:48:19 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: "system" with [ ] in filename
Message-Id: <Xns9BC5BF49B46BDasu1cornelledu@127.0.0.1>
"Richard" <root@localhost> wrote in news:49b060e8$0$24239$dbd49001
@news.euronet.nl:
>
> "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message
> news:Xns9BC5B9C728EF8asu1cornelledu@127.0.0.1...
>> "Richard" <root@localhost> wrote in news:49b04f21$0$3118$dbd4d001
>> @news.euronet.nl:
>>
...
>>> If no [] are present, then all is done in around half a second.
...
> I have just tried to execute the command in the shell directly, and
> exactly the same thing happens :(
> So, it has now become a shell / Windows issue, not Perl.
cmd /?
The special characters that require quotes are:
<space>
&()[]{}^=;!'+,`~
I would still recommend using the list argument to system to bypass the
shell.
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/
------------------------------
Date: Fri, 6 Mar 2009 00:58:16 +0100
From: "Richard" <root@localhost>
Subject: Re: "system" with [ ] in filename
Message-Id: <49b06715$0$24259$dbd49001@news.euronet.nl>
"A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message
news:Xns9BC5BD6864764asu1cornelledu@127.0.0.1...
> "Richard" <root@localhost> wrote in news:49b060e8$0$24239$dbd49001
> @news.euronet.nl:
>
>>
>> "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message
>> news:Xns9BC5B9C728EF8asu1cornelledu@127.0.0.1...
>>> "Richard" <root@localhost> wrote in news:49b04f21$0$3118$dbd4d001
>>> @news.euronet.nl:
>>>
> ...
>>>> In a perl script I do this:
>>>>
>>>> $cmd = "convert \"$source\" -resize \"160x160>\"
>>>> \"${thumbnail_prefix}${photonr}\"";
>>>> print "Command for shell is: ".$cmd."\n";
>>>> system ($cmd);
> ...
>>>
>>> What happens if you bypass the shell?
>>>
>>> system convert => $source, '-resize', '160x160',
>>> $thumbnail_prefix.$photonr;
>
> [ don't quote sigs ]
>
>>
>> Hi,
>> I have just tried to execute the command in the shell directly, and
>> exactly the same thing happens :(
>> So, it has now become a shell / Windows issue, not Perl.
>
> So, did you try bypassing the shell?
system convert => $source, '-resize', '160x160>',
$thumbnail_prefix.$photonr;
gives exactly the same result. :(
Richard
------------------------------
Date: Fri, 6 Mar 2009 00:18:12 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: "system" with [ ] in filename
Message-Id: <4n6686-it1.ln1@osiris.mauzo.dyndns.org>
Quoth "A. Sinan Unur" <1usa@llenroc.ude.invalid>:
>
> I would still recommend using the list argument to system to bypass the
> shell.
The OP is on Win32, and you can't bypass the shell on Win32. Win32
doesn't have an argc/argv-style calling convention, instead parameter
splitting happens inside the libc startup code. system LIST under Win32
will attempt to quote the arguments passed correctly, but it's not
any safer than system STRING with correct quoting.
Ben
------------------------------
Date: Fri, 06 Mar 2009 00:37:55 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: "system" with [ ] in filename
Message-Id: <Xns9BC5C7B243088asu1cornelledu@127.0.0.1>
"Richard" <root@localhost> wrote in news:49b06715$0$24259$dbd49001
@news.euronet.nl:
>
> "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message
> news:Xns9BC5BD6864764asu1cornelledu@127.0.0.1...
>> "Richard" <root@localhost> wrote in news:49b060e8$0$24239$dbd49001
>> @news.euronet.nl:
>>
>>>
>>> "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message
>>> news:Xns9BC5B9C728EF8asu1cornelledu@127.0.0.1...
>>>> "Richard" <root@localhost> wrote in news:49b04f21$0$3118$dbd4d001
>>>> @news.euronet.nl:
>>>>
>> ...
>>>>> In a perl script I do this:
>>>>>
>>>>> $cmd = "convert \"$source\" -resize \"160x160>\"
>>>>> \"${thumbnail_prefix}${photonr}\"";
>>>>> print "Command for shell is: ".$cmd."\n";
>>>>> system ($cmd);
>> ...
>>>>
>>>> What happens if you bypass the shell?
>>>>
>>>> system convert => $source, '-resize', '160x160',
>>>> $thumbnail_prefix.$photonr;
>>
>> [ don't quote sigs ]
>>
>>>
>>> Hi,
>>> I have just tried to execute the command in the shell directly, and
>>> exactly the same thing happens :(
>>> So, it has now become a shell / Windows issue, not Perl.
>>
>> So, did you try bypassing the shell?
>
> system convert => $source, '-resize', '160x160>',
> $thumbnail_prefix.$photonr;
>
> gives exactly the same result. :(
I am unable to replicate the problem:
C:\DOCUME~1\asu1\LOCALS~1\Temp\q> cat c.pl
#!/usr/bin/perl
use strict;
use warnings;
my $source = 'test.jpg';
my $target = 'test[1].jpg';
my @cmd = (convert => $source, -resize => '1024x1024', $target);
print "@cmd\n";
system @cmd;
C:\DOCUME~1\asu1\LOCALS~1\Temp\q> timethis c.pl
convert test.jpg -resize 1024x1024 test[1].jpg
TimeThis : Command Line : c.pl
TimeThis : Elapsed Time : 00:00:00.546
C:\DOCUME~1\asu1\LOCALS~1\Temp\q> cat c.pl
#!/usr/bin/perl
use strict;
use warnings;
my $source = 'test.jpg';
my $target = 'test[1].jpg';
my $cmd = qq{convert $source -resize 1024x1024 $target};
print "$cmd\n";
system $cmd;
C:\DOCUME~1\asu1\LOCALS~1\Temp\q> timethis c.pl
convert test.jpg -resize 1024x1024 test[1].jpg
TimeThis : Command Line : c.pl
TimeThis : Elapsed Time : 00:00:00.531
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/
------------------------------
Date: Thu, 05 Mar 2009 18:44:42 -0600
From: Michael Austin <maustin@firstdbasource.com>
Subject: Re: "system" with [ ] in filename
Message-Id: <4o_rl.24253$ZP4.2625@nlpi067.nbdc.sbc.com>
Richard wrote:
> Hi all,
>
> this is keeping me awake for the last days. Can someone shed some
> light, or point me somewhere else if appropriate?
>
> (Windows XP SP1, Perl v5.8.7 MSWin32-x86-multi-thread)
>
> In a perl script I do this:
>
> $cmd = "convert \"$source\" -resize \"160x160>\"
> \"${thumbnail_prefix}${photonr}\"";
> print "Command for shell is: ".$cmd."\n";
> system ($cmd);
>
> This works fine, as long as ${photonr} does NOT contain any square
> brackets.
> If ${photonr} turns out to be for example: IMG_8699[1].jpg then the
> resulting system command takes an incredible lpng time to complete,
> something like 5 to 10 minutes. (it does complete in the end...)
> If no [] are present, then all is done in around half a second.
>
> This is printed to the screen and looks ok to me:
> Command for shell is: convert "C:\wwwroot\images\Import/104 Weekly Pix
> from Supplier/07-090225 Handicraft Fair2/IMG_8699.jpg" -resize
> "160x160>" "C:\wwwroot\images\ThumbNails\th_IMG_8699[5].jpg"
>
> The question now is:
> Do the [ ] have a special meaning to Perl in this context?
> Or should I look for the problem in the way Windows handles the [5] in
> the filename?
> Or anything else to investigate?
> I am sort of stuck. :(
>
> Some more info:
> The target directory has a lot of files, around 200.000
> I used File Monitor (Sysinternals) to trace, and see that this
> "convert" process is checking LOTS of files but can not find those.
> Its mostly looking in the current dir (where the script is). Is this
> an indication of anything?
>
> This has been working for over a year, but has never given this
> strange behaviour ( as far as I know !!) .
>
> Anyone a hint?
>
> Muchos thanks already,
> Richard
>
>
an easier solution would be to move this to Linux whereby you would not
have this problem ;)
------------------------------
Date: Fri, 06 Mar 2009 00:47:32 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: "system" with [ ] in filename
Message-Id: <Xns9BC5C9537C48Basu1cornelledu@127.0.0.1>
Ben Morrow <ben@morrow.me.uk> wrote in
news:4n6686-it1.ln1@osiris.mauzo.dyndns.org:
>
> Quoth "A. Sinan Unur" <1usa@llenroc.ude.invalid>:
>>
>> I would still recommend using the list argument to system to bypass
>> the shell.
>
> The OP is on Win32, and you can't bypass the shell on Win32. Win32
> doesn't have an argc/argv-style calling convention, instead parameter
> splitting happens inside the libc startup code. system LIST under
> Win32 will attempt to quote the arguments passed correctly, but it's
> not any safer than system STRING with correct quoting.
I am perplexed then:
#!/usr/bin/perl
use strict;
use warnings;
system 'gvim %temp%';
scalar <STDIN>;
system gvim => '%temp%';
__END__
The first call opens the directory browser in
C:/Documents and Settings/asu1/Local Settings/Temp
The second call opens and allows me to write to the file
C:\DOCUME~1\asu1\LOCALS~1\Temp\%temp%
I always took this behavior to mean that system with a list argument
bypassed the shell on Win32 systemsas well.
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/
------------------------------
Date: Fri, 6 Mar 2009 02:26:36 +0100
From: "Richard" <root@localhost>
Subject: Re: "system" with [ ] in filename
Message-Id: <49b07bc9$0$22129$dbd43001@news.euronet.nl>
"Michael Austin" <maustin@firstdbasource.com> wrote in message
news:4o_rl.24253$ZP4.2625@nlpi067.nbdc.sbc.com...
> Richard wrote:
>> Hi all,
>>
>> this is keeping me awake for the last days. Can someone shed some
>> light, or point me somewhere else if appropriate?
>>
>> (Windows XP SP1, Perl v5.8.7 MSWin32-x86-multi-thread)
>>
>> In a perl script I do this:
>>
>> $cmd = "convert \"$source\" -resize \"160x160>\"
>> \"${thumbnail_prefix}${photonr}\"";
>> print "Command for shell is: ".$cmd."\n";
>> system ($cmd);
>>
>> This works fine, as long as ${photonr} does NOT contain any square
>> brackets.
>> If ${photonr} turns out to be for example: IMG_8699[1].jpg then the
>> resulting system command takes an incredible lpng time to complete,
>> something like 5 to 10 minutes. (it does complete in the end...)
>> If no [] are present, then all is done in around half a second.
>>
>> This is printed to the screen and looks ok to me:
>> Command for shell is: convert "C:\wwwroot\images\Import/104 Weekly
>> Pix from Supplier/07-090225 Handicraft Fair2/IMG_8699.jpg" -resize
>> "160x160>" "C:\wwwroot\images\ThumbNails\th_IMG_8699[5].jpg"
>>
>> The question now is:
>> Do the [ ] have a special meaning to Perl in this context?
>> Or should I look for the problem in the way Windows handles the [5]
>> in the filename?
>> Or anything else to investigate?
>> I am sort of stuck. :(
>>
>> Some more info:
>> The target directory has a lot of files, around 200.000
>> I used File Monitor (Sysinternals) to trace, and see that this
>> "convert" process is checking LOTS of files but can not find those.
>> Its mostly looking in the current dir (where the script is). Is
>> this an indication of anything?
>>
>> This has been working for over a year, but has never given this
>> strange behaviour ( as far as I know !!) .
>>
>> Anyone a hint?
>>
>> Muchos thanks already,
>> Richard
>
>
> an easier solution would be to move this to Linux whereby you would
> not have this problem ;)
Ok, deal!
Come over and you make it work on Linux.
The Linux machine is right next to this one, so you need only one
chair.
I have now narrowed it down to the "convert.exe". It is the
ImageMagick convert.
Maybe I try the PerlMagick module see if it makes a diff...
Richard
------------------------------
Date: Thu, 5 Mar 2009 12:39:08 -0800 (PST)
From: wes.tibular@yahoo.com
Subject: Access denied in remote mysql connection
Message-Id: <0922a6f6-61ba-4d8f-8027-285aaeb5073f@v18g2000pro.googlegroups.com>
Forgive me if this is not the appropriate forum for this question.
I have installed DBI, and DBD::mysqlpp (couln't get DBD::mysql to
compile) on my system (with the requisite Net::MySql). When i connect
to my local mysql database, things are fine.
When i attempt to connect to a remote mysql database, i get:
DBI connect('database=ossinv;host=remotehost','username',...) failed:
Access denied for user: '@localhost' (Using password: NO) at /usr/
perl5/site_perl/5.8.4/DBD/mysqlPP.pm line 109
at ./test2.pl line 9
cannot open ossinv: at ./test2.pl line 9.
The relevant code is:
#!/usr/bin/perl
#
# test.pl
#
#
use DBI;
$dbh_OSS = DBI->connect
('DBI:mysqlPP:database=ossinv;host=remotehost','username','password')
or die "cannot open ossinv:$!";
$SQL = "select samid, turnover_complete from iso where host like
'%73odsp%'";
# print "$SQL<BR>\n\n";
$sth_UE = $dbh_UE->prepare($SQL);
$sth_UE->execute();
while ((@row) = $sth_UE->fetchrow_array) {
print "$row[0]:\n";
foreach $item (@row) {
print "$item\t";
}
print "\n";
}
If i use mysql itself (mysql -h remotehost -u username) it connects
just fine, so i know the username and password work across my network.
I have verified that the username and password are being passed to
mysqlpp, which passes it in turn to Net:MySql, but the remote server
does not seem to receive either the username (Access denied for user:
'@localhost' ) or the password (Using password: NO). This same code
opens a local database just fine (with appropriate changes to the
host, username, and password values).
Aside from the -w, and strict stuff, what am i missing?
------------------------------
Date: Thu, 05 Mar 2009 12:57:29 -0800
From: Tim Greer <tim@burlyhost.com>
Subject: Re: Access denied in remote mysql connection
Message-Id: <_0Xrl.114788$6r1.79132@newsfe19.iad>
wes.tibular@yahoo.com wrote:
> Forgive me if this is not the appropriate forum for this question.
>
> I have installed DBI, and DBD::mysqlpp (couln't get DBD::mysql to
> compile) on my system (with the requisite Net::MySql). When i connect
> to my local mysql database, things are fine.
>
> When i attempt to connect to a remote mysql database, i get:
>
> DBI connect('database=ossinv;host=remotehost','username',...) failed:
> Access denied for user: '@localhost' (Using password: NO) at /usr/
That seems to indicate there was no username passed. Also, it says
"localhost", yet you said this fails when you try to connect remotely.
Localhost is local (not remote), so your problem and question are
confusing. Anyway, if the script connects fine locally, then it's
simply a matter of passing the right, existing host and database names
and login credentials, which probably isn't a Perl related question.
--
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!
------------------------------
Date: Thu, 5 Mar 2009 14:48:38 -0800 (PST)
From: wes.tibular@yahoo.com
Subject: Re: Access denied in remote mysql connection
Message-Id: <5acc7cee-52b4-4496-8aea-27f8ca777969@k9g2000prh.googlegroups.com>
On Mar 5, 12:57=A0pm, Tim Greer <t...@burlyhost.com> wrote:
> wes.tibu...@yahoo.com wrote:
> > Forgive me if this is not the appropriate forum for this question.
>
> > I have installed DBI, and DBD::mysqlpp (couln't get DBD::mysql to
> > compile) on my system (with the requisite Net::MySql). =A0When i connec=
t
> > to my local mysql database, things are fine.
>
> > When i attempt to connect to a remote mysql database, i get:
>
> > DBI connect('database=3Dossinv;host=3Dremotehost','username',...) faile=
d:
> > Access denied for user: '@localhost' (Using password: NO) at /usr/
>
> That seems to indicate there was no username passed. Also, it says
> "localhost", yet you said this fails when you try to connect remotely.
> Localhost is local (not remote), so your problem and question are
> confusing. =A0
@localhost is a redacted host name. it is what the remote connection
is returning in the error message
> Anyway, if the script connects fine locally, then it's
> simply a matter of passing the right, existing host and database names
> and login credentials, which probably isn't a Perl related question.
It's a question about what the perl modules DBD::mysqlpp and
Net::Mysql are doing that leads it to not pass what i give them. In
the code, the username and password are being passed to mysqlpp, and i
have verified that Net:Mysql gets them, I have no control over what
happens from there, but it seems that the module is dropping it. Was
hoping to hear from someone using these modules that has seen the
problem before and can clue me in.
Thanks for the response.
> --
> Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
> Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
> and Custom Hosting. =A024/7 support, 30 day guarantee, secure servers.
> Industry's most experienced staff! -- Web Hosting With Muscle!
------------------------------
Date: Thu, 05 Mar 2009 15:53:15 -0800
From: Tim Greer <tim@burlyhost.com>
Subject: Re: Access denied in remote mysql connection
Message-Id: <OBZrl.91051$2h5.74555@newsfe11.iad>
wes.tibular@yahoo.com wrote:
> On Mar 5, 12:57 pm, Tim Greer <t...@burlyhost.com> wrote:
>> wes.tibu...@yahoo.com wrote:
>> > Forgive me if this is not the appropriate forum for this question.
>>
>> > I have installed DBI, and DBD::mysqlpp (couln't get DBD::mysql to
>> > compile) on my system (with the requisite Net::MySql). When i
>> > connect to my local mysql database, things are fine.
>>
>> > When i attempt to connect to a remote mysql database, i get:
>>
>> > DBI connect('database=ossinv;host=remotehost','username',...)
>> > failed: Access denied for user: '@localhost' (Using password: NO)
>> > at /usr/
>>
>> That seems to indicate there was no username passed. Also, it says
>> "localhost", yet you said this fails when you try to connect
>> remotely. Localhost is local (not remote), so your problem and
>> question are confusing.
>
> @localhost is a redacted host name. it is what the remote connection
> is returning in the error message
Be sure to paste the actual error message, or are you saying this very
literally was, showing @localhost with no username? That just doesn't
seem right is all.
>> Anyway, if the script connects fine locally, then it's
>> simply a matter of passing the right, existing host and database
>> names and login credentials, which probably isn't a Perl related
>> question.
>
> It's a question about what the perl modules DBD::mysqlpp and
> Net::Mysql are doing that leads it to not pass what i give them. In
> the code, the username and password are being passed to mysqlpp, and i
> have verified that Net:Mysql gets them, I have no control over what
> happens from there, but it seems that the module is dropping it. Was
> hoping to hear from someone using these modules that has seen the
> problem before and can clue me in.
>
> Thanks for the response.
Try using RaiseError, such as:
my $dbh = DBI->connect("dbi:mysqlPP:database=$db;host=$host",
$user, $password, { RaiseError => 1 }
);
That example, such as the one you posted as trying, seems to be correct.
If you can connect using mysql on the command line, then it should
work, provided it uses the default port (3306), if it's something else,
just pass the port= value.
Examples from the docs:
my $dsn = "dbi:mysqlPP:$database";
my $dsn = "dbi:mysqlPP:database=$database;host=$hostname";
my $dsn = "dbi:mysqlPP:database=$database;host=$hostname;port=$port";
my $dbh = DBI->connect($dsn, $user, $password);
So:
my $dbh = DBI->connect($dsn, $user, $password, { RaiseError => 1 });
Just to confirm, you can definitely connect from the command line with:
mysql -hHOST -uUSER database -pPASSWORD
from that system to the remote server?
<Also, please don't quote signatures, especially below your own text and
at the end of the post>
--
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!
------------------------------
Date: Thu, 5 Mar 2009 13:56:56 -0800 (PST)
From: mrstevegross <mrstevegross@gmail.com>
Subject: Can one hash variable refer to another?
Message-Id: <1fc687d5-691c-49b8-a4fd-fe30862fe385@x13g2000yqf.googlegroups.com>
I'm trying to figure out if one hash value can refer to another value
from the same hash. For instance:
my $hsh = {
a => 1,
b => $hsh->{a} };
print $hsh->{b}; # should print 1, but doesn't
Is there a way to make this work?
Thanks,
--Steve
------------------------------
Date: Thu, 05 Mar 2009 16:03:29 -0600
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Can one hash variable refer to another?
Message-Id: <49b04c32$0$48229$815e3792@news.qwest.net>
mrstevegross wrote:
> I'm trying to figure out if one hash value can refer to another value
> from the same hash. For instance:
>
> my $hsh = {
> a => 1,
> b => $hsh->{a} };
$hsh->{a} isn't defined yet.
If you had
use strict;
It would have given you an error.
>
> print $hsh->{b}; # should print 1, but doesn't
>
> Is there a way to make this work?
my $hsh;
$hsh->{ 'a' } = 1;
$hsh->{ 'b' } = $hsh->{ 'a' };
print $hsh->{b};
#fyi
$hsh->{ 'a' } = 4;
print $hsh->{b};
------------------------------
Date: Thu, 5 Mar 2009 14:22:26 -0800 (PST)
From: mrstevegross <mrstevegross@gmail.com>
Subject: Re: Can one hash variable refer to another?
Message-Id: <9340a21b-9722-4beb-a083-e71b67500c64@j39g2000yqn.googlegroups.com>
>...
> print $hsh->{b};
Thanks for the info,
--Steve
------------------------------
Date: Thu, 5 Mar 2009 22:55:20 +0000 (UTC)
From: tmcd@panix.com (Tim McDaniel)
Subject: Re: Can one hash variable refer to another?
Message-Id: <gopl8o$h25$1@reader1.panix.com>
In article <49b04c32$0$48229$815e3792@news.qwest.net>,
J. Gleixner <glex_no-spam@qwest-spam-no.invalid> wrote:
>mrstevegross wrote:
>> I'm trying to figure out if one hash value can refer to another value
>> from the same hash. For instance:
>>
>> my $hsh = {
>> a => 1,
>> b => $hsh->{a} };
>
>$hsh->{a} isn't defined yet.
>
>If you had
>
>use strict;
>
>It would have given you an error.
There's actually two problems with the code.
For one thing, it isn't declared yet. As "man perlsub" says, in the
"Private Variables via my()" section (in Perl 5.8.8, at least),
The declared variable is not introduced (is not visible) until after
the current statement. Thus,
my $x = $x;
can be used to initialize a new $x with the value of the old $x,
and the expression
my $x = 123 and $x == 123
is false unless the old $x happened to have the value 123.
That's why the error message under "use strict" is
Global symbol "$hsh" requires explicit package name at ...
$hsh isn't visible until after the semicolon in the quoted text
above.
If you declare $hsh in one statement, thus making it visible, and then
assign it in the next, as in
$ perl -w -e 'use strict;
my $hsh;
$hsh = {
a => 1,
b => $hsh->{a} };
print $hsh->{b}, "\n"'
it STILL doesn't work. Perl evaluates the entire right-hand side
before assigning the entire anonymous hash {...} value result to the
left-hand side. So $hsh->{a} gets evaluated, producing undef, before
$hsh is assigned to, giving element "a" a value. So the error message
under -w this time is
Use of uninitialized value in print at -e line 6.
--
Tim McDaniel, tmcd@panix.com
------------------------------
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 2253
***************************************