Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Utorok, 19. marec 2024

Súbor: [Platon] / iotta / Iotta / Input / Header.pm (stiahnutie)

Revízia 1.2, Fri Mar 14 14:20:34 2003 UTC (21 years ago) by yenar


Zmeny od 1.1: +1 -0 [lines]

sort the topic-keyword array [Header.pm]

package Iotta::Input::Header;
use strict;
require Iotta::Elem;
our @ISA = ("Iotta::Elem");

sub trim {
    my $i = shift;
    $i =~ s/^[ \t\n]+//;
    $i =~ s/[ \t\n]+$//;
    return $i;
}

sub run {
    my $self = shift;
    my $m = shift;
    my $d = shift;
    my @topics;
    /()/;
    $d =~ s/^title:(.*?)\n//;
    $$m{title} = &trim ($1);
    $d =~ s/^topic:(.*?)\n//;
    @topics = split /,/, $1;
    @topics = map { &trim ($_) } @topics;
    push @topics, "unsorted" unless (scalar @topics);
    @topics = sort @topics;
    $$m{topics} = \@topics;
    $d =~ s/^format:(.*?)\n//;
    $$m{format} = &trim ($1);
    $d =~ s/^\n//;
    #$$m{name} = $name; # FIXME
    unless ($$m{title}) {
        my $title = $$m{name};
        $title =~ s!^./.*?/!!; # FIXME?
        $title =~ s!/!-!g;
        $$m{title} = $title;
    }
    $self->next->run ($m, $d) if ($self->next);
    return 0;
}

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

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