Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

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)

Replies are listed 'Best First'.
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?

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2022-01-27 21:20 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (71 votes). Check out past polls.