The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Spreadsheet::Reader::ExcelXML::ZipReader - Base Zip file reader

SYNOPSIS

        #!/usr/bin/env perl
        use MooseX::ShortCut::BuildInstance qw( build_instance );
        use lib '../../../../lib';
        use Spreadsheet::Reader::ExcelXML::ZipReader;
        use Spreadsheet::Reader::ExcelXML::WorkbookFileInterface;
        my      $test_file = '../../../../t/test_files/TestBook.xlsx';
        my      $test_instance =  build_instance(
                        package => 'WorkbookFileInterface',
                        superclasses => ['Spreadsheet::Reader::ExcelXML::ZipReader'],
                        add_roles_in_sequence =>[
                                'Spreadsheet::Reader::ExcelXML::WorkbookFileInterface',
                        ],
                        file => $test_file,
                );
        my $sub_file = $test_instance->extract_file( 'xl/workbook.xml' );
        print $sub_file->getline;

        ##############################################################
        # SYNOPSIS Screen Output
        # 01: <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
        ##############################################################

DESCRIPTION

This documentation is written to explain ways to use this module when writing your own excel parser. To use the general package for excel parsing out of the box please review the documentation for Workbooks, Worksheets, and Cells

This module provides a way to open a zip file or file handle and then extract sub files. This package uses Archive::Zip. Not all versions of Archive::Zip work for everyone. I have tested this with Archive::Zip 1.30. Please let me know if this does not work with a sucessfully installed (read passed the full test suit) version of Archive::Zip newer than that.

Attributes

Data passed to new when creating an instance. For modification of these attributes see the listed 'attribute methods'. For general information on attributes see Moose::Manual::Attributes. For ways to manage the instance when opened see the Methods.

file

    Definition: This attribute holds the file handle for the file being read. If the full file name and path is passed to the attribute it is coerced to an IO::File file handle. This file handle will be expected to pass the test

    Default: no default - this must be provided to read a file

    Required: yes

    Range: any Zip file name and path or IO::File file handle for a zip file

    attribute methods Methods provided to adjust this attribute

      set_file

        Definition: change the file value in the attribute (this will reboot the file instance and lock the file)

      get_file

        Definition: Returns the file handle of the file even if a file name was passed

      has_file

        Definition: this is used to see if the file loaded correctly.

      clear_file

        Definition: this clears (and unlocks) the file handle

    Delegated Methods

      close

        closes the file handle

file_type

    Definition: This stores the file type for this file. The type defaults to 'zip' for this reader.

    Default: zip

    Range: 'zip'

    attribute methods Methods provided to adjust this attribute

      get_file_type

        Definition: returns the attribute value

workbook_inst

    Definition: This attribute holds a reference to the top level workbook (parser). The purpose is to use some of the methods provided there.

    Default: no default

    Required: not strictly for this class but the attribute is provided to give self referential access to general workbook settings and methods for composed classes that inherit this a base class.

    Range: isa => 'Spreadsheet::Reader::ExcelXML::Workbook'

    attribute methods Methods provided to adjust this attribute

      set_workbook_inst

        set the attribute with a workbook instance

    Delegated Methods (required) Methods delegated to this module by the attribute. All methods are delegated with the method name unchanged. Follow the link to review documentation of the provider for each method. As you can see several are delegated through the Workbook level and don't originate there.

Methods

These are the methods provided by this class.

extract_file( $zip_sub_file )

    Definition: This will pull a subfile from the zipped package using the Archive::Zip method memberNamed and load it to a new 'IO::File->new_tmpfile' file handle.

    Accepts: $zip_sub_file compliant with the Archive::Zip method 'memberNamed'

    Returns: an IO::File handle loaded with the extracted target sub file for reading

loaded_correctly

    Definition: This will indicate if the zip reader was able to open the base file with Archive::Zip as a zip file.

    Accepts: nothing

    Returns: (1|0) 1 = good file

SUPPORT

TODO

    1. Nothing currently

AUTHOR

Jed Lund
jandrew@cpan.org

COPYRIGHT

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.

This software is copyrighted (c) 2016 by Jed Lund

DEPENDENCIES

SEE ALSO