The disk.pm Module
Listing 15.1 contains the full disk.pm module. It includes the object constructor, new, as well as the accessory methods and get_disk.
Listing 15.1 also includes the function DESTROY, which is called when the disk.pm database object is destroyed. It closes the database by using the following statement to untie the hash:
277 untie $self–>{DISK_DATA};
The disk.pm module provides the following functions:
disks–>new — Creates a new database object
$db–>new_disk — Creates a disk
$db–>update_disk — Updates an entry
$db–>get_keys — Gets the IDs for all the disks
$db–>delete_disk — Deletes a disk
Listing 15.1. disk.pm
1 use strict; 2 use warnings; 3 4 package disks; 5 =pod 6 7 =head1 NAME 8 9 disks.pm – Data database manipulation ... |
Get Perl for C Programmers now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.