Skip to content

Instantly share code, notes, and snippets.

@sironekotoro
Created May 22, 2021 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sironekotoro/adff3639f3be94723b88fe1862b48705 to your computer and use it in GitHub Desktop.
Save sironekotoro/adff3639f3be94723b88fe1862b48705 to your computer and use it in GitHub Desktop.
AWS Lambda Sample(http)
#!/usr/bin/env perl
use strict;
use warnings;
use Encode qw/decode/;
use HTTP::Tiny;
my $url = 'http://abehiroshi.la.coocan.jp/';
my $ht = HTTP::Tiny->new();
sub handler{
my $res = $ht->get($url);
my $content = decode('shiftjis', $res->{content});
$content =~ /<title>(?<title>.+?)<\/title>/;
return {
status => $res->{status},
title => $+{title},
}
}
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment