Index | index by Group | index by Distribution | index by Vendor | index by creation date | index by Name | Mirrors | Help | Search |
Name: perl-asa | Distribution: openSUSE Leap 15.2 |
Version: 1.03 | Vendor: openSUSE |
Release: lp152.3.2 | Build date: Fri Sep 20 19:46:43 2019 |
Group: Development/Libraries/Perl | Build host: sheep83 |
Size: 34713 | Source RPM: perl-asa-1.03-lp152.3.2.src.rpm |
Packager: https://bugs.opensuse.org | |
Url: http://search.cpan.org/dist/asa/ | |
Summary: Lets your class/object say it works like something else |
Perl 5 doesn't natively support Java-style interfaces, and it doesn't support Perl 6 style roles either. You can get both of these things in half a dozen different ways via various CPAN modules, but they usually require that you buy into "their way" of implementing your code. Other have turned to "duck typing". This is, for the most part, a fairly naive check that says "can you do this method", under the "if it looks like a duck, and quacks like a duck, then it must be a duck". It assumes that if you have a '->quack' method, then they will treat you as a duck, because doing things like adding 'Duck' to your '@ISA' array means you are also forced to take their implementation. There is, of course, a better way. For better or worse, Perl's '->isa' functionality to determine if something is or is not a particular class/object is defined as a *method*, not a function, and so that means that as well as adding something to you '@ISA' array, so that Perl's 'UNIVERSAL::isa' method can work with it, you are also allowed to simply overload your own 'isa' method and answer directly whether or not you are something. The simplest form of the idiom looks like this. sub isa { return 1 if $_[1] eq 'Duck'; shift->SUPER::isa(@_); } This reads "Check my type as normal, but if anyone wants to know if I'm a duck, then tell them yes". Now, there are a few people that have argued that this is "lying" about your class, but this argument is based on the idea that '@ISA' is somehow more "real" than using the method directly. It also assumes that what you advertise you implement needs to be in sync with the method resolution for any given function. But in the best and cleanest implementation of code, the API is orthogonal (although most often related) to the implementation. And although '@ISA' is about implementation *and* API, overloading 'isa' to let you change your API is not at all bad when seen in this light.
Artistic-1.0 or GPL-1.0+
* Mon Oct 16 2017 ncutler@suse.com - spec file + add "BuildRequires: perl-Module-Install" to fix perl 5.26 build * Mon Apr 13 2015 coolo@suse.com - updated to 1.03 see /usr/share/doc/packages/perl-asa/Changes * Mon Apr 13 2015 coolo@suse.com - updated to 1.03 see /usr/share/doc/packages/perl-asa/Changes * Tue Nov 30 2010 coolo@novell.com - switch to perl_requires macro * Mon Nov 29 2010 coolo@novell.com - remove /var/adm/perl-modules * Fri Nov 05 2010 pascal.bleser@opensuse.org - initial package (0.02)
/usr/lib/perl5/vendor_perl/5.26.1/asa.pm /usr/lib/perl5/vendor_perl/5.26.1/x86_64-linux-thread-multi /usr/share/doc/packages/perl-asa /usr/share/doc/packages/perl-asa/Changes /usr/share/doc/packages/perl-asa/LICENSE /usr/share/doc/packages/perl-asa/README /usr/share/man/man3/asa.3pm.gz
Generated by rpm2html 1.8.1
Fabrice Bellet, Tue Jul 9 11:27:19 2024