Net-PublicSuffixList
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
a module.
To build the distribution, run this file normally:
% perl Makefile.PL
But, it's more interesting than that. You can load it with C<require>
and call C<arguments> to get the data structure it passes to
C<WriteMakefile>:
my $package = require '/path/to/Makefile.PL';
my $arguments = $package->arguments;
Note that C<require>-ing a file makes an entry in C<%INC> for exactly
that name. If you try to C<require> another file with the same name,
even from a different path, C<require> thinks it has already loaded
the file. As such, I recommend you always require the full path to the
file.
The return value of the C<require> is a package name (in this case,
the name of the main module. Use that to call the C<arguments> method.
lib/Net/PublicSuffixList.pm view on Meta::CPAN
If you've set C<cache_dir> in the object, this method attempts to
cache the response in that directory using C<default_local_file> as
the filename. This cache is different than C<local_file> although you
can use it as C<local_file>.
=cut
sub fetch_list_from_net ( $self ) {
return if $self->{no_net};
state $rc = require Mojo::UserAgent;
state $ua = Mojo::UserAgent->new;
my $path = catfile( $self->{cache_dir}, $self->default_local_file );
my $local_last_modified = (stat $path)[9];
my $headers = {};
if( $self->{cache_dir} ) {
make_path $self->{cache_dir};
if( $local_last_modified ) {
$headers->{'If-Modified-Since'} = Mojo::Date->new($local_last_modified);
( run in 0.266 second using v1.01-cache-2.11-cpan-0d8aa00de5b )