File perl-LWP-UserAgent-Cached.spec of Package perl-LWP-UserAgent-Cached
#
# spec file for package perl-LWP-UserAgent-Cached
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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.06
Release: 0
Summary: LWP::UserAgent with simple caching mechanism
License: Artistic-1.0 OR GPL-1.0-or-later
Group: Development/Libraries/Perl
URL: http://search.cpan.org/dist/LWP-UserAgent-Cached/
Source: http://www.cpan.org/authors/id/O/OL/OLEG/%{cpan_name}-%{version}.tar.gz
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(LWP::UserAgent)
BuildRequires: perl(Test::Mock::LWP::Dispatch) >= 0.02
BuildRequires: perl(Test::More) >= 0.88
#BuildRequires: perl(HTTP::Request)
#BuildRequires: perl(HTTP::Response)
#BuildRequires: perl(LWP::UserAgent::Cached)
Requires: perl(LWP::UserAgent)
BuildArch: noarch
%{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:
* the LWP::UserAgent::WithCache manpage
caches responses on local filesystem and gets it from the cache only if
online document was not modified
* the LWP::UserAgent::Cache::Memcached manpage
same as above but stores cache in memory
* the LWP::UserAgent::Snapshot manpage
can record responses in the cache or get responses from the cache, but
not both for one useragent
* the LWP::UserAgent::OfflineCache manpage
seems it may cache responses and get responses from the cache, but has
too much dependencies and unclear `delay' parameter
%prep
%setup -q -n %{cpan_name}-%{version}
%build
perl Makefile.PL INSTALLDIRS=vendor
make %{?_smp_mflags}
%check
make %{?_smp_mflags} test
%install
%perl_make_install
%perl_process_packlist
%perl_gen_filelist
%files -f %{name}.files
%defattr(-,root,root,755)
%doc Changes README
%changelog