NAME

Device::Cdio::ISO9660::IFS - Class for ISO9660 filesystem reading

SYNOPSIS

This encapsulates IS9660 filesystem handling. This library however needs to be used in conjunction with Device::Cdio.

use Device::Cdio::ISO9660:IFS;
...

DESCRIPTION

This is an Perl Object-Oriented interface to the GNU CD Input and Control library (libcdio) which is written in C. The library encapsulates CD-ROM reading and control. Perl programs wishing to be oblivious of the OS- and device-dependent properties of a CD-ROM can use this library.

The encapsulation is done in two parts. The lower-level Perl interface is called perliso9660 and is generated by SWIG.

The more object-oriented package Device::Cdio::ISO9660 and uses uses perliso9660.

Although perliso9660 is perfectly usable on its own, it is expected that Cdio is what most people will use. As perlcdio more closely models the C interface, it is conceivable (if unlikely) that die-hard libcdio C users who are very familiar with that interface could prefer that.

See also http://www.gnu/org/software/libcdio/libcdio.html for more complete description and http://www.gnu/org/software/libcdio/libcdio.html of the C library from which this is based, and http://www.gnu.org/software/libcdio/doxygen/files.html for API

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 "close tray the documentation below reads:

close_tray(drive=undef, driver_id=$perlcdio::DRIVER_UNKNOWN) 
 -> ($drc, $driver_id)

So the parameter names are "drive", and "driver_id". Neither parameter is required. If "drive" is not specified, a value of "undef" will be used. And if "driver_id" is not specified, a value of $perlcdio::DRIVER_UNKNOWN is used.

The older, more traditional style of positional parameters is also supported. So the "have_driver example from above can also be written:

Cdio::have_driver('GNU/Linux')

Finally, since no parameter name can be confused with a an integer, negative values will not get confused as a named parameter.

METHODS

new

new(source, iso_mask)->$track_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

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 statu return 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_perparer_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=$libiso9660::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.

open_fuzzy

open_fuzzy(source, iso_mask=$libiso9660::EXTENSION_NONE, fuzz=20)->bool

Open 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.

read_fuzzy_superblock

read_fuzzy_superblock(iso_mask=$libiso9660::EXTENSION_NONE, fuzz=20)->bool

Read 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_stat

Read 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=$libiso9660::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)->\%stat

Return file status for path name psz_path. NULL 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;

SEE ALSO

Device::Cdio for general information on the CD Input and Control Library, Device::Cdio::Device for device objects and Device::Cdio::Track for track objects.

perliso9660 is the lower-level interface to libcdio.

http://www.gnu.org/software/libcdio has documentation on libcdio including the a manual and the API via doxygen.

AUTHORS

Rocky Bernstein <rocky at cpan.org>.

COPYRIGHT

Copyright (C) 2006 Rocky Bernstein <rocky@cpan.org>

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 2 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, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA