/[wait]/branches/CPAN/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/CPAN/lib/WAIT/Parse/Base.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 19 - (show annotations)
Tue May 9 11:29:45 2000 UTC (24 years ago) by ulpfr
File size: 991 byte(s)
Import of WAIT-1.800

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;

Properties

Name Value
cvs2svn:cvs-rev 1.1.1.3

  ViewVC Help
Powered by ViewVC 1.1.26