Perl Image Requests

← Back

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 。

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 = 'someone@somewhere.com';
my $default = "https://www.example.com/default.jpg";
my $size = 40;

You can construct your gravatar url with the following Perl code:

my $grav_url = "https://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.

Perl Modules

北京pk10 鼎鑫彩票注册 小米彩票网址是多少 天津11选5分布走势图 幸运时时彩平台 北京pk10 幸运时时彩 500万彩票网 迪士尼彩乐园娱乐 快赢彩票