Thanks at first, dear Ikegami.
I see that I have to describe a little bit more, what I'm trying to do. But bag you pardon, please don't laugh too much about me, it's my fault.
I have written now a short file of code, which should describe nearly, what I want to do.
___ testpar.pl ___
#!/usr/bin/perl
use objectA;
my %myhash = (
'a.x' => 1,
'b.y' => 2,
'c.x' => 3,
);
my $objA = objectA->new();
$objA->map_query( \%myhash );
print $_->name, ': ', $_->val, "\n" for $objA->parameter( 'a.x' );
print $_->name, ': ', $_->val, "\n" for $objA->parameter( 'b.y' );
return;
___ objectA.pm ___
package objectA;
sub new {
my $class = shift;
my $self = {};
bless $self, $class;
return $self;
}
sub map_query {
my $self = shift;
my $hash = shift;
map { $self->{ values }->{ $_ } = $$hash{ $_ }; } keys %{ $hash };
}
sub parameter {
my $self = shift;
my $para = shift;
my $param = $para =~ m/^([^\.]*\.)(.*?)$/i ? $2 : $para;
# return { sub name{ $param; }, sub value{ $self->{ values }->{ $pa
+ra } || ''; } };
my $name = \¶meter_name( $param );
my $val = \¶meter_value( $self->{ values }->{ $para } );
return { $name, $val };
}
sub parameter_name {
my $param = shift;
return $param;
}
sub parameter_value {
my $parval = shift;
return $parval || '';
}
1;