SYNOPSIS
This encapsulates ISO 9660 Filesystem Image handling. The class is often used in conjunction with Device::Cdio::ISO9660.
use Device::Cdio::ISO9660;
use Device::Cdio::ISO9660::IFS;
$iso = Device::Cdio::ISO9660::IFS->new(-source=>'copying.iso');
$id = $iso->get_application_id();
@file_stats = $iso->readdir($path);
foreach my $href (@file_stats) {
printf "%s [LSN %6d] %8d %s%s\n",
$href->{is_dir} ? "d" : "-",
$href->{LSN}, $href->{size},
$path,
Device::Cdio::ISO9660::name_translate($href->{filename});
}
DESCRIPTION
This is an Object-Oriented interface to the GNU CD Input and Control library ("libcdio") which is written in C. This class handles ISO 9660 aspects of an ISO 9600 image.An ISO-9660 image is distinct from a CD in a CD-ROM which has ISO-9660 tracks; the latter contains other CD-like information (e.g. tracks, information or assocated with the CD). An ISO-9660 filesystem image on the other hand doesn't and is generally file in some file system, sometimes with the file extension ``.iso''; perhaps it can be burned into a CD with a suitable tool, perhaps is can be ``mounted'' as a filesystem on some OS's.
CALLING ROUTINES
Routines accept named parameters as well as positional parameters. For named parameters, each argument name is preceded by a dash. For example:
Device::Cdio::ISO9660::IFS->new(-source=>'MYISO.ISO')
Each argument name is preceded by a dash. Neither case nor order matters in the argument list. -driver_id, -Driver_ID, and -DRIVER_ID are all acceptable. In fact, only the first argument needs to begin with a dash. If a dash is present in the first argument, we assume dashes for the subsequent parameters.
In the documentation below and elsewhere in this package the parameter name that can be used in this style of call is given in the parameter list. For example, for ``open'' the documentation below reads:
open(source, iso_mask=$pyiso9660::EXTENSION_NONE)->bool
So the parameters are ``source'', and ``is_mask''. The iso_mask parameter is not required and if not specified a value of $perliso9660:EXTENSION_NON will be used.
The older, more traditional style of positional parameters is also supported. So the "have_driver example from above can also be written:
Cdio::open($s, $i)
Finally, since no parameter name can be confused with an integer, negative values will not get confused as a named parameter.
METHODS
new
new(source, iso_mask)->$iso9660_object
Create a new ISO 9660 object. Source or iso_mask is optional.
If source is given, open() is called using that and the optional iso_mask parameter; iso_mask is used only if source is specified. If source is given but opening fails, undef is returned. If source is not given, an object is always returned.
close
close()->bool
Close previously opened ISO 9660 image and free resources associated with ISO9660. Call this when done using using an ISO 9660 image.
find_lsn
find_lsn(lsn)->$stat_href
Find the filesystem entry that contains LSN and return file stat information about it. "undef" is returned on error.
get_application_id
get_application_id()->$id
Get the application ID stored in the Primary Volume Descriptor. undef is returned if there is some problem.
get_preparer_id
get_preparer_id()->$id
Get the preparer ID stored in the Primary Volume Descriptor. undef is returned if there is some problem.
get_publisher_id
get_publisher_id()->$id
Get the publisher ID stored in the Primary Volume Descriptor. undef is returned if there is some problem.
get_root_lsn
get_root_lsn()->$lsn
Get the Root LSN stored in the Primary Volume Descriptor. undef is returned if there is some problem.
get_system_id
get_system_id()->$id
Get the Volume ID stored in the Primary Volume Descriptor. undef is returned if there is some problem.
get_volume_id
get_volume_id()->$id
Get the Volume ID stored in the Primary Volume Descriptor. undef is returned if there is some problem.
get_volumeset_id
get_volume_id()->$id
Get the Volume ID stored in the Primary Volume Descriptor. undef is returned if there is some problem.
open
open(source, iso_mask=$perliso9660::EXTENSION_NONE)->bool
Open an ISO 9660 image for reading. Subsequent operations will read from this ISO 9660 image.
This should be called before using any other routine except possibly new. It is implicitly called when a new is done specifying a source.
If device object was previously opened it is closed first.
See also open_fuzzy.
open_fuzzy
open_fuzzy(source, iso_mask=$perliso9660::EXTENSION_NONE, fuzz=20)->boolOpen an ISO 9660 image for reading. Subsequent operations will read from this ISO 9660 image. Some tolerence allowed for positioning the ISO9660 image. We scan for $perliso9660::STANDARD_ID and use that to set the eventual offset to adjust by (as long as that is <= $fuzz).
This should be called before using any other routine except possibly new (which must be called first. It is implicitly called when a new is done specifying a source.
See also open.
read_fuzzy_superblock
read_fuzzy_superblock(iso_mask=$perliso9660::EXTENSION_NONE, fuzz=20)->boolRead the Super block of an ISO 9660 image but determine framesize and datastart and a possible additional offset. Generally here we are not reading an ISO 9660 image but a CD-Image which contains an ISO 9660 filesystem.
readdir
readdir(dirname)->@iso_statRead path (a directory) and return a list of iso9660 stat references
Each item of @iso_stat is a hash reference which contains
- LSN
- the Logical sector number (an integer)
- size
- the total size of the file in bytes
- sec_size
- the number of sectors allocated
- filename
- the file name of the statbuf entry
- XA
- if the file has XA attributes; 0 if not
- is_dir
- 1 if a directory; 0 if a not;
FIXME: If you look at iso9660.h you'll see more fields, such as for Rock-Ridge specific fields or XA specific fields. Eventually these will be added. Volunteers?
read_pvd
read_pvd()->pvd
Read the Super block of an ISO 9660 image. This is the Primary Volume Descriptor (PVD) and perhaps a Supplemental Volume Descriptor if (Joliet) extensions are acceptable.
read_superblock
read_superblock(iso_mask=$perliso9660::EXTENSION_NONE)->bool
Read the Super block of an ISO 9660 image. This is the Primary Volume Descriptor (PVD) and perhaps a Supplemental Volume Descriptor if (Joliet) extensions are acceptable.
seek_read
seek_read(start, size=1)->(size, str)Seek to a position and then read n bytes. Size read is returned.
stat
stat(path, translate=0)->\%statReturn file status for path name psz_path. "undef" is returned on error.
If translate is 1, version numbers in the ISO 9660 name are dropped, i.e. ;1 is removed and if level 1 ISO-9660 names are lowercased.
Each item of @iso_stat is a hash reference which contains
- LSN
- the Logical sector number (an integer)
- size
- the total size of the file in bytes
- sec_size
- the number of sectors allocated
- filename
- the file name of the statbuf entry
- XA
- if the file has XA attributes; 0 if not
- is_dir
- 1 if a directory; 0 if a not.
AUTHORS
Rocky Bernstein "<rocky at cpan.org>".COPYRIGHT
Copyright (C) 2006, 2007, 2008 Rocky Bernstein <[email protected]>This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.