in reply to Re^6: protect excel file in perl script
in thread protect excel file in perl script

Post code you have, tell us what you expect it do to, tell us how it fails. I've no idea what you're trying to ask in this post, or why you've copied a couple of lines form encryption.t. If you are actually asking what these lines of code do read about the is method form Test::More, keep in mind this example is a test for module functionality. See also Tutorials->PerlMonks for the Absolute Beginner/How do I post a question effectively?, http://learn.perl.org....

Replies are listed 'Best First'.
Re^8: protect excel file in perl script
by arunks (Novice) on Feb 01, 2017 at 14:35 UTC
    getting this below error:
    Can't locate object method "parse" via package "Spreadsheet::ParseExce +l" at pfiz_files2xl_merger.pl line 17.
    My code:
    #!/usr/bin/perl -w use strict; use Spreadsheet::WriteExcel; use Spreadsheet::ParseExcel; { my $filename = '/app/etl/Informatica/dev/PowerCenter/9.5/server/** +**3212.xls'; my @inputs = ( $filename, do { open my $fh, '<:raw:bytes', $filename or die; $fh }, do { open my $fh, '<:raw:bytes', $filename or die; local $/; m +y $d = <$fh>; \$d }, ); my $parser = Spreadsheet::ParseExcel->new(Password => '123q'); for my $input (@inputs) { my $workbook = $parser->parse($input); my $worksheet = $workbook->worksheet(0); my $cell = $worksheet->get_cell(1, 1); is($cell->value, 'abcdefgABCDEFG'); }
    below packages only installed in server
    -bash-3.2$ yum list all |grep perl *Note* Red Hat Network repositories are not listed below. You must run + this command as root to access RHN repositories. mod_perl.x86_64 2.0.4-6.el5 + installed newt-perl.x86_64 1.08-9.2.2 + installed perl.x86_64 4:5.8.8-43.el5_11 + installed perl-MIME-Lite.noarch 3.01-5.el5 + installed perl-MailTools.noarch 1.77-1.el5 + installed perl-OLE-Storage_Lite.noarch 0.19-1.el5 + installed perl-Spreadsheet-ParseExcel.x86_64 0.3200-3.el5 + installed perl-Spreadsheet-WriteExcel.noarch 2.37-1.el5.rf + installed perl-XML-Parser.x86_64 2.34-6.1.2.2.1 + installed perl-libwww-perl.noarch 5.805-1.1.1 + installed
      installed perl-Spreadsheet-ParseExcel.x86_64 0.3200-3.el5

      That looks like a version from 2007. Version 0.56 November 9 2009 has this comment

      Changed Parse() method name to parse() for consistency with the rest of the API. The older method name is still supported but not documented.

      so try

      my $workbook = $parser->Parse($input);
      poj
        Can you please provide the latest version link to download the package
        installed perl-Spreadsheet-ParseExcel.x86_64 0.3200-3.el5 we have this module version installed on Linux v5.8.8. our code is not making password protection excel sheets do we need to upgrade perl version or module version.please advice
        We have a requirement to protect excel sheet with password using Perl Script. Current version of Parse Excel Module which we have is " perl-Spreadsheet-ParseExcel.x86_64 0.3200-3.el5 " Issue Faced while upgrading current version into "perl package (Spreadsheet-ParseExcel-0.65.tar.gz)" : Unable to locate dependency modulesCan't locate Digest/Perl/MD5.pm in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-