Prev: FAQ 3.12 Where can I get perl-mode or cperl-mode for emacs?
Next: FAQ 4.72 How do I determine whether a scalar is a number/whole/integer/float?
From: PerlTrainee on 16 Jul 2010 22:01 Wished Justin you had given a better explaination. I am getting the same god damn error and I am not repeating those mistakes. I use SpreadSheet::ParseExcel for reading from an existing excel file. I use SpreadSheet::ParseExcel::SaveParser object to make changes to another existing excel file. Unfortunately accessing AddCell via SaveParser object also gives me the same error. It seems to be ignoring SaveParser object and and looking for AddCell() in ParseExcel only and then aborting the program
From: Sherm Pendley on 16 Jul 2010 23:12 PerlTrainee <user(a)compgroups.net/> writes: > I am getting the same god damn error and I am not repeating those > mistakes. If you're looking for sympathy, you have it - intractable bugs can be frustrating as hell. On the other hand, if you're looking for help, you'll need to post a short script that demonstrates the error you're seeing. We can't debug code we can't see! Have you read the posting guidelines that appear here frequently? sherm-- -- Sherm Pendley <www.shermpendley.com> <www.camelbones.org> Cocoa Developer
From: PerlTrainee on 17 Jul 2010 23:42 Okay, here is the code. Yesterday I was running the following program on Window 7 Professional 64 bit. I thought the OS was the culprit. I got this code from CSPAN website. So, I don't think there could be something wrong with the code. I ran the same code on my home computer with Window XP Professional 32 bit but got the same error. What I don't understand is I have specified SaveParser so why it wouldn't look for "AddCell" method there? Why it keeps looking for it in ParseExcel? use strict; use Spreadsheet::ParseExcel; use Spreadsheet::ParseExcel::SaveParser; my $parser = Spreadsheet::ParseExcel->new(); my $workbook1 = $parser->parse('C:\readMe.xls'); if ( !defined $workbook1 ) { die $parser->error(), ".\n"; } my $worksheet1 = $workbook1->worksheet('Sheet1'); my $parser2 = Spreadsheet::ParseExcel::SaveParser->new(); my $workbook2 = $parser2->parse('C:\writeMe.xls'); if (!defined $workbook2) { die $parser->error(),".\n"; } my $worksheet2 = $workbook2->worksheet('Sheet1'); if (!defined $worksheet2) { die ("can't open worksheet2"); } print "\n\n\n"; $worksheet2->AddCell(20,0,'380');
From: PerlTrainee on 17 Jul 2010 23:57 I have installed the ParseExcel v0.57 module and I read on CSPAN that this module contains SaveParser. So I don't think I need to install another package. I am running Perl 5.12. Is it possible that this module does not support this version of Perl?
From: Justin C on 18 Jul 2010 06:34
In article <9oydnXAOU-eE5d_RnZ2dnUVZ_qmdnZ2d(a)giganews.com>, PerlTrainee wrote: > Okay, here is the code. Yesterday I was running the following program on Window 7 Professional 64 bit. I thought the OS was the culprit. I got this code from CSPAN website. So, I don't think there could be something wrong with the code. I ran the same code on my home computer with Window XP Professional 32 bit but got the same error. > > What I don't understand is I have specified SaveParser so why it wouldn't look for "AddCell" method there? Why it keeps looking for it in ParseExcel? > > use strict; > use Spreadsheet::ParseExcel; > use Spreadsheet::ParseExcel::SaveParser; > > my $parser = Spreadsheet::ParseExcel->new(); > my $workbook1 = $parser->parse('C:\readMe.xls'); > > if ( !defined $workbook1 ) { > die $parser->error(), ".\n"; > } > > > my $worksheet1 = $workbook1->worksheet('Sheet1'); > my $parser2 = Spreadsheet::ParseExcel::SaveParser->new(); > my $workbook2 = $parser2->parse('C:\writeMe.xls'); I got your code to work by changing the above line to: my $workbook2 = $parser2->Parse('C:\writeMe.xls'); (note the upper-case 'P' ^ here) I don't pretend to be an expert, but I've done some investigation and I find that there are two methods defined: Parse, and parse, but they are not the same! The one with the upper-case P is in Spreadsheet::ParseExcel::SaveParser, the other is in Spreadsheet::ParseExcel. Even if I strip your code down to it's barest minimum which still shows the error (which is what you should have done, and you may have found this for yourself): #!/usr/bin/perl use warnings; use strict; use Spreadsheet::ParseExcel::SaveParser; my $parser2 = Spreadsheet::ParseExcel::SaveParser->new(); my $workbook2 = $parser2->parse('excel/xmas96.xls'); my $worksheet2 = $workbook2->worksheet('Sheet1'); $worksheet2->AddCell(20,0,'380'); __END__ I use modules in a lot of what I code, but when they are like this I don't really understand what is going on. I mean, is S::PE::SP dependant on S::PE? Could ...SaveParser be installed without S::PE? If I "use S::PE::SP" does S::PE automatically get "used" as well? Or does specifying ...SaveParser work like "use CGI qw/standard/" and only pull in the methods specified? I hope the OP gets something useful out of this, because all it's done is make me more confused. Justin. -- Justin C, by the sea. |