June 2005
Beginner
480 pages
10h 31m
English
For this example, you're going to create a module to present information about a file. All of the information presented by this module is readily available in Perl through a variety of interfaces. In this module you're going to create functions for retrieving this information with convenient function names.
The module is presented in Listing 17.7.
1: #!/usr/bin/perl -w 2: 3: package TYPFileInfo; 4: use strict; 5: 6: use Exporter; 7: our @ISA=qw(Exporter); 8: our @EXPORT=qw(bytes lines name extension modified $FileInfoName); 9: 10: our $FileInfoName = ""; 11: 12: sub bytes { # Size of the file in bytes 13: return -s $FileInfoName; 14: } 15: sub ... |
Read now
Unlock full access