AWS-IP
view release on metacpan or search on metacpan
lib/AWS/IP.pm view on Meta::CPAN
croak 'Incorrect number of args passed to AWS::IP->new()' unless @_ >= 2 && @_ <= 3;
my ($class, $cache_timeout_secs, $cache_path) = @_;
# validate args
unless ($cache_timeout_secs
&& $cache_timeout_secs =~ /^[0-9]+$/)
{
croak 'Error argument cache_timeout_secs must be a positive integer';
}
bless {
cache => Cache::File->new( cache_root => ($cache_path || tempdir()),
lock_level => Cache::File::LOCK_LOCAL(),
default_expires => "$cache_timeout_secs sec"),
}, $class;
}
=head2 ip_is_aws ($ip, [$service])
Boolean method to test if an ip address is from AWS. Optionally takes a service name (AMAZON|EC2|CLOUDFRONT|ROUTE53|ROUTE53_HEALTHCHECKS) and restricts the check to AWS ip addresses for that service.
( run in 0.929 second using v1.01-cache-2.11-cpan-de7293f3b23 )