2 # ============================================================================
3 # Zebra perl API header
4 # =============================================================================
7 # ============================================================================
8 package IDZebra::Service;
11 use IDZebra::Logger qw(:flags :calls);
12 use Scalar::Util qw(weaken);
14 our @ISA = qw(IDZebra::Logger);
17 # -----------------------------------------------------------------------------
18 # Class constructors, destructor
19 # -----------------------------------------------------------------------------
21 my ($proto,$configName) = @_;
22 my $class = ref($proto) || $proto;
24 $self->{configName} = $configName;
25 $self->{sessions} = {};
27 bless ($self, $class);
32 my ($proto,$configName) = @_;
34 if (ref($proto)) { $self = $proto; } else {
35 $self = $proto->new($configName);
37 unless (defined($self->{zs})) {
38 $self->{zs} = IDZebra::start($self->{configName});
45 foreach my $sess (values(%{$self->{sessions}})) {
48 IDZebra::stop($self->{zs}) if ($self->{zs});
56 # -----------------------------------------------------------------------------
58 # -----------------------------------------------------------------------------
61 my $session = IDZebra::Session->new($self);
62 $self->{sessions}{$self->{sessc}} = $session;
63 weaken ($self->{sessions}{$self->{sessc}});
70 my $session = IDZebra::Session->open($self);
71 $self->{sessions}{$self->{sessc}} = $session;
72 weaken ($self->{sessions}{$self->{sessc}});
93 Peter Popovics, pop@technomat.hu
97 IDZebra, IDZebra::Data1, Zebra documentation