Filter-Macro
view release on metacpan or search on metacpan
Changes
inc/Module/Install.pm
inc/Module/Install/Base.pm
inc/Module/Install/Can.pm
inc/Module/Install/Fetch.pm
inc/Module/Install/Makefile.pm
inc/Module/Install/Metadata.pm
inc/Module/Install/Win32.pm
inc/Module/Install/WriteAll.pm
lib/Filter/Macro.pm
Makefile.PL
MANIFEST This list of files
META.yml
README
SIGNATURE
t/0-signature.t
t/1-basic.t
t/my_macro.pm
abstract: Make macro modules that are expanded inline
author: Audrey Tang <cpan@audreyt.org>
distribution_type: module
generated_by: Module::Install version 0.62
license: MIT
name: Filter-Macro
no_index:
directory:
- inc
- t
requires:
Filter::Simple::Compile: 0
version: 0.11
Makefile.PL view on Meta::CPAN
#!/usr/local/bin/perl
use inc::Module::Install;
name 'Filter-Macro';
license 'MIT';
all_from 'lib/Filter/Macro.pm';
requires 'Filter::Simple::Compile';
sign; WriteAll;
This is the README file for Filter::Macro, a filter for making
macro modules that are expanded inline.
Please type "perldoc Filter::Macro" after installation to see
the module usage information.
* Installation
Filter::Macro uses the standard perl module install process:
cpansign -v # optional; see SIGNATURE for details
perl Makefile.PL
make # or 'nmake' on Win32
make test
make install
* COPYRIGHT (The "MIT" License)
Copyright 2004, 2006 by Audrey Tang <cpan@audreyt.org>.
SHA1 1e5865aed4611856227b2f431c8af6ba90e18e8e Makefile.PL
SHA1 2ccaed7101fdf008f82836932528c12bf0509e31 README
SHA1 e28cf2d3ba35f6ca3a448acc7bee191b7c390379 inc/Module/Install.pm
SHA1 e7c1c86f57b6778f4bdc7fd8c1b950e60ef41bc0 inc/Module/Install/Base.pm
SHA1 e1829448769445cdaac384a888bf9ccf42e0d89a inc/Module/Install/Can.pm
SHA1 70aa5e2055e8e38b4eecc5fc8c91762c0e97f551 inc/Module/Install/Fetch.pm
SHA1 8ac832baf4f9e8e72d3e8f103cee6e8a94ac80e1 inc/Module/Install/Makefile.pm
SHA1 0807e79d6dbfda4fcd3db0fc7df2e33e0cba263b inc/Module/Install/Metadata.pm
SHA1 4da0a1fce2339cc3f8c296c7716480d2564d9470 inc/Module/Install/Win32.pm
SHA1 9a903a1d178954ad864c7dcc98f9fa5c005d1553 inc/Module/Install/WriteAll.pm
SHA1 62d97d30ca51cc7d05cefe77a053ecdfde5f982d lib/Filter/Macro.pm
SHA1 41afe2c04bb573b40e283e2b210ed70a47a3f8ba t/0-signature.t
SHA1 756db6465dfaadca5965949df142f71bd5909d01 t/1-basic.t
SHA1 b9c325b2d342a3764e77d683d8eac0497786d54b t/my_macro.pm
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (FreeBSD)
iD8DBQFEYrbItLPdNzw1AaARArInAKCFOjeXy+1jZ+m9IxYo+2GgWD+3cACfeC6Q
E0DEGsqiCcFtvwNMqEJ2xqc=
=irgj
-----END PGP SIGNATURE-----
lib/Filter/Macro.pm view on Meta::CPAN
package Filter::Macro;
$Filter::Macro::VERSION = '0.11';
use strict;
use Filter::Simple::Compile sub {
$_ = quotemeta($_);
s/\\\n/\n/g;
$_ = sprintf(q(
use Filter::Simple::Compile sub {
$_ = join("\n",
'#line '.(__LINE__+1).' '.__FILE__,
"%s",
lib/Filter/Macro.pm view on Meta::CPAN
);
};
1;
), $_, (caller(6))[2]+1, (caller(6))[1]);
};
1;
=head1 NAME
Filter::Macro - Make macro modules that are expanded inline
=head1 VERSION
This document describes version 0.11 of Filter::Macro, released
May 11, 2006.
=head1 SYNOPSIS
In F<MyHandyModules.pm>:
package MyHandyModules;
use Filter::Macro;
# lines below will be expanded into caller's code
use strict;
use warnings;
use Switch;
use IO::All;
use Quantum::Superpositions;
In your program or module:
use MyHandyModules; # lines above are expanded here
lib/Filter/Macro.pm view on Meta::CPAN
use Filter::Include;
include MyHandyModules;
However, it would be really nice if F<MyHandyModules.pm> could define the
macro-like semantic itself, instead of placing the burden on the caller.
This module lets you do precisely that. All you need to do is to put one
line in F<MyHandyModules.pm>, after the C<package MyHandyModules;> line:
use Filter::Macro;
With this, a program or module that says C<use Filter::Macro> will expand
lines below C<use Filter::Macro> into their own code, instead of the default
semantic of evaluating them in the C<MyHandyModules> package.
Line numbers in error and warning messages are unaffected by this module;
they still point to the correct file name and line numbers.
=head1 SEE ALSO
L<Filter::Include>, L<Filter::Simple::Cached>
=head1 AUTHORS
t/1-basic.t view on Meta::CPAN
#!/usr/bin/perl
use strict;
use FindBin;
use lib $FindBin::Bin;
use Test;
BEGIN { plan tests => 3 }
require Filter::Macro;
ok(Filter::Macro->VERSION);
use my_macro;
ok(1/2, 0);
ok(__LINE__, 14);
t/my_macro.pm view on Meta::CPAN
package my_macro;
use Filter::Macro;
use integer;
1;
( run in 1.929 second using v1.01-cache-2.11-cpan-483215c6ad5 )