2011-04-08 19:16:09 +00:00
|
|
|
#
|
|
|
|
# spec file for package perl-Object-Tiny (Version 1.08)
|
|
|
|
#
|
|
|
|
# Copyright (c) 2010 SUSE LINUX Products 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-Object-Tiny
|
|
|
|
Version: 1.08
|
|
|
|
Release: 1
|
|
|
|
License: GPL+ or Artistic
|
|
|
|
%define cpan_name Object-Tiny
|
|
|
|
Summary: Class building as simple as it gets
|
|
|
|
Url: http://search.cpan.org/dist/Object-Tiny/
|
|
|
|
Group: Development/Libraries/Perl
|
|
|
|
#Source: http://www.cpan.org/authors/id/A/AD/ADAMK/Object-Tiny-%{version}.tar.gz
|
|
|
|
Source: %{cpan_name}-%{version}.tar.gz
|
|
|
|
BuildArch: noarch
|
|
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
|
|
BuildRequires: perl
|
|
|
|
BuildRequires: perl-macros
|
|
|
|
BuildRequires: perl(ExtUtils::MakeMaker)
|
|
|
|
BuildRequires: perl(Test::More) >= 0.47
|
|
|
|
Requires: perl(Test::More) >= 0.47
|
|
|
|
%{perl_requires}
|
|
|
|
|
|
|
|
%description
|
|
|
|
There's a whole bunch of class builders out there. In fact, creating a
|
|
|
|
class builder seems to be something of a rite of passage (this is my fifth,
|
|
|
|
at least).
|
|
|
|
|
|
|
|
Unfortunately, most of the time I want a class builder I'm in a hurry and
|
|
|
|
sketching out lots of fairly simple data classes with fairly simple
|
|
|
|
structure, mostly just read-only accessors, and that's about it.
|
|
|
|
|
|
|
|
Often this is for code that won't end up on CPAN, so adding a small
|
|
|
|
dependency doesn't matter much. I just want to be able to define these
|
|
|
|
classes FAST.
|
|
|
|
|
|
|
|
By which I mean LESS typing than writing them by hand, not more. And I
|
|
|
|
don't need all those weird complex features that bloat out the code and
|
|
|
|
take over the whole way I build modules.
|
|
|
|
|
|
|
|
And so, I present yet another member of the Tiny family of modules,
|
|
|
|
Object::Tiny.
|
|
|
|
|
|
|
|
The goal here is really just to save me some typing. There's others that
|
|
|
|
could do the job just fine, but I want something that does as little as
|
|
|
|
possible and creates code the same way I'd have written it by hand anyway.
|
|
|
|
|
|
|
|
To use Object::Tiny, just call it with a list of accessors to be created.
|
|
|
|
|
|
|
|
use Object::Tiny 'foo', 'bar';
|
|
|
|
|
|
|
|
For a large list, I lay it out like this...
|
|
|
|
|
|
|
|
use Object::Tiny qw{
|
|
|
|
item_font_face
|
|
|
|
item_font_color
|
|
|
|
item_font_size
|
|
|
|
item_text_content
|
|
|
|
item_display_time
|
|
|
|
seperator_font_face
|
|
|
|
seperator_font_color
|
|
|
|
seperator_font_size
|
|
|
|
seperator_text_content
|
|
|
|
};
|
|
|
|
|
|
|
|
This will create a bunch of simple accessors, and set the inheritance to be
|
|
|
|
the child of Object::Tiny.
|
|
|
|
|
|
|
|
Object::Tiny is empty other than a basic 'new' constructor which does the
|
|
|
|
following
|
|
|
|
|
|
|
|
sub new {
|
|
|
|
my $class = shift;
|
|
|
|
return bless { @_ }, $class;
|
|
|
|
}
|
|
|
|
|
|
|
|
In fact, if doing the following in your class gets annoying...
|
|
|
|
|
|
|
|
sub new {
|
|
|
|
my $class = shift;
|
|
|
|
my $self = $class->SUPER::new( @_ );
|
|
|
|
|
|
|
|
# Extra checking and such
|
|
|
|
...
|
|
|
|
|
|
|
|
return $self;
|
|
|
|
}
|
|
|
|
|
|
|
|
... then feel free to ditch the SUPER call and just create the hash
|
|
|
|
yourself! It's not going to make a lick of different and there's nothing
|
|
|
|
magic going on under the covers you might break.
|
|
|
|
|
|
|
|
And that's really all there is to it. Let a million simple data classes
|
|
|
|
bloom. Features? We don't need no stinking features.
|
|
|
|
|
|
|
|
%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
|
|
|
|
|
|
|
|
%clean
|
|
|
|
%{__rm} -rf %{buildroot}
|
|
|
|
|
|
|
|
%files -f %{name}.files
|
|
|
|
%defattr(-,root,root,755)
|
2011-04-15 07:29:39 +00:00
|
|
|
%doc Changes LICENSE README examples
|
2011-04-08 19:16:09 +00:00
|
|
|
|
|
|
|
%changelog
|