/[wait]/branches/unido/lib/WAIT/Parse/Base.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /branches/unido/lib/WAIT/Parse/Base.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 106 - (show annotations)
Tue Jul 13 12:22:09 2004 UTC (19 years, 8 months ago) by dpavlin
File size: 991 byte(s)
Changes made by Andreas J. Koenig <andreas.koenig(at)anima.de> for Unido project

1 # -*- Mode: Cperl -*-
2 # Base.pm --
3 # ITIID : $ITI$ $Header $__Header$
4 # Author : Ulrich Pfeifer
5 # Created On : Fri Sep 6 09:50:53 1996
6 # Last Modified By: Ulrich Pfeifer
7 # Last Modified On: Fri Apr 7 13:59:40 2000
8 # Language : CPerl
9 # Update Count : 24
10 # Status : Unknown, Use with caution!
11 #
12 # Copyright (c) 1996-1997, Ulrich Pfeifer
13 #
14
15 package WAIT::Parse::Base;
16 use Carp;
17
18 sub new {
19 my $type = shift;
20
21 bless {}, ref($type) || $type;
22 }
23
24 sub split {
25 my $self = shift;
26 my %result;
27 my @in = $self->tag(@_);
28
29 while (@in) {
30 my $tags = shift @in;
31 my $text = shift @in;
32 my @tags = grep /^[^_]/, keys %$tags;
33 for my $field (@tags) {
34 if (exists $result{$field}) { # make perl -w happy
35 $result{$field} .= ' ' . $text;
36 } else {
37 $result{$field} = $text;
38 }
39 }
40 }
41 return \%result; # we go for speed
42 }
43
44 sub tag {
45 ({text => 1}, $_[1]);
46 }
47
48 1;

  ViewVC Help
Powered by ViewVC 1.1.26