next MakeMaker is DOOMED! Slide #16

Example: Writing META.yml

And here's the code.

        my $meta = <<YAML;
    # http://module-build.sourceforge.net/META-spec.html
    #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
    name:         $self->{DISTNAME}
    version:      $self->{VERSION}
    version_from: $self->{VERSION_FROM}
    installdirs:  $self->{INSTALLDIRS}
    requires:
    $prereq_pm
    distribution_type: module
    generated_by: ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION
    YAML
        my @write_meta = $self->echo($meta, 'META_new.yml');
        my $move = $self->oneliner(<<'CODE', ['-MExtUtils::Command', '-MFile::Compare']);
    compare(@ARGV) != 0 ? (mv or warn "Cannot move @ARGV: $$!\n") : unlink(shift);
    CODE
        return sprintf <<'MAKE_FRAG', join("\n\t", @write_meta), $move;
    metafile :
            $(NOECHO) $(ECHO) Generating META.yml
            %s
            -$(NOECHO) %s META_new.yml META.yml
    MAKE_FRAG

Doesn't seem that bad, but this is *just to write a file*

Note the echo() and oneliner() methods, recent innovations.



next ToC Copyright © 2003 Michael G Schwern