The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Perl Module Phi01 Shell Programming and Scripting 13 03-02-2009 02:01 PM
Help with Perl Module NewDeb Shell Programming and Scripting 9 11-14-2008 08:34 PM
Perl Module Help suprcool Shell Programming and Scripting 7 07-25-2008 02:14 AM
help: error in installing perl module DBD::mysql Yogesh Sawant UNIX and Linux Applications 3 11-05-2007 08:22 AM
Replace Perl Module name in all Perl scripts rahulrathod Shell Programming and Scripting 2 12-02-2005 01:00 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-06-2009
zedex zedex is offline
Registered User
  
 

Join Date: Feb 2007
Location: india,mumbai
Posts: 139
Thumbs up 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
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:59 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0