File perl-LWP-UserAgent-Cached.spec of Package perl-LWP-UserAgent-Cached
#
# spec file for package perl-LWP-UserAgent-Cached (Version 0.08)
#
# Copyright (c) 125 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define cpan_name LWP-UserAgent-Cached
Name: perl-LWP-UserAgent-Cached
Version: 0.08
Release: 0%{?autorelease}
License: Artistic-1.0 or GPL-1.0-or-later
Summary: LWP::UserAgent with simple caching mechanism
Url: https://metacpan.org/release/%{cpan_name}
Source0: https://cpan.metacpan.org/authors/id/O/OL/OLEG/%{cpan_name}-%{version}.tar.gz
BuildArch: noarch
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(ExtUtils::MakeMaker) >= 6.52
BuildRequires: perl(LWP::UserAgent)
BuildRequires: perl(Test::More) >= 0.88
Requires: perl(LWP::UserAgent)
%{?perl_requires}
%description
When you process content from some website, you will get page one by one
and extract some data from this page with regexp, DOM parser or smth else.
Sometimes we makes errors in our data extractors and realize this only when
all 1_000_000 pages were processed. We should fix our extraction logic and
start all process from the beginning. Please STOP! How about cache? Yes,
you can cache all responses and second, third and other attempts will be
very fast.
LWP::UserAgent::Cached is yet another LWP::UserAgent subclass with cache
support. It stores cache in the files on local filesystem and if response
already available in the cache returns it instead of making HTTP request.
This module was writed because other available alternatives didn't meet my
needs:
* LWP::UserAgent::WithCache
caches responses on local filesystem and gets it from the cache only if
online document was not modified
* LWP::UserAgent::Cache::Memcached
same as above but stores cache in memory
* LWP::UserAgent::Snapshot
can record responses in the cache or get responses from the cache, but not
both for one useragent
* LWP::UserAgent::OfflineCache
seems it may cache responses and get responses from the cache, but has too
much dependencies and unclear `delay' parameter
%prep
%autosetup -n %{cpan_name}-%{version} -p1
%build
perl Makefile.PL INSTALLDIRS=vendor
%make_build
%check
make test
%install
%perl_make_install
%perl_process_packlist
%perl_gen_filelist
%files -f %{name}.files
%doc Changes README
%changelog