S
sam
Hi,
I need to use hash on a private member variable.
But I don't know how to make it happen. Here is the code:
#!/usr/bin/perl
package dbm_lib;
use strict;
use Time::Local;
use Data:umper;
sub new {
my $class = shift;
my $self = { _map => undef };
bless ($self, $class);
return $self;
}
sub gen_name()
{
my $self = shift;
localtime(time);
return rand(time).".pl";
}
sub create()
{
my $self = shift;
my ($name) = "/usr/local/code.dbm";
dbmopen($self->{%_map},$name,0666);
$file_name = $self->gen_name();
$status = "0"; # 0 - not yet execute; 1 - had been executed.
$val = join("\t",$file_name, ,$status);
$map{$file_name} = $val;
}
sub cclose()
{
my $self = shift;
dbmclose($self->{_map});
}
1;
Thanks
Sam
I need to use hash on a private member variable.
But I don't know how to make it happen. Here is the code:
#!/usr/bin/perl
package dbm_lib;
use strict;
use Time::Local;
use Data:umper;
sub new {
my $class = shift;
my $self = { _map => undef };
bless ($self, $class);
return $self;
}
sub gen_name()
{
my $self = shift;
localtime(time);
return rand(time).".pl";
}
sub create()
{
my $self = shift;
my ($name) = "/usr/local/code.dbm";
dbmopen($self->{%_map},$name,0666);
$file_name = $self->gen_name();
$status = "0"; # 0 - not yet execute; 1 - had been executed.
$val = join("\t",$file_name, ,$status);
$map{$file_name} = $val;
}
sub cclose()
{
my $self = shift;
dbmclose($self->{_map});
}
1;
Thanks
Sam