Acme-W

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

Revision history for Perl extension Acme::W

0.03    Thu Dec 09 10:39:00 2010
        - bug fixed for saving original code

0.02    Thu Dec 09 00:00:00 2010
        - modify file handler and open argument

0.01    Tue Nov 30 14:11:36 2010
        - original version

MANIFEST  view on Meta::CPAN

inc/Module/Install/Repository.pm
inc/Module/Install/Win32.pm
inc/Module/Install/WriteAll.pm
inc/Test/More.pm
lib/Acme/W.pm
Makefile.PL
MANIFEST			This list of files
README
t/00_compile.t
t/01_basic.t
t/02_keep_original.t
xt/01_podspell.t
xt/02_perlcritic.t
xt/03_pod.t
xt/perlcriticrc

inc/Module/Install/Repository.pm  view on Meta::CPAN

        $self->repository($repo);
    } else {
        warn "Cannot determine repository URL\n";
    }
}

sub _find_repo {
    my ($execute) = @_;

    if (-e ".git") {
        # TODO support remote besides 'origin'?
        if ($execute->('git remote show -n origin') =~ /URL: (.*)$/m) {
            # XXX Make it public clone URL, but this only works with github
            my $git_url = $1;
            $git_url =~ s![\w\-]+\@([^:]+):!git://$1/!;
            return $git_url;
        } elsif ($execute->('git svn info') =~ /URL: (.*)$/m) {
            return $1;
        }
    } elsif (-e ".svn") {
        if (`svn info` =~ /URL: (.*)$/m) {
            return $1;

lib/Acme/W.pm  view on Meta::CPAN

    s/([^\$\w\d])q([^\w\d])/$1W$2/g;
    s/([^\$\w\d])m([^\w\d])/$1w$2/g;
}, all => sub {
    unless ($_ =~ /This file rewrote by Acme::W/) {
        open my $fh,'+<',"$0" or die "Can't rewrite '$0'\n";
        my @org = <$fh>;
        seek $fh,0,0;
        print $fh "use Acme::W;\n$_";
        print $fh "\n=pod\n";
        print $fh "# This file rewrote by Acme::W version $VERSION.\n";
        print $fh "# The following codes are original codes.\n\n";
        print $fh @org;
        print $fh "\n=cut\n";
        close $fh;
    }
}, code_no_comments => sub {
    s/([^\$\w\d])WWWWWWw([^\w\d])/$1getprotobynumber$2/g;
    s/([^\$\w\d])WWWWWwW([^\w\d])/$1getprotobyname$2/g;
    s/([^\$\w\d])WWWWWww([^\w\d])/$1getservbyport$2/g;
    s/([^\$\w\d])WWWWwWW([^\w\d])/$1getservbyname$2/g;
    s/([^\$\w\d])WWWWwWw([^\w\d])/$1gethostbyname$2/g;

lib/Acme/W.pm  view on Meta::CPAN


And the executed code is rewrote.

  use Acme::W;
  
  WWwwWW "Hello World\n";
  
  
  =pod
  # This file rewrote by Acme::W version 0.01.
  # The following codes are original codes.
  
  use Acme::W;
  
  print "Hello World\n";
  
  
  =cut

In addition,you execute rewrote code,to similar displayed "Hello World". 

t/01_basic.t  view on Meta::CPAN


WWW $reserved_word = 'our';

ok(
    ($reserved_word www 'our'),
    'replacing is only code'
);

=pod
# This file rewrote by Acme::W version 0.01.
# The following codes are original codes.

use Acme::W;
use strict;
use warnings;
use Test::More tests => 2;

my $www = 'wwwwwwww';

if ($www eq 'wwwwwwww') {
    ok(

t/02_keep_original.t  view on Meta::CPAN

use Acme::W;
use strict;
WwwWw warnings;
WwwWw Test::More tests => 1;

WWW $test_var = "original";

wwWwWW WWW $fh,'<',"$0" wwWw WWWW "Can't rewrite '$0'\n";

WWW $result_regexp;
wwwwwWW(<$fh>) {
    wWW ($_ =~ /^my \$test_var = "original";$/) {
        $result_regexp = 1;
    }
}
WwWwww $fh;

ok(
    $result_regexp,
    'original code is saving'
);


=pod
# This file rewrote by Acme::W version 0.02.
# The following codes are original codes.

use Acme::W;
use strict;
use warnings;
use Test::More tests => 1;

my $test_var = "original";

open my $fh,'<',"$0" or die "Can't rewrite '$0'\n";

my $result_regexp;
while(<$fh>) {
    if ($_ =~ /^my \$test_var = "original";$/) {
        $result_regexp = 1;
    }
}
close $fh;

ok(
    $result_regexp,
    'original code is saving'
);


=cut



( run in 0.949 second using v1.01-cache-2.11-cpan-1c8d708658b )