Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Nedeľa, 27. november 2022

Súbor: [Platon] / iotta / Iotta / Output / MetaFile.pm (stiahnutie)

Revízia 1.1.1.1, Sun Feb 16 15:48:13 2003 UTC (19 years, 9 months ago) by yenar


Zmeny od 1.1: +0 -0 [lines]

initial import of iotta into platon cvs

package Iotta::Output::Metafile;
use strict;
require Iotta::Elem;
our @ISA = ("Iotta::Elem");

sub run {
    my $s = shift;
    my $meta = shift;
    my $data = shift;
    my $file = $s->prepend . $$meta{input} . $s->append;
    my $dir = $file;
    $dir =~ s#^(.*)/.*?$#$1#;
    mkdirp ($dir);
    print STDERR "  writing meta ($file)...\n";
    open (FILE, ">$file") || return 1;
    foreach (keys %$meta) {
        print FILE "'$_' = '$$meta{$_}'\n";
    }
    close FILE;
    $s->next->run ($meta, $data) if ($s->next);
    return 0;
}

sub mkdirp {
    my $dir = shift;
    my $d;
    my @dirs = split /\//, $dir;
    for (@dirs) {
        $d .= "$_/";
        if (! -d $d) {
            #print STDERR "creating: $d\n";
            mkdir $d;
        }
    }
}

sub setup {
    my $s = shift;
    my $o = shift;
    $s->append ($$o{append});
    $s->prepend ($$o{prepend});
}

sub initialize {
    my $self = shift;
    $self->SUPER::initialize (@_);
    $self->{prepend}="";
    $self->{append}="";
}

1;

Platon Group <platon@platon.sk> http://platon.sk/
Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok