Initial checkin of upstream version 4.09.
Signed-off-by: Thomas Hochstein <thh@inter.net>
This commit is contained in:
commit
ac7e2c541a
47 changed files with 8045 additions and 0 deletions
32
UVmessage.pm
Normal file
32
UVmessage.pm
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# UVmessages: parses resource strings and substitutes variables
|
||||
# Used by all components
|
||||
|
||||
package UVmessage;
|
||||
|
||||
use strict;
|
||||
use vars qw(@ISA @EXPORT_OK $VERSION);
|
||||
|
||||
require Exporter;
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT_OK = qw(get);
|
||||
|
||||
# Module version
|
||||
$VERSION = "0.1";
|
||||
|
||||
sub get {
|
||||
my ($key, %param) = @_;
|
||||
|
||||
my $string = $UVconfig::messages{$key} || return '';
|
||||
|
||||
while ($string =~ m/\$\{([A-Za-z0-9_-]+)\}/) {
|
||||
my $skey = $1;
|
||||
my $sval = $param{$skey};
|
||||
$sval = '' unless defined($sval);
|
||||
|
||||
$string =~ s/\$\{$skey\}/$sval/g;
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
1;
|
||||
Loading…
Add table
Add a link
Reference in a new issue