Acme::Metification - Give Perl the power of Metaprogramming!
use Acme::Metification; # This is line 0 sub faculty { my $no = shift; my $fac = 1; $fac *= ($no--); return $fac if $no == 0; recursemeta depth => 100, 5, 7 # ^^ insert lines 5 to 7 up to 100 times return $fac; } print faculty(4); # prints 24 after quite some time
Do not, I repeat, do not use in production code. But then again, the features are useless, so you wouldn't anyway.
This module gives you some meta-programming abilites within Perl. It uses source filters to do evil things with your source.
The module allows the use of two new functions. They must appear on separate lines in your code:
Syntax:
meta [line_no1], [line_no2]
meta replaces itself with the code lines ranging from [line_no1] to [line_no2]. The first line after "use Acme::Metification;" is considered line 0.
meta
Of course, those lines may contain meta or recursemeta directives, so beware of deep recursion.
recursemeta
Similar to meta with some exceptions. Syntax:
recursemeta depth => [depth], [line_no1], [line_no2]
[depth] is the maximum depth to recurse into in case recursemeta directives are inserted. However, meta directives will be recursed into deeply.
use Acme::Metification; # Execute code from pod docs: meta 9, 11 =pod =head1 Example foreach (0..5) { print "Acme::Metification rocks!\n"; } =cut
use Acme::Metification; sub faculty { my $no = shift; my $fac = 1; $fac *= ($no--); return $fac if $no == 0; recursemeta depth => 100, 4, 6 return $fac; } print faculty(4);
Steffen Mueller, <smueller@cpan.org<gt>
Copyright (c) 2002-2006 Steffen Mueller. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Filter::Simple by Damian Conway
To install Acme::Metification, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Acme::Metification
CPAN shell
perl -MCPAN -e shell install Acme::Metification
For more information on module installation, please visit the detailed CPAN module installation guide.