Perl Image Requests
Gravatar implementations with Perl are pretty straightforward, however you do need to include several external libraries. These are probably already installed on your machine, but if they're not, you'll have to download and install them.
Let's start by including those library functions that we'll utilize:
use URI::Escape qw(uri_escape); use Digest::MD5 qw(md5_hex);
Next, assume the following variables are available to you:
my $email = 'firstname.lastname@example.org'; my $default = "http://www.example.com/default.jpg"; my $size = 40;
You can construct your gravatar url with the following Perl code:
my $grav_url = "http://www.gravatar.com/avatar/".md5_hex(lc $email)."?d=".uri_escape($default)."&s=".$size;
This only constructs the URL, so don't forget to place it in an
img tag before printing it.