Sponsored Content
Full Discussion: perl module error
Top Forums Shell Programming and Scripting perl module error Post 302313820 by zedex on Wednesday 6th of May 2009 02:24:20 PM
Old 05-06-2009
MySQL perl module error

Hi

I am working on XMLDiff utility which is working only thing which is bug in this utility is that i used Excel file as the output file so that user can perform some operations on it ... now what i am doing is i am using Spreadsheet::Writeexcel module and its giving me problems ...

Code:
flow of my code logic :

-> create Excel object before main so it can be accessed in entire prog.
-> validate args 
-> validate XML files given
-> compare them 
-> print Difference in excel file

now problem is even when args are wrong i create excel ( empty ) file and i 
can not remove that file because it throws error as file in use. if i do close() on excel 
sheet nothing gets printed to file even when proper inputs are given


my ($General,$AddFormat,$DelFormat,$Heading) = "" ;

my ($workbook,$worksheet) ; 

   ## CREATING EXCEL OBJECT
   
$workbook = Spreadsheet::WriteExcel->new($file);
$workbook->set_properties(
      title    => 'XML difference file',
      comments => 'Created with Perl and Spreadsheet::WriteExcel'
   );
   
$worksheet = $workbook->add_worksheet('XML difference');
   
$AddFormat = $workbook->add_format( align => 'left' , color => 'green' );
$DelFormat = $workbook->add_format( align => 'left' , color => 'red');
$Heading   = $workbook->add_format( align => 'center', bold => 1);
$General   = $workbook->add_format( align => 'left' , color => 'blue');
   
$worksheet->add_write_handler(qr[\w], \&store_string_widths);

## if i dont put excel code here nothing gets printed in excel sheet
sub main ()
{
      # Validate all arguments
   &ValidateArgs ;

      # if args are wrong 
   $workbook->close() ;  # nothing works so where should i put excel object creation part ?
   unlink "$file" ;             

      # Check if its valid XML files just by looking at the extension.
      # 
   &IsValidXML("$oldfile") ;
   &IsValidXML("$newfile") ;
   
      # print Header in excel file
   &PrintHeader ;
   
      # Compare Both the XML files 
   &CompareXML("$oldfile","$newfile") ;
      
      # Display Final Information 
   &DisplayInfo ; 
}
main ;

got this thing working ... i forgot to close the excel object in script.

Last edited by otheus; 05-13-2009 at 11:21 AM.. Reason: got the solution
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace Perl Module name in all Perl scripts

I want to replace a Perl module name in all my Perl Scripts in the cgi-bin directory. How is it possible? I have the following statement in my scripts use myUtil; I want to change it to use myUtil777; Regards, Rahul (2 Replies)
Discussion started by: rahulrathod
2 Replies

2. UNIX and Linux Applications

help: error in installing perl module DBD::mysql

Hi, I am trying to install perl module DBD::mysql and don't know how to resolve the following: # make test PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/00base.............ok 3/5install_driver(mysql) failed: Can't load... (3 Replies)
Discussion started by: Yogesh Sawant
3 Replies

3. Shell Programming and Scripting

Perl Module

Hi, Please help me!! Im wondering if anyone can help me with a problem i have with some perl modules. My problem is: I'm trying to connect remote host to a unix box from a windows machine. So i'm developing an application to do this. I'm programming it in perl with tcl/tk Gui interface.... (13 Replies)
Discussion started by: Phi01
13 Replies

4. Shell Programming and Scripting

Perl - Error loading module.

Hi, I have a strange issue in my script. When script is run from command prompt it runs fine,but when run from cron it exist with error message. I narrowed down the issue and found that " use Mail::Sender;" is the culprit. If I comment the statment the code runs fine in both command and... (9 Replies)
Discussion started by: coolbhai
9 Replies

5. Shell Programming and Scripting

Which Perl Module to use?

Hi, I need to read an excel binary file and write the data to a text file. Is it possible using Spreadsheet-ParseExcel-0.58 ? If not, is there any module available in CPAN to do this? Thanks, Js (1 Reply)
Discussion started by: jisha
1 Replies

6. Shell Programming and Scripting

calling perl subroutine from perl expect module

All, Is it possible to call a subroutine from the perl expect module after logging to a system that is within the same program. My situation is I need to run a logic inside a machine that I'm logging in using the expect module, the logic is also available in the same expect program. Thanks,... (5 Replies)
Discussion started by: arun_maffy
5 Replies

7. Windows & DOS: Issues & Discussions

Strawberry perl - New TK module installation error

Hi, I am struggling in installing TK module for strawberry perl. I downloaded TK804 module, extracted to a folder, kept in c:/strawberry/perl/lib path, then from tht path 1) perl makefile.pl 2)dmake 3)dmake test 4)dmake install During perl makefile.pl it is giving error as... (3 Replies)
Discussion started by: vasanth.vadalur
3 Replies

8. Shell Programming and Scripting

Perl SSH without a perl module

I'm trying to create a perl script that will do 1 SSH session, but be able to write multiple commands to the session and receive multiple outputs. I know there are modules out there like Net:SSH::Perl, but I'm not allowed to use it. I was thinking of doing something like an open3 on an ssh... (4 Replies)
Discussion started by: mrwatkin
4 Replies

9. Shell Programming and Scripting

Perl module

I am recieiving an out of memory issue in my perl module while updating the records in the oracle table. Let me know what are the check or troubleshoot steps need to be done from my end to fix the issue. (1 Reply)
Discussion started by: ramkumar15
1 Replies

10. Shell Programming and Scripting

Perl module error in testing

PERL MODULE : To debug my perl module code in test environment. I have taken production module to the test in the my home path directory and was trying to test it by changing the below path in my test code. But still i am getting the error to debug it. can you please let me knw whether i am... (13 Replies)
Discussion started by: ramkumar15
13 Replies
PWD(1)							    BSD General Commands Manual 						    PWD(1)

NAME
pwd -- return working directory name SYNOPSIS
pwd [-L | -P] DESCRIPTION
The pwd utility writes the absolute pathname of the current working directory to the standard output. Some shells may provide a builtin pwd command which is similar or identical to this utility. Consult the builtin(1) manual page. The options are as follows: -L Display the logical current working directory. -P Display the physical current working directory (all symbolic links resolved). If no options are specified, the -P option is assumed. ENVIRONMENT
Environment variables used by pwd: PWD Logical current working directory. EXIT STATUS
The pwd utility exits 0 on success, and >0 if an error occurs. SEE ALSO
builtin(1), cd(1), csh(1), sh(1), getcwd(3) STANDARDS
The pwd utility conforms to IEEE Std 1003.1-2001 (``POSIX.1''). BUGS
In csh(1) the command dirs is always faster because it is built into that shell. However, it can give a different answer in the rare case that the current directory or a containing directory was moved after the shell descended into it. The -L option does not work unless the PWD environment variable is exported by the shell. BSD
April 12, 2003 BSD
All times are GMT -4. The time now is 03:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy