blob: d9e4dc93446a4de16d3cd16592222e52d9a3a444 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
#-*- perl -*-
#
# Copyright (C) 2001 Ken'ichi Fukamachi
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
# $Id$
# $FML$
#
package FML::Ticket::System;
use strict;
use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD);
use Carp;
use FML::Errors qw(error_reason error error_reset);
use FML::Log qw(Log);
require Exporter;
@ISA = qw(Exporter);
sub new
{
my ($self) = @_;
my ($type) = ref($self) || $self;
my $me = {};
return bless $me, $type;
}
sub increment_id
{
my ($self, $seq_file) = @_;
use FML::SequenceFile;
my $sfh = new FML::SequenceFile { sequence_file => $seq_file };
my $id = $sfh->increment_id;
$self->error_reason( $sfh->error );
$id;
}
sub _pcb_set_id
{
my ($self, $curproc, $id) = @_;
my $pcb = $curproc->{ pcb }; # FML::PCB object
$pcb->set('ticket', 'id', $id);
}
sub _pcb_get_id
{
my ($self, $curproc) = @_;
my $pcb = $curproc->{ pcb }; # FML::PCB object
$pcb->get('ticket', 'id');
}
sub _init_ticket_db_dir
{
my ($self, $curproc, $args) = @_;
my $config = $curproc->{ config };
my $ml_name = $config->{ ml_name };
if (defined $self->{ _db_dir }) {
my $db_dir = $self->{ _db_dir };
unless (-d $db_dir) {
use FML::Utils qw(mkdirhier);
mkdirhier($db_dir, $config->{ default_directory_mode }) || do {
$self->error_reason( FML::Utils->error() );
return undef;
};
}
}
return 1;
}
sub _quote_space
{
my ($id) = @_;
$id =~ s/\s/_/g;
return $id;
}
sub _dequote_space
{
my ($id) = @_;
$id =~ s/_/ /g;
return $id;
}
sub AUTOLOAD
{
my ($self) = @_;
Log("FYI: unknown method $AUTOLOAD is called");
}
=head1 NAME
Ticket::System.pm - what is this
=head1 SYNOPSIS
=head1 DESCRIPTION
=head2 new
=item Function()
=head1 AUTHOR
=head1 COPYRIGHT
Copyright (C) 2001 __YOUR_NAME__
All rights reserved. This program is free software; you can
redistribute it and/or modify it under the same terms as Perl itself.
=head1 HISTORY
FML::__MODULE_NAME__.pm appeared in fml5.
=cut
1;
|