| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package File::Atomism::Protozoa; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
File::Atomism::Protozoa - CAD drawing as an atomised directory |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
A directory that contains multiple drawing entities each represented |
|
10
|
|
|
|
|
|
|
by a single file. |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
A simple file-system directory/folder that contains any number of |
|
15
|
|
|
|
|
|
|
drawing objects, represented by files; and optionally, any number of |
|
16
|
|
|
|
|
|
|
further drawings represented by subdirectories. |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Note that this is not completely analogous to a traditional |
|
19
|
|
|
|
|
|
|
monolithic CAD file format, as blocks/symbols associated with a |
|
20
|
|
|
|
|
|
|
drawing are complete drawings in their own right. |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=cut |
|
23
|
|
|
|
|
|
|
|
|
24
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
33
|
|
|
25
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
26
|
|
|
26
|
1
|
|
|
1
|
|
401
|
use SGI::FAM; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub Scan |
|
29
|
|
|
|
|
|
|
{ |
|
30
|
|
|
|
|
|
|
my $self = shift; |
|
31
|
|
|
|
|
|
|
my @freshfiles; |
|
32
|
|
|
|
|
|
|
my @stalefiles; |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
$self->_init; |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
while ($self->{_fam}->pending) |
|
37
|
|
|
|
|
|
|
{ |
|
38
|
|
|
|
|
|
|
my $event = $self->{_fam}->next_event; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
push (@freshfiles, $event->filename) |
|
41
|
|
|
|
|
|
|
if ($event->type =~ /^(create|change|exist)$/); |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
push (@stalefiles, $event->filename) |
|
44
|
|
|
|
|
|
|
if ($event->type eq 'delete'); |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# mark for canvas erase if file changed or removed |
|
47
|
|
|
|
|
|
|
$File::Atomism::EVENT->{_old}->{$self->{_path} . $event->filename} = 'TRUE' |
|
48
|
|
|
|
|
|
|
if ($event->type =~ /^(change|delete)$/); |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# mark for canvas draw if file new or changed |
|
51
|
|
|
|
|
|
|
$File::Atomism::EVENT->{_new}->{$self->{_path} . $event->filename} = 'TRUE' |
|
52
|
|
|
|
|
|
|
if ($event->type =~ /^(create|change|exist)$/); |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=pod |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Files titled "F" or beginning with "." or "_" are not considered part of |
|
58
|
|
|
|
|
|
|
the data and are therefore ignored. |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
@stalefiles = grep (!/^(DIRTYPE$|[._])/, @stalefiles); |
|
63
|
|
|
|
|
|
|
@freshfiles = grep (!/^(DIRTYPE$|[._])/, @freshfiles); |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
return \@freshfiles, \@stalefiles; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=pod |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
L (File Activation Monitor) is used to grapple the file list. |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub _init |
|
75
|
|
|
|
|
|
|
{ |
|
76
|
|
|
|
|
|
|
my $self = shift; |
|
77
|
|
|
|
|
|
|
unless ($self->{_fam}) |
|
78
|
|
|
|
|
|
|
{ |
|
79
|
|
|
|
|
|
|
$self->{_fam} = SGI::FAM->new; |
|
80
|
|
|
|
|
|
|
$self->{_fam}->monitor ($self->{_path}); |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
return $self; |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
# FIXME: needs Clone(), Delete(), Journal() and Rename() methods for elements |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
1; |