Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
devel:languages:perl:CPAN-A
perl-Algorithm-CouponCode
perl-Algorithm-CouponCode.spec
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File perl-Algorithm-CouponCode.spec of Package perl-Algorithm-CouponCode
# # spec file for package perl-Algorithm-CouponCode # # Copyright (c) 2016 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-Algorithm-CouponCode Version: 1.005 Release: 0 %define cpan_name Algorithm-CouponCode Summary: Generate and validate 'CouponCode' strings License: Artistic-1.0 or GPL-1.0+ Group: Development/Libraries/Perl Url: http://search.cpan.org/dist/Algorithm-CouponCode/ Source0: http://www.cpan.org/authors/id/G/GR/GRANTM/%{cpan_name}-%{version}.tar.gz BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: perl BuildRequires: perl-macros BuildRequires: perl(Digest::SHA) BuildRequires: perl(Test::More) >= 0.88 Requires: perl(Digest::SHA) %{perl_requires} %description A 'Coupon Code' is made up of letters and numbers grouped into 4 character 'parts'. For example, a 3-part code might look like this: 1K7Q-CTFM-LMTC Coupon Codes are random codes which are easy for the recipient to type accurately into a web form. An example application might be to print a code on a letter to a customer who would then enter the code as part of the registration process for web access to their account. Features of the codes that make them well suited to manual transcription: * The codes are not case sensitive. * Not all letters and numbers are used, so if a person enters the letter 'O' we can automatically correct it to the digit '0' (similarly for I => 1, S => 5, Z => 2). * The 4th character of each part is a checkdigit, so client-side scripting can be used to highlight parts which have been mis-typed, before the code is even submitted to the application's back-end validation. * The checkdigit algorithm takes into account the position of the part being keyed. So for example '1K7Q' might be valid in the first part but not in the second so if a user typed the parts in the wrong boxes then their error could be highlighted. * The code generation algorithm avoids 'undesirable' codes. For example any code in which transposed characters happen to result in a valid checkdigit will be skipped. Any generated part which happens to spell an 'inappropriate' 4-letter word (e.g.: 'P00P') will also be skipped. The Algorithm-CouponCode distribution includes a Javascript implementation of the validator function, in the form of a jQuery plugin. You can include this in your web application to do client-side validation and highlighting of errors. _Note_ the cc_validate function and the Javascript plugin only validate that the code is 'well-formed' (i.e.: each part has a valid checkdigit). Checking whether the code is in fact 'valid' is left up to your application and would typically involve looking for the code in a database. If you use the Javascript plugin, you might choose to tweak the CSS to keep the red highlighting of checksum errors but remove the green highlighting which might imply the code was correct. %prep %setup -q -n %{cpan_name}-%{version} %build %{__perl} Makefile.PL INSTALLDIRS=vendor %{__make} %{?_smp_mflags} %check %{__make} test %install %perl_make_install %perl_process_packlist %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