Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Tomcat42
perl-WWW-Shorten-Simple
perl-WWW-Shorten-Simple.spec
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File perl-WWW-Shorten-Simple.spec of Package perl-WWW-Shorten-Simple
# # spec file for package perl-WWW-Shorten-Simple # # Copyright (c) 2015 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 http://bugs.opensuse.org/ # Name: perl-WWW-Shorten-Simple Version: 0.02 Release: 0 %define cpan_name WWW-Shorten-Simple Summary: Factory wrapper around WWW::Shorten to avoid imports License: Artistic-1.0 or GPL-1.0+ Group: Development/Libraries/Perl Url: http://search.cpan.org/dist/WWW-Shorten-Simple/ Source0: http://www.cpan.org/authors/id/M/MI/MIYAGAWA/%{cpan_name}-%{version}.tar.gz Source1: cpanspec.yml BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: perl BuildRequires: perl-macros BuildRequires: perl(Module::Build::Tiny) >= 0.034 BuildRequires: perl(WWW::Shorten) Requires: perl(WWW::Shorten) %{perl_requires} %description WWW::Shorten::Simple is a wrapper (factory) around WWW::Shorten so that you can create an object representing each URL shortening service, instead of _import_ing 'makeashorterlink' function into your namespace. This allows you to call multiple URL shortening services in one package, for instance to call WWW::Shorten::RevCanonical to extract rev="canonical", fallback to bit.ly if username and API key are present, and then finally to TinyURL. use WWW::Shorten::Simple; my @shorteners = ( WWW::Shorten::Simple->new('RevCanonical'), WWW::Shorten::Simple->new('Bitly', $bitly_username, $bitly_api_key), WWW::Shorten::Simple->new('TinyURL'), ); my $short_url; for my $shortener (@shorteners) { $short_url = eval { $shortener->shorten($long_url) } # eval to ignore errors and last; } This wrapper works with most WWW::Shorten implementation that implements the default 'makeashorterlink' and 'makealongerlink' functions. The options should be able to be passed as an optional parameters to 'makeashorterlink' function. %prep %setup -q -n %{cpan_name}-%{version} %build %{__perl} Build.PL --installdirs=vendor ./Build build --flags=%{?_smp_mflags} %check ./Build test %install ./Build install --destdir=%{buildroot} --create_packlist=0 %perl_gen_filelist %files -f %{name}.files %defattr(-,root,root,755) %doc Changes LICENSE README %changelog
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor