Package: perl-asa (1.03-bp156.3.1)
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.
Package information
- Homepage
- [http://search.cpan.org/dist/asa/]
- License
- Artistic-1.0 or GPL-1.0+
- Downstream package maintainer
- Unknown: not reported in the indexed source
- Source package
- [perl-asa]
- Software project
- [perl-asa]
Versions and downloads for perl-asa
| Version / release | Architecture / repository | Package size | Installed size | Files | Publisher repository artifact |
|---|---|---|---|---|---|
| 1.03-bp156.3.1leap-15.6 / oss | noarchopenSUSE Leap 15.6 · OSS · multi-architecture | 24 KiB | 34 KiB | list of files | perl-asa-1.03-bp156.3.1.noarch.rpm |
About these downloads
Each row is recorded package-index metadata for one version, architecture, suite, and repository. Names, URLs, and sizes are source-reported; a link is a potentially mutable retrieval location, not an OpenFactory redistribution claim or proof that OpenFactory retained the artifact bytes.
Dependencies and recommendations for perl-asa
dep: perl(:MODULE_COMPAT_5.26.1)
Package not available
Package file paths (7)
Paths come from the repository package-file index for the observed builds. They describe archive/package associations, not every file that will exist on a running system after maintainer scripts, alternatives, generated state, diversions, or installation choices.
- /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
Field source: openSUSE Leap 15.6 OSS
