Home | 简体中文 | 繁体中文 | 杂文 | Search | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 作品与服务 | Email

6.2. ExtUtils::MakeMaker

I suggest that you use Module::Build instead of ExtUtils::MakeMaker.

过程 6.2. MakeMaker

  1. Makefile.PL

    use ExtUtils::MakeMaker;
    
    WriteMakefile(NAME      => 'Hello',
                  VERSION   => '1.00',
                  EXE_FILES => ['hello']
    );
    
    				
  2. MANIFEST

    Makefile.PL
    hello
    				
  3. hello

    #!/usr/bin/env perl
    
    use strict;
    use warnings;
    
    print "Hello, world!\n";
    				

    $ chmod u+x hello

  4. $ perl Makefile.PL

    neo@master:~/neo/unit-test$ perl Makefile.PL
    Checking if your kit is complete...
    Looks good
    Writing Makefile for Hello
    
    				
  5. $ make dist

    neo@master:~/neo/unit-test$ make dist
    rm -rf Hello-1.00
    \/usr/bin/perl "-MExtUtils::Manifest=manicopy,maniread" \
                    -e "manicopy(maniread(),'Hello-1.00', 'best');"
    mkdir Hello-1.00
    Generating META.yml
    Could not add META.yml to MANIFEST: Could not open MANIFEST: No such file or directory at /usr/share/perl/5.8/ExtUtils/Manifest.pm line 565.
    
    tar cvf Hello-1.00.tar Hello-1.00
    Hello-1.00/
    Hello-1.00/hello
    Hello-1.00/META.yml
    Hello-1.00/Makefile.PL
    rm -rf Hello-1.00
    gzip --best Hello-1.00.tar
    
    neo@master:~/neo/unit-test$ ls
    hello  Hello-1.00.tar.gz  Makefile  Makefile.PL  MANIFEST
    				

    get tarball ready to install with tar zxvf Hello-1.00.tar.gz; cd Hello-1.00; perl Makefile.PL; make; make install

  6. test

    make test
    				

    TEST_FILE

    make test TEST_FILE=t/hello.t
    				

    testdb

    make testdb TEST_FILE=t/hello.t
    				
comments powered by Disqus