gitpan / any-feature Goto Github PK
View Code? Open in Web Editor NEWRead-only release history for any-feature
Home Page: http://metacpan.org/release/any-feature
License: Other
Read-only release history for any-feature
Home Page: http://metacpan.org/release/any-feature
License: Other
NAME any::feature - Backwards-compatible handling of new syntactic features VERSION version 1.100840 SYNOPSIS use any::feature 'say'; say 'Hello, world!'; DESCRIPTION THE PROBLEM Perl 5.10 introduces new syntactic features which you can activate and deactivate with the "feature" module. You want to use the "say" feature in a program that's supposed to run under both Perl 5.8 and 5.10. So your program looks like this: use feature 'say'; say 'Hello, world!'; But this only works in Perl 5.10, because there is no "feature" module in Perl 5.8. So you write use Perl6::Say; say 'Hello, world!'; This works, but it's strange to force Perl 5.10 users to install Perl6::Say when the "say" feature is included in Perl 5.10. THE SOLUTION Use "any::feature"! WARNING: This is just a proof-of-concept. "any::feature" can be used like Perl 5.10's "feature" and will try to "do the right thing", regardless of whether you use Perl 5.8 or Perl 5.10. At the moment, this is just a proof-of-concept and only handles the "say" feature. If things work out, I plan to extend it with other Perl 5.10 features. The following programs should work and exhibit the same behaviour both in Perl 5.8 and Perl 5.10. This program will work: use any::feature 'say'; say 'Hello, world!'; This program will fail at compile-time: use any::feature 'say'; say 'Hello, world!'; no any::feature 'say'; say 'Oops'; The features are lexically scoped, which is how they work in Perl 5.10: { use any::feature 'say'; say 'foo'; } say 'bar'; # dies at compile-time FUNCTIONS dispatch Takes as arguments a direction ("activate" or "deactivate"), a package name and a feature name. Activates or deactivates the given feature for the given package. activate Takes as arguments a package name and a feature name. Uses "dispatch()" to activate the given feature in the given package. deactivate Takes as arguments a package name and a feature name. Uses "dispatch()" to deactivate the given feature in the given package. import Takes the same arguments as Perl 5.10's "use feature" pragma. Uses "activate()" and "deactivate()" to do its job. unimport Takes the same arguments as Perl 5.10's "no feature" pragma. Uses "activate()" and "deactivate()" to do its job. get_effective_version Uses Perl::Version to get the version number of the current perl interpreter. This is used to decide the course of action. get_effective_revision Uses Perl::Version to get the revision number of the current perl interpreter. This is used to decide the course of action. INSTALLATION See perlmodinstall for information and options on installing Perl modules. BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests through the web interface at <http://rt.cpan.org/Public/Dist/Display.html?Name=any-feature>. AVAILABILITY The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit <http://www.perl.com/CPAN/> to find a CPAN site near you, or see <http://search.cpan.org/dist/any-feature/>. The development version lives at <http://github.com/hanekomu/any-feature/>. Instead of sending patches, please fork this project using the standard git and github infrastructure. AUTHOR Marcel Gruenauer <[email protected]> COPYRIGHT AND LICENSE This software is copyright (c) 2009 by Marcel Gruenauer. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.