in reply to newbie quest for Image::Grab
hope that helps,# Get the MD5 fingerprint of the file. open(IMAGE, "<$imagedir/$imagename") || die "Can't open $imagedir/$ima +gename\n"; $context = new MD5; $context->MD5::reset(); $context->MD5::add(<IMAGE>); $filehash = $context->hexdigest(); close(IMAGE); # Get the MD5 fingerprint of the new picture open(TEMP, ">/tmp/getcomics.$$") || die "Can't open tempfile\n"; print TEMP $rc->content(); close(TEMP); open(TEMP, "</tmp/getcomics.$$") || die "Can't open tempfile\n"; $context->MD5::reset(); $context->MD5::add(<TEMP>); $newhash = $context->hexdigest(); close(TEMP); unlink "/tmp/getcomics.$$"; # See if the old info is different from the new. if( $newhash ne $filehash ) { # strut your funky stuff *here* }
|
|---|