-3

I need to create an excel file with perl script...i tryed to search on internet...but anyone "answer" my question! In particular i need to write the records on excel sheet...pls help :D

i receive this error:

Can't locate Spreadsheet/WriteExcel.pm in @INC (@INC contains: /opt/oracle/product/10.2.0/db_1/perl/lib/site_perl/5.8.3/Apache/DBI.pm /servizio/arbor/FXGA/ARBOR3P/perl/lib/5.8.7/IA64.ARCHREV_0-LP64 /servizio/arbor/FXGA/ARBOR3P/perl/lib/5.8.7 /servizio/arbor/FXGA/ARBOR3P/perl/lib/site_perl/5.8.7/IA64.ARCHREV_0-LP64 /servizio/arbor/FXGA/ARBOR3P/perl/lib/site_perl/5.8.7 /servizio/arbor/FXGA/ARBOR3P/perl/lib/site_perl .) at script.pl line 8.

this is my code:

use strict;
use warnings;
use DBI;
use Spreadsheet::WriteExcel;
.
.
.
my $workbook = Spreadsheet::WriteExcel->new('perl.xls') or die "Errore nella creazione del file .xls";
.
.
.

This line generate the error...in particular i don t understand what means "@INC contains...", how can i clear this array?? thanks

toolic
  • 57,801
  • 17
  • 75
  • 117
chaw359
  • 13
  • 2
  • 10

2 Answers2

0

The error means that Perl cannot locate the Spreadsheet::WriteExcel module in its search path, which is stored in the @INC array. You need to install Spreadsheet::WriteExcel, for example:

cpan Spreadsheet::WriteExcel

See also: What's the easiest way to install a missing Perl module?

Community
  • 1
  • 1
toolic
  • 57,801
  • 17
  • 75
  • 117
0

First thing first, if you want to use Perl and all his power you need to understand CPAN.

What is happening to you is that your Perl version is not able to find the module Spreadsheet/WriteExcel.pm, normally for that you have 2 options:

  • install the module from the distro like if you use a Debian distro apt-get install perl-Spreadsheet-WriteExcel or something similar, I don't know the package name.

  • Use CPAN to install it sudo perl -MCPAN -e 'install Spreadsheet::WriteExcel' you need to be root for that.

My advice is to have a look on perlbrew and install an isolated version of perl for developing your script. That would help you to also test with the latest version of perl (yes perl has several versions out there).