App-Fetchware
view release on metacpan or search on metacpan
bin/fetchware view on Meta::CPAN
build => 1,
install => 1,
uninstall => 1,
upgrade => 1,
check_syntax => 1,
end => 1,
);
# Determine if all of the @api_subs are in sublist, the list of all subs in
# the current package.
# Code adapted from Perl Cookbook pg. 129.
my (%union, %intersection);
for my $element (keys %api_subs, sublist()) {
$union{$element}++ && $intersection{$element}++;
}
# Compares the number of %intersection's to the number of %api_subs, and if
# they're *not* equal throw an exception, so the user knows which API subs
# are not set up right.
if ( (grep {exists $api_subs{$_} and exists $intersection{$_}
and $api_subs{$_} eq $intersection{$_}}
lib/App/Fetchware/Util.pm view on Meta::CPAN
specific error message that replaces the generic default one.
Fetchware occasionally needs to write files especially in fetchware's new()
command; therefore safe_open() also takes the fake hash argument
C<MODE =E<gt> 'E<gt>'>, which opens the file in a mode specified by the caller.
C<'E<gt>'> is for writing for example. See C<perldoc -f open> for a list of
possible modes.
In fetchware, this subroutine is used to check if every file fetchware
opens is safe to do so. It is based on is_safe() and is_very_safe() from the
Perl Cookbook by Tom Christiansen and Nathan Torkington.
What this subroutine checks:
=over
=item *
It opens the file you give to it as an argument, and all subsequent operations
are done on the opened filehandle to prevent race conditions.
lib/App/FetchwareX/HTMLPageSync.pm view on Meta::CPAN
# Preprocess both @$download_path and @installed_downloads to ensure that
# URL crap or differing full paths won't screw up the "comparisons". The
# clever delete hashslice does the "comparisons" if you will.
my @download_path_filenames = map { ( uri_split($_) )[2] } @$download_path;
my @installed_downloads_filenames = map { ( splitpath($_) ) [2] }
@installed_downloads;
# Determine what files are in @$download_path, but not in
# @installed_downloads.
# Algo based on code from Perl Cookbook pg. 126.
my %seen;
@seen{@$download_path} = ();
delete @seen{@installed_downloads};
my @new_urls_to_download = keys %seen;
if (@new_urls_to_download > 0) {
# Alter $download_path to only list @new_urls_to_download. That way
# download() only downloads the new URLs not the already downloaded ones
# again.
( run in 0.619 second using v1.01-cache-2.11-cpan-e9199f4ba4c )