1 | Name: perl-Devel-EnforceEncapsulation |
---|
2 | Version: 0.50 |
---|
3 | Release: 2%{?_dist_release} |
---|
4 | Summary: Find access violations to blessed objects |
---|
5 | Group: Development/Libraries |
---|
6 | License: GPL+ or Artistic |
---|
7 | URL: http://search.cpan.org/dist/Devel-EnforceEncapsulation/ |
---|
8 | Source0: http://search.cpan.org/CPAN/authors/id/C/CL/CLOTHO/Devel-EnforceEncapsulation-%{version}.tgz |
---|
9 | BuildArch: noarch |
---|
10 | BuildRequires: perl(Carp) |
---|
11 | BuildRequires: perl(English) |
---|
12 | BuildRequires: perl(ExtUtils::MakeMaker) |
---|
13 | BuildRequires: perl(Test::More) |
---|
14 | BuildRequires: perl(Test::Pod) |
---|
15 | BuildRequires: perl(Test::Pod::Coverage) |
---|
16 | Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)) |
---|
17 | |
---|
18 | Vendor: Project Vine |
---|
19 | Distribution: Vine Linux |
---|
20 | Packager: shaolin |
---|
21 | |
---|
22 | %description |
---|
23 | Encapsulation is the practice of creating subroutines to access the properties |
---|
24 | of a class instead of accessing those properties directly. The advantage of |
---|
25 | good encapsulation is that the author is permitted to change the internal |
---|
26 | implementation of a class without breaking its usage. |
---|
27 | |
---|
28 | Object-oriented programming in Perl is most commonly implemented via blessed |
---|
29 | hashes. This practice makes it easy for users of a class to violate |
---|
30 | encapsulation by simply accessing the hash values directly. Although less |
---|
31 | common, the same applies to classes implemented via blessed arrays, scalars, |
---|
32 | filehandles, etc. |
---|
33 | |
---|
34 | This module is a hack to block those direct accesses. If you try to access a |
---|
35 | hash value of an object from its own class, or a superclass or subclass, all |
---|
36 | goes well. If you try to access a hash value from any other package, an |
---|
37 | exception is thrown. The same applies to the scalar value of a blessed scalar, |
---|
38 | entry in a blessed array, etc. |
---|
39 | |
---|
40 | To be clear: this class is NOT intended for strict enforcement of |
---|
41 | encapsulation. If you want bullet-proof encapsulation, use inside-out objects |
---|
42 | or the like. Instead, this module is intended to be a development or debugging |
---|
43 | aid in catching places where direct access is used against classes implemented |
---|
44 | as blessed hashes. |
---|
45 | |
---|
46 | To repeat: the encapsulation enforced here is a hack and is easily |
---|
47 | circumvented. Please use this module for good (finding bugs), not evil (making |
---|
48 | life harder for downstream developers). |
---|
49 | |
---|
50 | %prep |
---|
51 | %setup -q -n Devel-EnforceEncapsulation-%{version} |
---|
52 | |
---|
53 | %build |
---|
54 | perl Makefile.PL INSTALLDIRS=vendor |
---|
55 | make %{?_smp_mflags} |
---|
56 | |
---|
57 | %install |
---|
58 | make pure_install DESTDIR=%{buildroot} |
---|
59 | find %{buildroot} -type f -name .packlist -exec rm -f {} \; |
---|
60 | find %{buildroot} -depth -type d -exec rmdir {} \; 2>/dev/null |
---|
61 | %{_fixperms} %{buildroot} |
---|
62 | |
---|
63 | %check |
---|
64 | make test AUTHOR_TEST=1 AUTHOR_TEST_CDOLAN=1 |
---|
65 | |
---|
66 | %files |
---|
67 | %defattr(-,root,root,-) |
---|
68 | %doc CHANGES LICENSE README index.html |
---|
69 | %{perl_vendorlib}/Devel/ |
---|
70 | %{_mandir}/man3/Devel::EnforceEncapsulation.3pm* |
---|
71 | |
---|
72 | %changelog |
---|
73 | * Thu Mar 02 2012 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 0.50-2 |
---|
74 | - rebuild |
---|
75 | |
---|
76 | * Fri Feb 24 2012 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 0.50-1 |
---|
77 | - initial build for Vine Linux |
---|
78 | |
---|
79 | * Wed Jan 11 2012 Paul Howarth <paul@city-fan.org> - 0.50-5 |
---|
80 | - BR: perl(Carp) and perl(English) |
---|
81 | |
---|
82 | * Mon Jun 20 2011 Marcela Mašláňová <mmaslano@redhat.com> - 0.50-4 |
---|
83 | - Perl mass rebuild |
---|
84 | |
---|
85 | * Mon Apr 11 2011 Paul Howarth <paul@city-fan.org> - 0.50-3 |
---|
86 | - Clean up for modern rpmbuild |
---|
87 | |
---|
88 | * Mon Apr 11 2011 Paul Howarth <paul@city-fan.org> - 0.50-2 |
---|
89 | - Nobody else likes macros for commands |
---|
90 | |
---|
91 | * Fri Mar 18 2011 Paul Howarth <paul@city-fan.org> - 0.50-1 |
---|
92 | - Initial RPM version |
---|