https://github.com/mons/devel-rewrite
Development preprocessor for perl code
https://github.com/mons/devel-rewrite
Last synced: 8 months ago
JSON representation
Development preprocessor for perl code
- Host: GitHub
- URL: https://github.com/mons/devel-rewrite
- Owner: Mons
- License: other
- Created: 2010-02-10T18:17:34.000Z (over 16 years ago)
- Default Branch: master
- Last Pushed: 2010-02-15T11:38:29.000Z (over 16 years ago)
- Last Synced: 2025-08-13T20:55:47.166Z (10 months ago)
- Language: Perl
- Homepage: http://search.cpan.org/dist/Devel-Rewrite
- Size: 113 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
- Changelog: Changes
- License: LICENSE
Awesome Lists containing this project
README
NAME
Devel::Rewrite - Development preprocessor
SYNOPSIS
# Your::Module:
# @rewrite s/^#\s+//;
# use Some::Development::Module;
# @rewrite s/some_call/another_call/;
$object->some_call;
sub something {
# @include sub.debug.inc
...
}
And in author tests:
# xt/some-development-test.t:
use strict;
{
use Devel::Rewrite;
use Modules::That::Should::Be::Rewrited;
}
use Modules::Other;
# make your tests...
Also this module implements pragmatic behaviour.
use Devel::Rewrite;
use Module1; # rewrite enabled;
{
no Devel::Rewrite;
use Module2; # rewrite disabled;
{
use Devel::Rewrite;
use Module3; # rewrite enabled;
}
use Module4; # rewrite disabled;
}
use Module5; # rewrite enabled;
DESCRIPTION
The main purpose of this module is creating optional debugging routines.
- which does not require any additional prerequsites for production,
like for ex Devel::Leak::Cb
- which does not provide any perfomance overhead in production
enveronment.
- which requires no rebuild of target modules for enabling debugging
routines
In other words, this module is external source filter, for any loading
modules
IMPORTANT NOTICE
This module overloads "CORE::GLOBAL::require" on "import". Since this is
module loading endpoint, it won't call any previously overloaded
So, if you use something, like as, load this package earlier, than as
Also, please, don't use this module inside your modules. Only in
external scripts and applications. That's because there is no way to
change the behaviour of "use"'d module inside your sources
DIRECTIVES
@include filename
Include source of "filename" into directive place. Rewrite
subprocessing of include will be done. "filename" should be relative
to file, which call @include
# Module.pm:
sub yoursub {
my @args = @_;
# @include debug.inc
...
}
# debug.inc:
warn "Entered sub";
@rewrite EXPR
Call EXPR in context of next non-empty source line
sub test {
# @rewrite s/'not\s+/'/;
return 'not rewritten';
}
If next non-empty line is another directive, rewrite is ifnored and
warning is emitted
AUTHOR
Mons Anderson, ""
SUPPORT
You can look for information at:
* RT: CPAN's request tracker
* AnnoCPAN: Annotated CPAN documentation
* CPAN Ratings
* Search CPAN
* GitHub
COPYRIGHT & LICENSE
Copyright 2010 Mons Anderson.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.