update
OBS-URL: https://build.opensuse.org/package/show/devel:languages:perl/perl-Spiffy?expand=0&rev=15
This commit is contained in:
parent
915becf6b1
commit
2e4149f243
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:922e02aa62a8a618f91dc185d34fde65ef652dfa35d7a335f2e8de2ffdd2f686
|
|
||||||
size 53320
|
|
BIN
Spiffy-0.46.tar.gz
(Stored with Git LFS)
Normal file
BIN
Spiffy-0.46.tar.gz
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -1,3 +1,40 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Apr 13 17:33:13 UTC 2015 - coolo@suse.com
|
||||||
|
|
||||||
|
- updated to 0.46
|
||||||
|
0.45 Sat Aug 16 04:04:07 PDT 2014
|
||||||
|
- Eliminate spurious trailing whitespace
|
||||||
|
|
||||||
|
0.44 Sat Aug 16 02:50:17 PDT 2014
|
||||||
|
- Eliminate File::Basename from test/
|
||||||
|
|
||||||
|
0.43 Fri Aug 15 20:37:55 PDT 2014
|
||||||
|
- Add t/000-compile-modules.t
|
||||||
|
|
||||||
|
0.42 Sat Aug 9 00:43:22 PDT 2014
|
||||||
|
- Only support back to 5.8.1
|
||||||
|
|
||||||
|
0.41 Thu Aug 7 00:28:54 PDT 2014
|
||||||
|
- Fix bad encoding in Pod
|
||||||
|
|
||||||
|
0.40 Wed Aug 6 10:29:46 PDT 2014
|
||||||
|
- Fix a bug that was causing lots of warnings in Test::Base on perl 5.21
|
||||||
|
|
||||||
|
0.39 Tue Aug 5 10:13:52 PDT 2014
|
||||||
|
- Add badges to doc
|
||||||
|
|
||||||
|
0.38 Mon Aug 4 00:30:13 PDT 2014
|
||||||
|
- Remove (c) from Copyright
|
||||||
|
|
||||||
|
0.37 Wed Jul 30 16:16:56 PDT 2014
|
||||||
|
- Switch IRC to '#pkg'
|
||||||
|
|
||||||
|
0.36 Sat Jul 26 12:01:35 PDT 2014
|
||||||
|
- Fix email in Meta
|
||||||
|
|
||||||
|
0.35 Mon Jul 21 17:15:27 PDT 2014
|
||||||
|
- Fix Meta and add Contributing
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Aug 14 17:04:16 UTC 2013 - lars@linux-schulserver.de
|
Wed Aug 14 17:04:16 UTC 2013 - lars@linux-schulserver.de
|
||||||
|
|
||||||
|
142
perl-Spiffy.spec
142
perl-Spiffy.spec
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package perl-Spiffy
|
# spec file for package perl-Spiffy
|
||||||
#
|
#
|
||||||
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -17,51 +17,143 @@
|
|||||||
|
|
||||||
|
|
||||||
Name: perl-Spiffy
|
Name: perl-Spiffy
|
||||||
Url: http://search.cpan.org/~ingy/Spiffy
|
Version: 0.46
|
||||||
Summary: Framework for object oriented programming in Perl
|
|
||||||
License: Artistic-1.0
|
|
||||||
Group: Development/Libraries/Perl
|
|
||||||
Version: 0.31
|
|
||||||
Release: 0
|
Release: 0
|
||||||
Source: Spiffy-%{version}.tar.gz
|
%define cpan_name Spiffy
|
||||||
|
Summary: Spiffy Perl Interface Framework For You
|
||||||
|
License: Artistic-1.0 or GPL-1.0+
|
||||||
|
Group: Development/Libraries/Perl
|
||||||
|
Url: http://search.cpan.org/dist/Spiffy/
|
||||||
|
Source: http://www.cpan.org/authors/id/I/IN/INGY/%{cpan_name}-%{version}.tar.gz
|
||||||
|
BuildArch: noarch
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
%{perl_requires}
|
|
||||||
BuildRequires: perl
|
BuildRequires: perl
|
||||||
BuildRequires: perl-macros
|
BuildRequires: perl-macros
|
||||||
|
%{perl_requires}
|
||||||
|
|
||||||
%description
|
%description
|
||||||
"Spiffy" is a framework and methodology for doing object oriented (OO)
|
"Spiffy" is a framework and methodology for doing object oriented (OO)
|
||||||
programming in Perl. Spiffy combines the best parts of Exporter.pm,
|
programming in Perl. Spiffy combines the best parts of Exporter.pm,
|
||||||
base.pm, mixin.pm and SUPER.pm into one magic foundation class. It
|
base.pm, mixin.pm and SUPER.pm into one magic foundation class. It attempts
|
||||||
attempts to fix all the nits and warts of traditional Perl OO, in a
|
to fix all the nits and warts of traditional Perl OO, in a clean,
|
||||||
clean, straightforward and (perhaps someday) standard way. Spiffy
|
straightforward and (perhaps someday) standard way.
|
||||||
borrows ideas from other OO languages like Python, Ruby, Java and Perl
|
|
||||||
6. It also adds a few tricks of its own.
|
|
||||||
|
|
||||||
|
Spiffy borrows ideas from other OO languages like Python, Ruby, Java and
|
||||||
|
Perl 6. It also adds a few tricks of its own.
|
||||||
|
|
||||||
|
If you take a look on CPAN, there are a ton of OO related modules. When
|
||||||
|
starting a new project, you need to pick the set of modules that makes most
|
||||||
|
sense, and then you need to use those modules in each of your classes.
|
||||||
|
Spiffy, on the other hand, has everything you'll probably need in one
|
||||||
|
module, and you only need to use it once in one of your classes. If you
|
||||||
|
make Spiffy.pm the base class of the basest class in your project, Spiffy
|
||||||
|
will automatically pass all of its magic to all of your subclasses. You may
|
||||||
|
eventually forget that you're even using it!
|
||||||
|
|
||||||
|
The most striking difference between Spiffy and other Perl object oriented
|
||||||
|
base classes, is that it has the ability to export things. If you create a
|
||||||
|
subclass of Spiffy, all the things that Spiffy exports will automatically
|
||||||
|
be exported by your subclass, in addition to any more things that you want
|
||||||
|
to export. And if someone creates a subclass of your subclass, all of those
|
||||||
|
things will be exported automatically, and so on. Think of it as "Inherited
|
||||||
|
Exportation", and it uses the familiar Exporter.pm specification syntax.
|
||||||
|
|
||||||
|
To use Spiffy or any subclass of Spiffy as a base class of your class, you
|
||||||
|
specify the '-base' argument to the 'use' command.
|
||||||
|
|
||||||
|
use MySpiffyBaseModule -base;
|
||||||
|
|
||||||
|
You can also use the traditional 'use base 'MySpiffyBaseModule';' syntax
|
||||||
|
and everything will work exactly the same. The only caveat is that
|
||||||
|
Spiffy.pm must already be loaded. That's because Spiffy rewires base.pm on
|
||||||
|
the fly to do all the Spiffy magics.
|
||||||
|
|
||||||
|
Spiffy has support for Ruby-like mixins with Perl6-like roles. Just like
|
||||||
|
'base' you can use either of the following invocations:
|
||||||
|
|
||||||
|
use mixin 'MySpiffyBaseModule';
|
||||||
|
use MySpiffyBaseModule -mixin;
|
||||||
|
|
||||||
|
The second version will only work if the class being mixed in is a subclass
|
||||||
|
of Spiffy. The first version will work in all cases, as long as Spiffy has
|
||||||
|
already been loaded.
|
||||||
|
|
||||||
|
To limit the methods that get mixed in, use roles. (Hint: they work just
|
||||||
|
like an Exporter list):
|
||||||
|
|
||||||
|
use MySpiffyBaseModule -mixin => qw(:basics x y !foo);
|
||||||
|
|
||||||
|
In object oriented Perl almost every subroutine is a method. Each method
|
||||||
|
gets the object passed to it as its first argument. That means practically
|
||||||
|
every subroutine starts with the line:
|
||||||
|
|
||||||
|
my $self = shift;
|
||||||
|
|
||||||
|
Spiffy provides a simple, optional filter mechanism to insert that line for
|
||||||
|
you, resulting in cleaner code. If you figure an average method has 10
|
||||||
|
lines of code, that's 10% of your code! To turn this option on, you just
|
||||||
|
use the '- Base' option instead of the '-base' option, or add the
|
||||||
|
'-selfless' option. If source filtering makes you queazy, don't use the
|
||||||
|
feature. I personally find it addictive in my quest for writing squeaky
|
||||||
|
clean, maintainable code.
|
||||||
|
|
||||||
|
A useful feature of Spiffy is that it exports two functions: 'field' and
|
||||||
|
'const' that can be used to declare the attributes of your class, and
|
||||||
|
automatically generate accessor methods for them. The only difference
|
||||||
|
between the two functions is that 'const' attributes can not be modified;
|
||||||
|
thus the accessor is much faster.
|
||||||
|
|
||||||
|
One interesting aspect of OO programming is when a method calls the same
|
||||||
|
method from a parent class. This is generally known as calling a super
|
||||||
|
method. Perl's facility for doing this is butt ugly:
|
||||||
|
|
||||||
|
sub cleanup {
|
||||||
|
my $self = shift;
|
||||||
|
$self->scrub;
|
||||||
|
$self->SUPER::cleanup(@_);
|
||||||
|
}
|
||||||
|
|
||||||
|
Spiffy makes it, er, super easy to call super methods. You just use the
|
||||||
|
'super' function. You don't need to pass it any arguments because it
|
||||||
|
automatically passes them on for you. Here's the same function with Spiffy:
|
||||||
|
|
||||||
|
sub cleanup {
|
||||||
|
$self->scrub;
|
||||||
|
super;
|
||||||
|
}
|
||||||
|
|
||||||
|
Spiffy has a special method for parsing arguments called 'parse_arguments',
|
||||||
|
that it also uses for parsing its own arguments. You declare which
|
||||||
|
arguments are boolean (singletons) and which ones are paired, with two
|
||||||
|
special methods called 'boolean_arguments' and 'paired_arguments'. Parse
|
||||||
|
arguments pulls out the booleans and pairs and returns them in an anonymous
|
||||||
|
hash, followed by a list of the unmatched arguments.
|
||||||
|
|
||||||
|
Finally, Spiffy can export a few debugging functions 'WWW', 'XXX', 'YYY'
|
||||||
|
and 'ZZZ'. Each of them produces a YAML dump of its arguments. WWW warns
|
||||||
|
the output, XXX dies with the output, YYY prints the output, and ZZZ
|
||||||
|
confesses the output. If YAML doesn't suit your needs, you can switch all
|
||||||
|
the dumps to Data::Dumper format with the '-dumper' option.
|
||||||
|
|
||||||
|
That's Spiffy!
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -n Spiffy-%{version}
|
%setup -q -n %{cpan_name}-%{version}
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
perl Makefile.PL
|
%{__perl} Makefile.PL INSTALLDIRS=vendor
|
||||||
make %{?_smp_mflags}
|
%{__make} %{?_smp_mflags}
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
%check
|
%check
|
||||||
make test
|
%{__make} test
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%perl_make_install
|
%perl_make_install
|
||||||
%perl_process_packlist
|
%perl_process_packlist
|
||||||
%perl_gen_filelist
|
%perl_gen_filelist
|
||||||
|
|
||||||
%clean
|
|
||||||
rm -rf $RPM_BUILD_ROOT
|
|
||||||
|
|
||||||
%files -f %{name}.files
|
%files -f %{name}.files
|
||||||
%defattr(-,root,root)
|
%defattr(-,root,root,755)
|
||||||
%doc README Changes
|
%doc Changes CONTRIBUTING LICENSE README
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
Loading…
x
Reference in New Issue
Block a user