You're not dereferencing enough. Following is a patch. And please, always turn on the warnings! And check your "open"s for failure.
Code:
--- proc4.pl 2010-08-18 09:53:02.000000000 -0700
+++ proc5.pl 2010-08-18 10:06:41.000000000 -0700
@@ -2,7 +2,7 @@
use strict;
-#use warnings;
+use warnings;
open IN_FILE, "<", "ctags_output.proc";
open LOG_STD, "+>", "parseCTAGS.log";
@@ -10,7 +10,7 @@
my @lines = <IN_FILE>;
close(IN_FILE);
-my $projectFolder = $ARGV[0];
+my $projectFolder = $ARGV[0] || ".";
my %project;
@@ -39,7 +39,7 @@
'path' => "$fileName",
'lineNo' => "$lineNo",
'super' => "$parent",
- 'subrountines' => ()
+ 'subroutines' => [],
};
}
next;
@@ -83,7 +83,8 @@
$package->setAttribute( 'name', $i );
$package->setAttribute( 'path', $project{$i}{'path'} );
$package->setAttribute( 'lineNo', $project{$i}{'lineNo'} );
- open PERL_FILE, "<", "$projectFolder/$project{$i}{'path'}";
+ if (open PERL_FILE, "<", "$projectFolder/$project{$i}{'path'}")
+ {
my @file = <PERL_FILE>;
#Write uses
@@ -96,6 +97,7 @@
}
}
close(PERL_FILE);
+ }
#Write subroutines
foreach ( @{ $project{$i}{'subroutines'} } ) {
@@ -103,9 +105,9 @@
use Data::Dumper;
print "$_---->";
print Dumper($_);
- print "$_{'name'},$_{'nu'}\n";
- $subroutine->setAttribute( 'name', $_{'name'} );
- $subroutine->setAttribute( 'lineNo', $_{'nu'} );
+ print "$_->{'name'},$_->{'nu'}\n";
+ $subroutine->setAttribute( 'name', $_->{'name'} );
+ $subroutine->setAttribute( 'lineNo', $_->{'nu'} );
$package->appendChild($subroutine);
}
$xml->appendChild($package);
Bookmarks