Christian Brink escribió:
This is a program I wrote awhile ago to syntax check UserTags without a restart. You do need the File::Temp perl module.Thanks for sharing this with the community. This comes in very handy, as many of us are customizing or developing UserTags.Change the location of the 'lib' directory if needed. #!/usr/bin/perl use strict; use warnings; use File::Temp; my $fn = $ARGV[0] || die "File Name Required\n"; my $debug = $ARGV[1] || 0; my @lines;push(@lines,"use lib qw| /usr/local/interchange/lib/ |; \n"); #Change if neededpush(@lines,"use strict; \n"); push(@lines,"use warnings; \n"); push(@lines,'my $Session;'," \n"); push(@lines,'my $Tag;'," \n"); push(@lines,'my $Variable;'," \n"); my $line_in = scalar(@lines); my $line_out = 0; open(FH,"<$fn") or die "Could not open $fn\n"; while (my $line = <FH>) { $line =~ s/^sub\s+{/sub foobar {/; ++$line_out && next if ( $line =~ /^UserTag/ ); ++$line_out && next if ( $line =~ /^EOR/ ); ++$line_out && next if ( $line =~ /^EOD/ ); push @lines, $line; } print @lines if $debug; my $cnt = $line_out - $line_in; my $tmp = new File::Temp(); print $tmp @lines; my @report = `perl -c $tmp 2>&1 `; foreach (@report) { if ( /line (\d+)/ ) { my $was = $1; my $now = $was + $cnt; s/line $was/line $now/; } print "$_"; } $tmp->DESTROY; _______________________________________________ interchange-users mailing list suppressed http://www.icdevgroup.org/mailman/listinfo/interchange-users
Miguel zambra.com _______________________________________________ interchange-users mailing list suppressed http://www.icdevgroup.org/mailman/listinfo/interchange-users
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.