Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: URLs' Checking (Search Engines)

by CharlesClarkson (Curate)
on Feb 01, 2002 at 13:42 UTC ( #142677=note: print w/ replies, xml ) Need Help??


in reply to URLs' Checking (Search Engines)

It might be faster and more accurate if $count was derived from keys %sites instead of incrementing it. This is especially true if some $siteid is not unique.

$count=0; $sth->bind_columns(\($siteid, $imageurl)); while($sth->fetch()) { $sites{$siteid}=$imageurl; $count++; }
Would become:
$sth->bind_columns(\($siteid, $imageurl)); while($sth->fetch()) { $sites{$siteid} = $imageurl; } $count = keys %sites;

$flag, $type, and $size don't have to be file scoped. If you reverse the logic of $flag and change its name to $error, the foreach block becomes easier to read.

my $error = 1; if ( my($type, $size) = ( head($imageurl) )[0, 1] ) { if ($size < 25600) { if($type =~ /image\/(gif|jpeg)/) { print "OK ($size bytes, $type)\n"; $error = 0; } else { print "Wrong file type ($type, must be image/gif or image/ +jpeg)\n"; } } else { print "Image size exceeded ($size bytes, should be < 25600)\n" +; } } else { print "Error\n"; } if ( $error ) { print FILE "update big_ass_table set imagedown=imagedown+1 where s +iteid=$siteid and imageurl='$imageurl';\n"; } else { print FILE "update big_ass_table set imagedown=0 where siteid=$sit +eid and imageurl='$imageurl';\n"; }



HTH,
Charles K. Clarkson
Clarkson Energy Homes, Inc.
254 968-8328


Comment on Re: URLs' Checking (Search Engines)
Select or Download Code
Re: Re: URLs' Checking (Search Engines)
by nikos (Scribe) on Feb 05, 2002 at 00:16 UTC
    That's true. Thanks for your suggestions.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (12)
As of 2014-04-18 17:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (471 votes), past polls