Acme-MITHALDU-XSGrabBag

 view release on metacpan or  search on metacpan

inc/Inline/C.pm  view on Meta::CPAN

    # insert any quotes that are needed, reinstate the whitespace
    # that was removed earlier, then join() the array back together
    # again.
    for (my $i = 0; $i < $s; $i++) {
        $in[$i] = '-I' . $in[$i] if $i;
        $in[$i] = '"' . $in[$i] . '"' if $q{$i};
        $in[$i] .= ' ' x $s{$i};
    }

    # Note: If there was no whitespace that needed quoting, the
    # original argument should not have changed in any way.

    my $out = join '', @in;
    $out =~ s/"\-I\s+\//"\-I\//g;
    $_[0] = $out;
}

#==============================================================================
# This routine used by C/t/09parser to test that the expected parser is in use
#==============================================================================

inc/Inline/Module.pm  view on Meta::CPAN


    return $manifest; # return a list of the files added
}

sub make_stub_modules {
    my ($class, @modules) = @_;
    DEBUG_ON && DEBUG "$class->make_stub_modules(@modules)";

    for my $module (@modules) {
        my $code = $class->proxy_module($module);
        my $path = $class->write_module('lib', $module, $code, 'onchange');
        if ($path) {
            print "Created stub module '$path' (Inline::Module $VERSION)\n";
        }
    }
}

sub read_local_module {
    my ($class, $module) = @_;
    eval "require $module; 1" or die $@;
    my $file = $module;

inc/Inline/Module.pm  view on Meta::CPAN

    DEBUG_ON && DEBUG "$class->read_file($filepath)";
    open IN, '<', $filepath
        or die "Can't open '$filepath' for input:\n$!";
    my $code = do {local $/; <IN>};
    close IN;
    return $code;
}

sub write_module {
    my $class = shift;
    my ($dest, $module, $code, $onchange) = @_;
    DEBUG_ON && DEBUG "$class->write_module($dest, $module, ..., $onchange)";
    $onchange ||= 0;

    $code =~ s/\n+__END__\n.*//s;

    my $filepath = $module;
    $filepath =~ s!::!/!g;
    $filepath = "$dest/$filepath.pm";
    my $dirpath = $filepath;
    $dirpath =~ s!(.*)/.*!$1!;
    File::Path::mkpath($dirpath);

    return if $onchange and
        -e $filepath and
        $class->read_file($filepath) eq $code;

    unlink $filepath;
    open OUT, '>', $filepath
        or die "Can't open '$filepath' for output:\n$!";
    print OUT $code;
    close OUT;

    return $filepath;



( run in 0.515 second using v1.01-cache-2.11-cpan-5dc5da66d9d )