Acme-ComeFrom

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

        Starting from version 0.05, the value of EXPR is evaluated each
        time, instead of the old *frozen at the first check* behaviour. If
        this breaks your code -- as if there's any code based on comefrom --
        You may retain the original behaviour by assigning a true value to
        $Acme::ComeFrom::CacheEXPR.

    comefrom &NAME
        The "comefrom-&NAME" form is quite different from the other forms of
        "comefrom". In fact, it isn't a comefrom in the normal sense at all,
        and doesn't have the stigma associated with other "comefrom"s.
        Instead, it installs a post-processing handler for the subroutine,
        and a jump would be made just *after* the subroutine's execution.

    If two or more "comefrom" were applied to the same LABEL, EXPR or NAME,
    they will be executed simultaneously via "fork()". The forking are
    ordered by their occurrances, with the parent process receiving the last
    one.

BUGS
    This module does not really parse perl; it guesses label names quite
    accurately, but the regex matching the "comefrom" itself could catch

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

sub fix_up_makefile {
	my $self          = shift;
	my $makefile_name = shift;
	my $top_class     = ref($self->_top) || '';
	my $top_version   = $self->_top->VERSION || '';

	my $preamble = $self->preamble 
		? "# Preamble by $top_class $top_version\n"
			. $self->preamble
		: '';
	my $postamble = "# Postamble by $top_class $top_version\n"
		. ($self->postamble || '');

	local *MAKEFILE;
	open MAKEFILE, "< $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!";
	my $makefile = do { local $/; <MAKEFILE> };
	close MAKEFILE or die $!;

	$makefile =~ s/\b(test_harness\(\$\(TEST_VERBOSE\), )/$1'inc', /;
	$makefile =~ s/( -I\$\(INST_ARCHLIB\))/ -Iinc$1/g;
	$makefile =~ s/( "-I\$\(INST_LIB\)")/ "-Iinc"$1/g;
	$makefile =~ s/^(FULLPERL = .*)/$1 "-Iinc"/m;

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

	$makefile =~ s/^PERL_LIB = .+/PERL_LIB =/m;
	#$makefile =~ s/^PERL_ARCHLIB = .+/PERL_ARCHLIB =/m;

	# Perl 5.005 mentions PERL_LIB explicitly, so we have to remove that as well.
	$makefile =~ s/("?)-I\$\(PERL_LIB\)\1//g;

	# XXX - This is currently unused; not sure if it breaks other MM-users
	# $makefile =~ s/^pm_to_blib\s+:\s+/pm_to_blib :: /mg;

	open  MAKEFILE, "> $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!";
	print MAKEFILE  "$preamble$makefile$postamble" or die $!;
	close MAKEFILE  or die $!;

	1;
}

sub preamble {
	my ($self, $text) = @_;
	$self->{preamble} = $text . $self->{preamble} if defined $text;
	$self->{preamble};
}

sub postamble {
	my ($self, $text) = @_;
	$self->{postamble} ||= $self->admin->postamble;
	$self->{postamble} .= $text if defined $text;
	$self->{postamble}
}

1;

__END__

#line 363

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


    my $code = '';

    if (%subs) {
        require Hook::LexWrap;
        $code .= 'require Hook::LexWrap;';
    }

    while ( my ( $k, $v ) = each %subs ) {
        my $chunk = make_chunk($v);
        $code .= "Hook::LexWrap::wrap($k, post => sub { $chunk });";
    }

    if (@tokens) {
        $source =~ s!(\n\s*)([a-zA-Z_]\w+):!
            my $label = $2;
            my $chunk = make_chunk(
                [ @counts, exists $labels{$label} ? @{$labels{$label}} : ()],
                $label, \@tokens
            ) unless substr($label, 0, length($Mark)) eq $Mark;

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

instead of the old I<frozen at the first check> behaviour.  If this
breaks your code -- as if there's any code based on comefrom --
You may retain the original behaviour by assigning a true value
to C<$Acme::ComeFrom::CacheEXPR>.

=item comefrom &NAME

The C<comefrom-&NAME> form is quite different from the other forms of
C<comefrom>.  In fact, it isn't a comefrom in the normal sense at all,
and doesn't have the stigma associated with other C<comefrom>s.  Instead,
it installs a post-processing handler for the subroutine, and a jump
would be made just I<after> the subroutine's execution.

=back

If two or more C<comefrom> were applied to the same LABEL, EXPR or NAME,
they will be executed simultaneously via C<fork()>.  The forking are
ordered by their occurrances, with the parent process receiving
the last one.

=head1 BUGS



( run in 0.763 second using v1.01-cache-2.11-cpan-ceb78f64989 )