The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Acme::Metification - Give Perl the power of Metaprogramming!

SYNOPSIS

  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

NOTE

Do not, I repeat, do not use in production code. But then again, the features are useless, so you wouldn't anyway.

DESCRIPTION

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:

meta

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.

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.

EXAMPLES

Execute examples from POD docs
  use Acme::Metification;
  
  # Execute code from pod docs:
  
  meta 9, 11
  
  =pod
  
  =head1 Example
  
    foreach (0..5) {
      print "Acme::Metification rocks!\n";
    }
  
  =cut
Transform slow recursion into blazingly fast code!
  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);

AUTHOR

Steffen Mueller, <smueller@cpan.org<gt>

COPYRIGHT AND LICENSE

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.

SEE ALSO

Filter::Simple by Damian Conway