/[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

Annotation of /branches/CPAN/lib/WAIT/Parse/Base.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 13 - (hide annotations)
Fri Apr 28 15:42:44 2000 UTC (24 years, 1 month ago) by ulpfr
File size: 991 byte(s)
Import of WAIT-1.710

1 ulpfr 13 # -*- Mode: Cperl -*-
2 ulpfr 10 # 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: Sun Nov 22 18:44:42 1998
8     # Language : CPerl
9     # Update Count : 23
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 ulpfr 13
21 ulpfr 10 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}, $_[0]);
46     }
47    
48     1;

Properties

Name Value
cvs2svn:cvs-rev 1.1.1.2

  ViewVC Help
Powered by ViewVC 1.1.26