⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pl_files.pm

📁 source of perl for linux application,
💻 PM
字号:
package MakeMaker::Test::Setup::PL_FILES;@ISA = qw(Exporter);require Exporter;@EXPORT = qw(setup teardown);use strict;use File::Path;use File::Basename;use File::Spec;use MakeMaker::Test::Utils;my %Files = (             'PL_FILES-Module/Makefile.PL'   => <<'END',use ExtUtils::MakeMaker;# A module for testing PL_FILESWriteMakefile(    NAME     => 'PL_FILES::Module',    PL_FILES => { 'single.PL' => 'single.out',                  'multi.PL'  => [qw(1.out 2.out)],                  'Bar_pm.PL' => '$(INST_LIB)/PL/Bar.pm',    });END	     'PL_FILES-Module/single.PL'        => _gen_pl_files(),	     'PL_FILES-Module/multi.PL'         => _gen_pl_files(),	     'PL_FILES-Module/Bar_pm.PL'        => _gen_pm_files(),	     'PL_FILES-Module/lib/PL/Foo.pm' => <<'END',# Module to load to ensure PL_FILES have blib in @INC.package PL::Foo;sub bar { 42 }1;END);sub _gen_pl_files {    my $test = <<'END';#!/usr/bin/perl -w# Ensure we have blib in @INCuse PL::Foo;die unless PL::Foo::bar() == 42;# Had a bug where PL_FILES weren't sent the file to generatedie "argv empty\n" unless @ARGV;die "too many in argv: @ARGV\n" unless @ARGV == 1;my $file = $ARGV[0];open OUT, ">$file" or die $!;print OUT "Testing\n";close OUTEND    $test =~ s/^\n//;    return $test;}sub _gen_pm_files {    my $test = <<'END';#!/usr/bin/perl -w# Ensure we do NOT have blib in @INC when building a moduleeval { require PL::Foo; };#die $@ unless $@ =~ m{^Can't locate PL/Foo.pm in \@INC };# Had a bug where PL_FILES weren't sent the file to generatedie "argv empty\n" unless @ARGV;die "too many in argv: @ARGV\n" unless @ARGV == 1;my $file = $ARGV[0];open OUT, ">$file" or die $!;print OUT "Testing\n";close OUTEND    $test =~ s/^\n//;    return $test;}sub setup {    setup_mm_test_root();    chdir 'MM_TEST_ROOT:[t]' if $^O eq 'VMS';    while(my($file, $text) = each %Files) {        # Convert to a relative, native file path.        $file = File::Spec->catfile(File::Spec->curdir, split m{\/}, $file);        my $dir = dirname($file);        mkpath $dir;        open(FILE, ">$file") || die "Can't create $file: $!";        print FILE $text;        close FILE;    }    return 1;}sub teardown {     foreach my $file (keys %Files) {        my $dir = dirname($file);        if( -e $dir ) {            rmtree($dir) || return;        }    }    return 1;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -