| 1 | package EBook::Ishmael::PDB; | ||||||||||||||||||||||||||||
| 2 | 17 | ▶ | use 5.016; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 17 | our $VERSION = '2.03'; | |||||||||||||||||||||||||||
| 4 | 17 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 17 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 17 | my $HEADER_COMMON = 78; | |||||||||||||||||||||||||||
| 8 | 17 | my $RECORD_INFO = 8; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | # Offset of Palm's Epoch (Jan 1, 1904) from Unix's Epoch (Jan 1, 1970) | ||||||||||||||||||||||||||||
| 11 | 17 | my $EPOCH_OFFSET = -2082844800; | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 17 | package EBook::Ishmael::PDB::Record { | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | sub new { | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 585 | ▶ | my $class = shift; | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | 585 | my $data = shift; | |||||||||||||||||||||||||||
| 19 | 585 | my $params = shift; | |||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | my $self = { | ||||||||||||||||||||||||||||
| 22 | Data => $data, | ||||||||||||||||||||||||||||
| 23 | Off => $params->{Offset}, | ||||||||||||||||||||||||||||
| 24 | Attr => $params->{Attributes}, | ||||||||||||||||||||||||||||
| 25 | UID => $params->{UID}, | ||||||||||||||||||||||||||||
| 26 | 585 | }; | |||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 585 | return bless $self, $class; | |||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | sub data { | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 386 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
data: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 386 | return $self->{Data}; | |||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | sub offset { | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
offset: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 0 | return $self->{Off}; | |||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | sub attributes { | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
attributes: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 0 | return $self->{Attr}; | |||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | sub uid { | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
uid: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 0 | return $self->{UID}; | |||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | sub new { | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | 42 | ▶ | my $class = shift; | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=15 SCAR=29.9
Pod
documented
| |||||||||||||||||||||||||||||
| 69 | 42 | my $pdb = shift; | |||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 42 | my $self = { | |||||||||||||||||||||||||||
| 72 | Name => undef, | ||||||||||||||||||||||||||||
| 73 | Attr => undef, | ||||||||||||||||||||||||||||
| 74 | Version => undef, | ||||||||||||||||||||||||||||
| 75 | CDate => undef, | ||||||||||||||||||||||||||||
| 76 | MDate => undef, | ||||||||||||||||||||||||||||
| 77 | BDate => undef, | ||||||||||||||||||||||||||||
| 78 | ModNum => undef, | ||||||||||||||||||||||||||||
| 79 | AppInfo => undef, | ||||||||||||||||||||||||||||
| 80 | SortInfo => undef, | ||||||||||||||||||||||||||||
| 81 | Type => undef, | ||||||||||||||||||||||||||||
| 82 | Creator => undef, | ||||||||||||||||||||||||||||
| 83 | UIDSeed => undef, | ||||||||||||||||||||||||||||
| 84 | NextRecList => undef, | ||||||||||||||||||||||||||||
| 85 | RecNum => undef, | ||||||||||||||||||||||||||||
| 86 | Recs => [], | ||||||||||||||||||||||||||||
| 87 | Size => undef, | ||||||||||||||||||||||||||||
| 88 | }; | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | 42 | ▶ | open my $fh, '<', $pdb | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 91 | or die "Failed to open $pdb for reading: $!\n"; | ||||||||||||||||||||||||||||
| 92 | 42 | binmode $fh; | |||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | 42 | seek $fh, 0, 2; | |||||||||||||||||||||||||||
| 95 | 42 | $self->{Size} = tell $fh; | |||||||||||||||||||||||||||
| 96 | 42 | seek $fh, 0, 0; | |||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | 42 | read $fh, my ($hdr), $HEADER_COMMON; | |||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | ( | ||||||||||||||||||||||||||||
| 101 | $self->{Name}, | ||||||||||||||||||||||||||||
| 102 | $self->{Attr}, | ||||||||||||||||||||||||||||
| 103 | $self->{Version}, | ||||||||||||||||||||||||||||
| 104 | $self->{CDate}, | ||||||||||||||||||||||||||||
| 105 | $self->{MDate}, | ||||||||||||||||||||||||||||
| 106 | $self->{BDate}, | ||||||||||||||||||||||||||||
| 107 | $self->{ModNum}, | ||||||||||||||||||||||||||||
| 108 | $self->{AppInfo}, | ||||||||||||||||||||||||||||
| 109 | $self->{SortInfo}, | ||||||||||||||||||||||||||||
| 110 | $self->{Type}, | ||||||||||||||||||||||||||||
| 111 | $self->{Creator}, | ||||||||||||||||||||||||||||
| 112 | $self->{UIDSeed}, | ||||||||||||||||||||||||||||
| 113 | $self->{NextRecList}, | ||||||||||||||||||||||||||||
| 114 | $self->{RecNum}, | ||||||||||||||||||||||||||||
| 115 | 42 | ) = unpack "a32 n n N N N N N N N N N N n", $hdr; | |||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | 42 | ▶ | unless ($self->{Name} =~ /\0$/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 118 | 0 | die "$self->{Source} is not a PDB file, name is not null-terminated\n"; | |||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | 42 | ▶ | unless ($self->{NextRecList} == 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 122 | 0 | die "$pdb is not a PDB file\n"; | |||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | 42 | ▶ | if ($self->{RecNum} == 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 126 | 0 | die "PDB $pdb has no records\n"; | |||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | # If the epoch offset knocks the time below zero, then that probably means | ||||||||||||||||||||||||||||
| 130 | # that the time was stored as a Unix time. | ||||||||||||||||||||||||||||
| 131 | $self->{CDate} &&= $self->{CDate} + $EPOCH_OFFSET > 0 | ||||||||||||||||||||||||||||
| 132 | ? $self->{CDate} + $EPOCH_OFFSET | ||||||||||||||||||||||||||||
| 133 | 42 | ▶ | : $self->{CDate}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"CDate"} &&= $self->{"CDate"} + $EPOCH_OFFSET > 0 ? $self->{"CDate"} + $EPOCH_OFFSET : $self->{"CDate"}
MC/DC0%0/2
$self->{"CDate"} &&= $self->{"CDate"} + $EPOCH_OFFSET > 0 ? $self->{"CDate"} + $EPOCH_OFFSET : $self->{"CDate"}
$self->{"CDate"}
$self->{"CDate"} + $EPOCH_OFFSET > 0 ? $self->{"CDate"} + $EPOCH_OFFSET : $self->{"CDate"}
Truth table33%1/3
A &&= B
A= $self->{"CDate"}B= $self->{"CDate"} + $EPOCH_OFFSET > 0 ? $self->{"CDate"} + $EPOCH_OFFSET : $self->{"CDate"}
| |||||||||||||||||||||||||||||
| 134 | $self->{MDate} &&= $self->{MDate} + $EPOCH_OFFSET > 0 | ||||||||||||||||||||||||||||
| 135 | ? $self->{MDate} + $EPOCH_OFFSET | ||||||||||||||||||||||||||||
| 136 | 42 | ▶ | : $self->{MDate}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"MDate"} &&= $self->{"MDate"} + $EPOCH_OFFSET > 0 ? $self->{"MDate"} + $EPOCH_OFFSET : $self->{"MDate"}
MC/DC0%0/2
$self->{"MDate"} &&= $self->{"MDate"} + $EPOCH_OFFSET > 0 ? $self->{"MDate"} + $EPOCH_OFFSET : $self->{"MDate"}
$self->{"MDate"}
$self->{"MDate"} + $EPOCH_OFFSET > 0 ? $self->{"MDate"} + $EPOCH_OFFSET : $self->{"MDate"}
Truth table33%1/3
A &&= B
A= $self->{"MDate"}B= $self->{"MDate"} + $EPOCH_OFFSET > 0 ? $self->{"MDate"} + $EPOCH_OFFSET : $self->{"MDate"}
| |||||||||||||||||||||||||||||
| 137 | $self->{BDate} &&= $self->{BDate} + $EPOCH_OFFSET > 0 | ||||||||||||||||||||||||||||
| 138 | ? $self->{BDate} + $EPOCH_OFFSET | ||||||||||||||||||||||||||||
| 139 | 42 | ▶ | : $self->{BDate}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"BDate"} &&= $self->{"BDate"} + $EPOCH_OFFSET > 0 ? $self->{"BDate"} + $EPOCH_OFFSET : $self->{"BDate"}
MC/DC0%0/2
$self->{"BDate"} &&= $self->{"BDate"} + $EPOCH_OFFSET > 0 ? $self->{"BDate"} + $EPOCH_OFFSET : $self->{"BDate"}
$self->{"BDate"}
$self->{"BDate"} + $EPOCH_OFFSET > 0 ? $self->{"BDate"} + $EPOCH_OFFSET : $self->{"BDate"}
Truth table33%1/3
A &&= B
A= $self->{"BDate"}B= $self->{"BDate"} + $EPOCH_OFFSET > 0 ? $self->{"BDate"} + $EPOCH_OFFSET : $self->{"BDate"}
| |||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | 42 | my @recs; | |||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | 42 | for my $i (0 .. $self->{RecNum} - 1) { | |||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | 585 | read $fh, my ($buf), $RECORD_INFO; | |||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | 585 | my $rec = {}; | |||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | ( | ||||||||||||||||||||||||||||
| 150 | $rec->{Offset}, | ||||||||||||||||||||||||||||
| 151 | $rec->{Attributes}, | ||||||||||||||||||||||||||||
| 152 | $rec->{UID}, | ||||||||||||||||||||||||||||
| 153 | 585 | ) = unpack "N C C3", $buf; | |||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | 585 | ▶ | if ($rec->{Offset} > $self->{Size}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 156 | 0 | die "Malformed PDB file: $pdb\n"; | |||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | 585 | push @recs, $rec; | |||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | 42 | for my $i (0 .. $self->{RecNum} - 1) { | |||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | my $size = $i == $self->{RecNum} - 1 | ||||||||||||||||||||||||||||
| 166 | ? $self->{Size} - $recs[$i]->{Offset} | ||||||||||||||||||||||||||||
| 167 | 585 | ▶ | : $recs[$i + 1]->{Offset} - $recs[$i]->{Offset}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | 585 | seek $fh, $recs[$i]->{Offset}, 0; | |||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | 585 | read $fh, my ($buf), $size; | |||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||
| 173 | 585 | push @{ $self->{Recs} }, EBook::Ishmael::PDB::Record->new( | |||||||||||||||||||||||||||
| 174 | $buf, | ||||||||||||||||||||||||||||
| 175 | $recs[$i] | ||||||||||||||||||||||||||||
| 176 | ); | ||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||
| 180 | 42 | return bless $self, $class; | |||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | sub name { | ||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | 26 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
name: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | 26 | return $self->{Name} =~ s/\0+$//r; | |||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | sub attributes { | ||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||
| 194 | 4 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
attributes: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | 4 | return $self->{Attr}; | |||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||
| 200 | sub version { | ||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | 15 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
version: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||
| 204 | 15 | return $self->{Version}; | |||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||
| 208 | sub cdate { | ||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||
| 210 | 92 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
cdate: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||
| 212 | 92 | return $self->{CDate}; | |||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | sub mdate { | ||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | 92 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
mdate: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | 92 | return $self->{MDate}; | |||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||
| 224 | sub bdate { | ||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | 4 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
bdate: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | 4 | return $self->{BDate}; | |||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | sub modnum { | ||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||
| 234 | 4 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
modnum: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||
| 236 | 4 | return $self->{ModNum}; | |||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||
| 240 | sub app_info { | ||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||
| 242 | 4 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
app_info: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | 4 | return $self->{AppInfo}; | |||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||
| 248 | sub sort_info { | ||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||
| 250 | 4 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
sort_info: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||
| 252 | 4 | return $self->{SortInfo}; | |||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | sub type { | ||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | 4 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
type: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | 4 | return $self->{Type}; | |||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||
| 264 | sub creator { | ||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||
| 266 | 4 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
creator: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | 4 | return $self->{Creator}; | |||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||
| 272 | sub uid_seed { | ||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||
| 274 | 4 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
uid_seed: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | 4 | return $self->{UIDSeed}; | |||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||
| 280 | sub next_rec_list { | ||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||
| 282 | 4 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
next_rec_list: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||
| 284 | 4 | return $self->{NextRecList}; | |||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||
| 288 | sub recnum { | ||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||
| 290 | 24 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
recnum: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||
| 292 | 24 | return $self->{RecNum}; | |||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||
| 296 | sub record { | ||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||
| 298 | 386 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
record: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 299 | 386 | my $rec = shift; | |||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||
| 301 | 386 | return $self->{Recs}->[$rec]; | |||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||
| 305 | sub records { | ||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||
| 307 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
records: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||
| 309 | 0 | return @{ $self->{Recs} }; | |||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||
| 313 | sub size { | ||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||
| 315 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
size: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||
| 317 | 0 | return $self->{Size}; | |||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||
| 321 | 17 | 1; | |||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||
| 323 | =head1 NAME | ||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||
| 325 | EBook::Ishmael::PDB - ishmael PDB interface | ||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||
| 327 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||
| 329 | use EBook::Ishmael::PDB; | ||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||
| 331 | my $pdb = EBook::Ishmael::PDB->new($file); | ||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||
| 333 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||
| 335 | B<EBook::Ishmael::PDB> is a simple interface for reading Palm PDB files. | ||||||||||||||||||||||||||||
| 336 | For L<ishmael> user documentation, you should consult its manual (this is | ||||||||||||||||||||||||||||
| 337 | developer documentation). | ||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||
| 339 | =head1 METHODS | ||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||
| 341 | =head2 $p = EBook::Ishmael::PDB->new($pdb) | ||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||
| 343 | Returns a blessed C<EBook::Ishmael::PDB> object representing the given | ||||||||||||||||||||||||||||
| 344 | PDB file C<$pdb>. | ||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||
| 346 | =head2 $n = $p->name() | ||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||
| 348 | Returns the PDB's name (with the null characters stripped out). | ||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||
| 350 | =head2 $a = $p->attributes() | ||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||
| 352 | Returns the PDB's attribute bitfield. | ||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||
| 354 | =head2 $v = $p->version() | ||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||
| 356 | Returns the PDB's version. | ||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||
| 358 | =head2 $c = $p->cdate() | ||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||
| 360 | Returns the PDB's creation date. | ||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||
| 362 | =head2 $m = $p->mdate() | ||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||
| 364 | Returns the PDB's modification date. | ||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||
| 366 | =head2 $b = $p->bdate() | ||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||
| 368 | Returns the PDB's backup date. | ||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||
| 370 | =head2 $m = $p->modnum() | ||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||
| 372 | Returns the PDB's modification number. | ||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||
| 374 | =head2 $a = $p->app_info() | ||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||
| 376 | Returns the PDB's app info area offset. | ||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||
| 378 | =head2 $s = $p->sort_info() | ||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||
| 380 | Returns the PDB's sort info area offset. | ||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||
| 382 | =head2 $t = $p->type() | ||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||
| 384 | Returns the PDB's type. | ||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||
| 386 | =head2 $c = $p->creator() | ||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||
| 388 | Returns the PDB's creator. | ||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||
| 390 | =head2 $u = $p->uid_seed() | ||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||
| 392 | Returns the PDB's UID seed. | ||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||
| 394 | =head2 $n = $p->next_rec_list() | ||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||
| 396 | Returns the PDB's next record list (should always be C<0>). | ||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||
| 398 | =head2 $r = $p->recnum() | ||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||
| 400 | Returns the PDB's record count. | ||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||
| 402 | =head2 $r = $p->record($rec) | ||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||
| 404 | Returns the C<$r>th record object in the PDB object. | ||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||
| 406 | =head2 @r = $p->records() | ||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||
| 408 | Returns array of record objects in the PDB object. | ||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||
| 410 | =head2 $s = $p->size() | ||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||
| 412 | Returns the PDB's size. | ||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||
| 414 | =head1 EBook::Ishmael::PDB::Record | ||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||
| 416 | Class representing a PDB record, returned by the PDB's C<record()> method. | ||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||
| 418 | =head1 METHODS | ||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||
| 420 | =head2 $rec = EBook::Ishmael::PDB::Record->new($data, %params) | ||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||
| 422 | Creates a new record. | ||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||
| 424 | The following are valid parameters, and all are required. | ||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||
| 426 | =over 4 | ||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||
| 428 | =item Offset | ||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||
| 430 | Offset of data in PDB database. | ||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||
| 432 | =item Attributes | ||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||
| 434 | Bitmask of record attributes. | ||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||
| 436 | =item UID | ||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||
| 438 | UID of record. | ||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||
| 440 | =back | ||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||
| 442 | =head2 $data = $rec->data() | ||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||
| 444 | Returns data held in record. | ||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||
| 446 | =head2 $off = $rec->offset() | ||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||
| 448 | Returns offset of record. | ||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||
| 450 | =head2 $attr = $rec->attributes() | ||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||
| 452 | Returns record's attribute bitmask. | ||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||
| 454 | =head2 $uid = $rec->uid() | ||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||
| 456 | Returns record's UID. | ||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||
| 458 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||
| 460 | Written by Samuel Young, E<lt>samyoung12788@gmail.comE<gt>. | ||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||
| 462 | This project's source can be found on its | ||||||||||||||||||||||||||||
| 463 | L<Codeberg Page|https://codeberg.org/1-1sam/ishmael>. Comments and pull | ||||||||||||||||||||||||||||
| 464 | requests are welcome! | ||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||
| 466 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||
| 468 | Copyright (C) 2025-2026 Samuel Young | ||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||
| 470 | This program is free software: you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 471 | it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||
| 472 | the Free Software Foundation, either version 3 of the License, or | ||||||||||||||||||||||||||||
| 473 | (at your option) any later version. | ||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||
| 475 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||
| 477 | L<EBook::Ishmael::PDB::Record> | ||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||
| 479 | =cut | ||||||||||||||||||||||||||||