Initial checkin of upstream version 4.09.
[usenet/usevote.git] / UVmessage.pm
CommitLineData
ac7e2c54
TH
1# UVmessages: parses resource strings and substitutes variables
2# Used by all components
3
4package UVmessage;
5
6use strict;
7use vars qw(@ISA @EXPORT_OK $VERSION);
8
9require Exporter;
10@ISA = qw(Exporter);
11@EXPORT_OK = qw(get);
12
13# Module version
14$VERSION = "0.1";
15
16sub get {
17 my ($key, %param) = @_;
18
19 my $string = $UVconfig::messages{$key} || return '';
20
21 while ($string =~ m/\$\{([A-Za-z0-9_-]+)\}/) {
22 my $skey = $1;
23 my $sval = $param{$skey};
24 $sval = '' unless defined($sval);
25
26 $string =~ s/\$\{$skey\}/$sval/g;
27 }
28
29 return $string;
30}
31
321;
This page took 0.010257 seconds and 4 git commands to generate.