Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • #!/usr/local/bin/perl5.6.1

    use warnings;
    use strict;

    my($MODNAME) = @ARGV;

    mkdir($MODNAME);
    chdir($MODNAME);
    mkdir("t");
    mkdir("lib");
    mkdir("lib/$MODNAME");
    my $fh;
    foreach my $file (qw(README MANIFEST MANIFEST.SKIP Makefile.PL Changes))
    {
        open($fh, ">$file");
    }
    open($fh, ">lib/$MODNAME.pm");
    open($fh, ">t/00basic.t");

    open($fh, ">Makefile.PL") || die "Can't open Makefile.PL: $!";
    print $fh <<"EOF";
    use ExtUtils::MakeMaker;
    WriteMakefile(
            'NAME' => '$MODNAME',
            'VERSION_FROM' => 'lib/$MODNAME.pm',
            'PREREQ_PM' => {},
            'ABSTRACT_FROM' => 'lib/$MODNAME.pm',
            'AUTHOR' => 'Matt Sergeant <matt\@sergeant.org>',
    );
    EOF
    close($fh) || warn "Couldn't close Makefile.PL: $!";

    open($fh, ">t/00basic.t") || die "Can't open t/00basic.t: $!";
    print $fh <<"EOF";
    use Test;
    BEGIN { plan tests => 1 }
    END { ok(\$loaded) }
    use $MODNAME;
    \$loaded++;
    EOF
    close($fh) || warn "Couldn't close t/00basic.t: $!";

    open($fh, ">MANIFEST.SKIP") || die "Can't open MANIFEST.SKIP: $!";
    print $fh <<'EOF';
    CVS/.*
    \.bak$
    \.sw[a-z]$
    \.tar$
    \.tgz$
    \.tar\.gz$
    ^mess/
    ^tmp/
    ^blib/
    ^Makefile$
    ^Makefile\.[a-z]+$
    ^pm_to_blib$
    ~$
    EOF
    close($fh) || warn "Couldn't close MANIFEST.SKIP: $!";

    # Just to be cute ;)
    exec("$ENV{EDITOR} lib/$MODNAME.pm");
    --
    J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
    • Matt, can't tell you how helpful you've been to me in the past. Hope this helps you a little, or at least spurs some further thought. :) Obviously I'll be immediately updating my own personal copy of this not to say matt@sergeant.org for AUTHOR.

      Being the freak that I am, I'll also probably add strict and warnings to the test script, and add the package $MODNAME; and 1; statements into $MODNAME.pm.

      --
      J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
    • One thing this misses is the schizophrenic relationship in here between module name and module path - something I washed over in my journal entry.
      • Yes. I started thinking about that and then decided I would never get the program written, let alone posted, if I handled that issue.

        But, as the rough rocks in a stream get worn down smooth, I'm sure I will walk across that enough times in the future I (or someone else) will be motivated to fix that.

        Hmmmmm. How about Inline::Files to hold to contents of all those files that get set up?

        --
        J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
      • Done. :) It's in my journal, but I'm not sure if anyone's seen it. Am I the only one who ever looks at journals at random? I've got the journals slashbox at the top on my page.

        --
        J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
        • Don't know about other people, but my RSS fetcher regularly grabs the list of most recently changed journals and incorporates them into a news feed. It's somewhat indiscriminate in that it includes everyone, not just 'friends'. But that's good =)

          It would be nice to see a feature that lists journal entries since a particular date.
          --
            ---ict / Spoon