Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: DBD::Google " SELECT * " does not return URL.

by dakkar (Hermit)
on Feb 05, 2005 at 15:12 UTC ( #428326=note: print w/ replies, xml ) Need Help??


in reply to DBD::Google " SELECT * " does not return URL.

It's a funny bug in DBD::Google. If you look at the parser you'll see that @default_columns contains URL, but a few lines later it gets changed in this for loop:

for my $dc (@default_columns) { $dc =~ s/([A-Z])/_\l$1/g; $allowed_columns{$dc} = 1; }

so that URL becomes _u_r_l.

I am not going to test it, but I'd change the loop to:

for my $dc (@default_columns) { my $t; ($t=$dc) =~ s/([A-Z])/_\l$1/g; $allowed_columns{$t} = 1; }
-- 
        dakkar - Mobilis in mobile

Most of my code is tested...

Perl is strongly typed, it just has very few types (Dan)


Comment on Re: DBD::Google " SELECT * " does not return URL.
Select or Download Code
Re^2: DBD::Google " SELECT * " does not return URL.
by superfrink (Curate) on Feb 05, 2005 at 20:35 UTC
    Ah, interesting. So the loop is there to change "cachedSize" to "cached_size" but because "URL" is all uppercase it comes out "_u_r_l".

    The recommended change does indeed cause the result to include a key named "URL" which points to the URL string.

    Changeing the default column list to include "url" instead of "URL" also seems to work and the result includes a key with the lowercase name "url".

    I have not read google's API or most of the DBD::Google code so I'm not sure if there are any other side effects. I think I'll send the author an email and see what he thinks is the best fix. (Maybe just specifying the URL in the query.)

    Thanks, Chad

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://428326]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2014-07-26 13:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (177 votes), past polls