[31772] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3035 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jul 18 14:09:23 2010

Date: Sun, 18 Jul 2010 11:09:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 18 Jul 2010     Volume: 11 Number: 3035

Today's topics:
    Re: Can not locate object method "AddCell" via package  <user@compgroups.net/>
    Re: Can not locate object method "AddCell" via package  <spamtrap@shermpendley.com>
    Re: Can not locate object method "AddCell" via package  <user@compgroups.net/>
    Re: Can not locate object method "AddCell" via package  <user@compgroups.net/>
    Re: Can not locate object method "AddCell" via package  <justin.1007@purestblue.com>
    Re: Can not locate object method "AddCell" via package  <spamtrap@shermpendley.com>
    Re: Can not locate object method "AddCell" via package  <hjp-usenet2@hjp.at>
    Re: regex inserting a - for every third digit in a numb <erling.kopperdal@lyse.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Fri, 16 Jul 2010 21:01:13 -0500
From: PerlTrainee <user@compgroups.net/>
Subject: Re: Can not locate object method "AddCell" via package "Spreadsheet:: 	ParseExcel ::Workbook"
Message-Id: <1IednWoa_6V0k9zRnZ2dnUVZ_iydnZ2d@giganews.com>

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




------------------------------

Date: Fri, 16 Jul 2010 23:12:42 -0400
From: Sherm Pendley <spamtrap@shermpendley.com>
Subject: Re: Can not locate object method "AddCell" via package "Spreadsheet:: 	ParseExcel ::Workbook"
Message-Id: <m24ofy94yd.fsf@shermpendley.com>

PerlTrainee <user@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


------------------------------

Date: Sat, 17 Jul 2010 22:42:17 -0500
From: PerlTrainee <user@compgroups.net/>
Subject: Re: Can not locate object method "AddCell" via package "Spreadsheet:: 	ParseExcel ::Workbook"
Message-Id: <9oydnXAOU-eE5d_RnZ2dnUVZ_qmdnZ2d@giganews.com>

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');





------------------------------

Date: Sat, 17 Jul 2010 22:57:38 -0500
From: PerlTrainee <user@compgroups.net/>
Subject: Re: Can not locate object method "AddCell" via package "Spreadsheet:: 	ParseExcel ::Workbook"
Message-Id: <9NmdnVWd0dsv5t_RnZ2dnUVZ_qCdnZ2d@giganews.com>

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?




------------------------------

Date: Sun, 18 Jul 2010 11:34:04 +0100
From: Justin C <justin.1007@purestblue.com>
Subject: Re: Can not locate object method "AddCell" via package "Spreadsheet:: 	ParseExcel ::Workbook"
Message-Id: <st1bh7-god.ln1@purestblue.com>

In article <9oydnXAOU-eE5d_RnZ2dnUVZ_qmdnZ2d@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.


------------------------------

Date: Sun, 18 Jul 2010 12:53:00 -0400
From: Sherm Pendley <spamtrap@shermpendley.com>
Subject: Re: Can not locate object method "AddCell" via package "Spreadsheet:: 	ParseExcel ::Workbook"
Message-Id: <m2bpa420lv.fsf@shermpendley.com>

PerlTrainee <user@compgroups.net/> writes:

> I read on CSPAN that

This really isn't the place to discuss politics. :-)

sherm--

-- 
Sherm Pendley                <www.shermpendley.com>
                             <www.camelbones.org>
Cocoa Developer


------------------------------

Date: Sun, 18 Jul 2010 17:18:03 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Can not locate object method "AddCell" via package "Spreadsheet:: 	ParseExcel ::Workbook"
Message-Id: <slrni466pb.a6c.hjp-usenet2@hrunkner.hjp.at>

On 2010-07-18 10:34, Justin C <justin.1007@purestblue.com> wrote:
> In article <9oydnXAOU-eE5d_RnZ2dnUVZ_qmdnZ2d@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.

They could even both be spelled the same.

$parser is an object of the class 'Spreadsheet::ParseExcel', so 
$parser->parse() calls Spreadsheet::ParseExcel::parse.

$parser2 is an object of the class
'Spreadsheet::ParseExcel::SaveParser', so $parser2->Parse() calls
Spreadsheet::ParseExcel::SaveParser::Parse().


> 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?

Maybe. It depends on how S::PE::SP is written. The documentation of
S::PE::SP should answer your questions. If it doesn't mention S:PE at
all, then S::PE::SP is probably completely independent of S::PE.

> If I "use
> S::PE::SP" does S::PE automatically get "used" as well?

No. S::PE::SP may use S::PE, but if it does, any symbols exported by
S::PE are only imported into S::PE::SP, not into your current package.

Note that in object-oriented Perl, symbols are not usually exported:
Instead the full class name is used for class methods like new, and
instance methods are referenced via the object anyway. So if you use
class A and class A uses class B, you can use class B just as if you had
used it yourself.

	hp


------------------------------

Date: Sat, 17 Jul 2010 18:51:42 +0200
From: "lennie" <erling.kopperdal@lyse.net>
Subject: Re: regex inserting a - for every third digit in a number from right to left
Message-Id: <deKdnTUO_bs0QtzRnZ2dnUVZ8sWdnZ2d@lyse.net>

Thanks all.  This was helpful.

Regards
Erling

"lennie" <erling.kopperdal@lyse.net> skrev i melding 
news:ltqdnRPPT_lVN93RnZ2dnUVZ7tednZ2d@lyse.net...
> Hi group!
>
> Apologies if this is trvial for you, but I try to construct a s/ / /g that 
> will insert a -  for every third digit in a number from right to left, ie:
> 123456 -> 123-456
> 1234567 -> 1-234-567
> 123 -> 123  (no - as first char)
> etc..
>
> It might be possible to do this with a cpan library function, but I would 
> like to have this done in a simple sentence.
>
> Regards
> Erling
> 




------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 3035
***************************************


home help back first fref pref prev next nref lref last post