DBD::google, a module that lets you search Google like a database source in DBI, was released a few days ago.
Still in its early stage of development, the disappointing thing is that the module does not use warnings :-( but on the bright side you can query the Internet in DBI style.
It's worth a try.
#!/usr/bin/perl # Notice. No warnings. Sigh! use strict; use DBI; my $query = "@ARGV" || "PerlMonks"; my $sql = qq{ SELECT title, URL FROM google WHERE q = "$query" }; my $dbh = DBI->connect("dbi:google:", (glob "~/.googlekey"), undef, {RaiseError=>1, lr=>['en'], oe=>'utf-8', ie=>'utf-8'}); for (@{$dbh->selectall_arrayref($sql)}) { print "Title ", $_->[0], "\n", "URL ", $_->[1], "\n\n"; } $dbh->disconnect();
The same author has released Tie::Google a module to use tied hashes to fetch Google queries.
Both modules are a front-end to Net::Google.
_ _ _ _ (_|| | |(_|>< _|

Replies are listed 'Best First'.
Re: Google as database source
by jryan (Vicar) on Feb 19, 2003 at 16:19 UTC

    Why does it matter that the module doesn't use warnings? Many CPAN modules turn warnings off; why would this be different?

    If it really matters to you, why not just add a use warnings; line in yourself?

      I too have started tending towards this view of things. strict is very important for anything beyond a 5-liner, but given that, warnings is really not as big a deal.

      Quite a few warnings attempt to detect problems strict already covers. F.ex I've come to loathe the "used only once" warning. It has caught a typo for me maybe once (if at all - I doubt it), in contrast to the innumerable times I had to mention a correctly spelled variable twice just to make the durn thing shut up. Similarly, while I generally appreciate the warnings about undef values, it is a real pain in the rear to account for them in some cases - for me, usually in eq/ne comparisons where I explicitly want to tolerate undefs.

      warnings are essential on the occasions you're not using strict; I tend to write oneliners with warnings enabled which has saved me from rather painful headaches in some rare occasions. But with strict enabled, I feel a lot of warnings become liabilities. That's my take on it these days, now that my frustration threshold has been passed..

      I am very careful and hesitant to disable strictures and will try to do things another way if there is one, but I've basically been fed up with some warnings enough that I just switch them off when it's most convenient thing to do nowadays. Mind you, I don't usually disable them wholesale, I use the warnings pragma where I know that what I'm doing is ok.

      At the same time I can't stress enough how important I consider strict to be. Unless you're doing seriously funky Damian-class stuff, you should enable strictures without even thinking about it, for anything past a oneliner. It has caught so many of my typos, thinkos, or other bonehead moments I am more than willing to pay the very rare and then usually trivial price of extra effort to make it happy.

      Makeshifts last the longest.

      It looks like I've started some sort of a theoretical dispute :).

      Sorry about that, fellows.

      What I meant is that warnings are important, and they should have be used, at least in the installation test scripts, especially in early stages of development.
      Why it is important should be clear immediately if you try to run the example script with the "-w" in the shebang. You get an annoying list of "uninitialized value" this, "Drive has not implemented DESTROY for DBI" that.
      My point is that such trivial mistakes would have been easy to catch if a "-w" was used in the tests.
      I didn't mean to blame anybody, just to "warn" (pun unintended) the readers about possible drawbacks if they wanted to have a look at the module.

      Anyway, just to have a happy ending, :) I've contacted the author. He has acknowledged the problems and he's going to take care of them.
       _  _ _  _  
      (_|| | |(_|><
       _|   
      
Re: Google as database source
by gmpassos (Priest) on Mar 17, 2003 at 06:23 UTC
    Just to say: Good tip! ;-P

    Is not every day that we saw new things!

    Graciliano M. P.
    "The creativity is the expression of the liberty".