Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: "write" problem with "Spreadsheet::WriteExcel" Module

by 2teez (Priest)
on Oct 07, 2013 at 10:30 UTC ( #1057241=note: print w/ replies, xml ) Need Help??


in reply to "write" problem with "Spreadsheet::WriteExcel" Module

Why not like thus:
ExcelUtil.pm

package ExcelUtil; use warnings; use strict; use vars qw(@ISA @EXPORT); @ISA = qw(Exporter); @EXPORT = qw(writeCell); sub writeCell { my ( $obj, $row, $col, $str ) = @_; $obj->write( $row, $col, $str ); } 1;
testExcel.pl
use warnings; use strict; use Spreadsheet::WriteExcel; use ExcelUtil; my $wrk_bk = Spreadsheet::WriteExcel->new('sample.xls'); my $wrk_sht = $wrk_bk->add_worksheet('new_sheet'); writeCell( $wrk_sht, 1, $_, "Testing, Row-1, Col-$_" ) for 1..5;
Update:
Why even calling the subroutine within it module like you did in your "ExcelUtil.pm" like this
writeCell(1, 2, "testing, Row-1, Col-2");
With the code shown above you can even do like this: writeCell( $wrk_sht, $_, 1, "Testing, Row-$_, Col-1" ) for 1..5; And it still works for you.

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me


Comment on Re: "write" problem with "Spreadsheet::WriteExcel" Module
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1057241]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (16)
As of 2015-07-01 17:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (12 votes), past polls