[interchange-cvs] interchange - jon modified 3 files

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Mon Apr 28 17:38:19 UTC 2008


User:      jon
Date:      2008-04-28 17:38:19 GMT
Modified:  .        MANIFEST WHATSNEW-5.5
Added:     eg       check_perl_itl
Log:
Add eg/check_perl_itl by Greg Sabino Mullane, for syntax-checking ITL [perl] and [calc] blocks.

Update MANIFEST, add expected 5.5.2 beta release date of tomorrow.

Revision  Changes    Path
2.223                interchange/MANIFEST


rev 2.223, prev_rev 2.222
Index: MANIFEST
===================================================================
RCS file: /var/cvs/interchange/MANIFEST,v
retrieving revision 2.222
retrieving revision 2.223
diff -u -u -r2.222 -r2.223
--- MANIFEST	17 Apr 2008 15:48:12 -0000	2.222
+++ MANIFEST	28 Apr 2008 17:38:19 -0000	2.223
@@ -17,6 +17,7 @@
 code/Filter/dbi_quote.filter
 code/Filter/decode_entities.filter
 code/Filter/digits.filter
+code/Filter/digits_dash.filter
 code/Filter/digits_dot.filter
 code/Filter/dos.filter
 code/Filter/duration.filter
@@ -293,6 +294,7 @@
 code/UserTag/save_cart.tag
 code/UserTag/summary.tag
 code/UserTag/table_organize.tag
+code/UserTag/timed_display.tag
 code/UserTag/title_bar.tag
 code/UserTag/ups_query.tag
 code/UserTag/usertrack.tag
@@ -328,6 +330,7 @@
 code/Widget/uploadhelper.widget
 code/Widget/value.widget
 code/Widget/yesno.widget
+code/Widget/ynzero.widget
 configure
 debian/400mod_interchange.info
 debian/catalogs.cfg
@@ -368,7 +371,9 @@
 debian/makecat.wrapper
 debian/po/cs.po
 debian/po/de.po
+debian/po/fi.po
 debian/po/fr.po
+debian/po/nl.po
 debian/po/POTFILES.in
 debian/po/pt.po
 debian/po/ru.po
@@ -999,11 +1004,13 @@
 dist/standard/variables/PAGE_INIT
 dist/standard/variables/THEME_CSS
 dist/subdomains.cfg
+eg/check_perl_itl
 eg/compact
 eg/cvv2.svg
 eg/filter/calculated.filter
 eg/gpg_display
 eg/ifdef
+eg/merge-tab-files
 eg/news_feature/dbconf/default_db/news.dbm
 eg/news_feature/dbconf/mysql/news.mysql
 eg/news_feature/dbconf/oracle/news.ora
@@ -1108,6 +1115,7 @@
 lib/Vend/Payment/MCVE.pm
 lib/Vend/Payment/NetBilling.pm
 lib/Vend/Payment/PRI.pm
+lib/Vend/Payment/Protx2.pm
 lib/Vend/Payment/PSiGate.pm
 lib/Vend/Payment/Sage.pm
 lib/Vend/Payment/Signio.pm



1.112                interchange/WHATSNEW-5.5


rev 1.112, prev_rev 1.111
Index: WHATSNEW-5.5
===================================================================
RCS file: /var/cvs/interchange/WHATSNEW-5.5,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -u -r1.111 -r1.112
--- WHATSNEW-5.5	25 Apr 2008 09:08:03 -0000	1.111
+++ WHATSNEW-5.5	28 Apr 2008 17:38:19 -0000	1.112
@@ -7,7 +7,7 @@
 
 See UPGRADE document for a list of incompatible changes.
 
-Interchange 5.5.2 (unreleased).
+Interchange 5.5.2 released on 2008-04-29.
 
 Core
 ----
@@ -387,6 +387,18 @@
 * Added missing dbconfig-common hooks and set defaults for database name and
   database user to interchange-cat-standard Debian package.
 
+Extra tools
+-----------
+
+* Added -o option to eg/te, which writes output to a file instead of calling
+  an editor.
+
+* Added eg/merge-tab-files, helpful for merging tab-delimited files on
+  matching keys.
+
+* Added eg/check_perl_itl, a helper for syntax-checking [calc] and [perl]
+  blocks in ITL pages from within an editor.
+
 
 ------------------------------------------------------------------------------
 



1.1                  interchange/eg/check_perl_itl


rev 1.1, prev_rev 1.0
Index: check_perl_itl
===================================================================
#!/usr/bin/perl -- -*-cperl-*-

## Check all the perl blocks embedded in ITL tags in one or more files
## Greg Sabino Mullane <greg at endpoint.com>

use strict;
use warnings;
use Getopt::Long;

our $VERSION = '1.0.1';

@ARGV or show_help();

my $opt= {
          verbose      => 0,
          keeptempfile => 0,
          quiet        => 0,
          };

GetOptions ## no critic (ProhibitCallsToUndeclaredSubs)
    ($opt,
     'verbose+',
     'help',
     'keeptempfile',
     'quiet'
     );

$opt->{help} and show_help();

sub show_help {

    print qq{
Usage: $0 [Options] filename(s)
Description: Checks that perl blocks in ITL code is valid
Options:
  --help          Show this help message
  --verbose       Verbose output
  --keeptempfile  Do not erase the temporary file(s) created
  --quiet         Show failing files only

};
    exit;
}

my %seenit;
for my $file (@ARGV) {
    next if $seenit{$file}++;
    if (-d $file) {
        $opt->{verbose} and print qq{** Skipping directory "$file"\n};
        next;
    }
    if (! -f $file) {
        $opt->{verbose} and print qq{** Skipping "$file"\n};
        next;
    }
    if ($file =~ /\.tmp$/o) {
        $opt->{verbose} and print qq{** Skipping temp file "$file"\n};
        next;
    }
    check_perl_itl($file);
}

exit;

sub check_perl_itl {

    my $file = shift;
    open my $rh, '<', $file or die qq{Could not open "$file": $!\n};

    my $tempfile = "$file.perltest.tmp";
    open my $wh, '>', $tempfile or die qq{Could not write "$tempfile": $!\n};
    $opt->{verbose} >= 2 and print qq{** Wrote "$tempfile"\n};
    my $top = qq{#!perl

## Temporary file created by extracting perl blocks from the file "$file"

use strict;
use warnings;
};
$top .= q{use vars qw/
$CGI
$CGI_array
$Carts
$Config
$DbSearch
$Document
$Scratch
$Session
$Tag
$TextSearch
$Tmp
$Values
$Variable
%Sql %Db
/;

};

    print $wh $top;
    my $templines = $top =~ tr/\n/\n/;

    my $inperl = 0;
    my $subnum = 0;
    my %mapline;
    while (<$rh>) {

        if (!$inperl) {
            next unless m{\[perl\s*([^\]]*)\](.*?)(\[/perl\])?$};
            my ($attr,$extra, $closetag) = ($1,$2,$3);
            $inperl = 1;
            $subnum++;
            print $wh "sub perl_itl_$subnum {\n";
            $templines++;
            if (length $extra and $extra =~ /\S/) {
                print $wh "$extra\n";
                $mapline{++$templines} = $.;
            }
            if ($closetag) {
                print $wh "\n} ## end of perl_itl_$subnum\n\n";
                $templines += 3;
                $inperl = 0;
            }
            next;
        }

        if (m{(.*)\Q[/perl]}o) {
            my $pre = $1;
            print $wh "$pre\n} ## end of perl_itl_$subnum\n\n";
            $templines += 3;
            $inperl = 0;
            next;
        }

        print $wh "$_";
        $mapline{++$templines} = $.;
    }
	close $wh or die qq{Could not close "$tempfile": $!\n};

    if ($opt->{verbose} >= 2) {
        print "** Subroutines found: $subnum\n";
        print "** Lines in original file: $.\n";
        print "** Lines in temp file: $templines\n";
    }

    close $rh or die qq{Could not close "$file": $!\n};

    my $errors = qx{perl -c $tempfile 2>&1};
    unlink $tempfile unless $opt->{keeptempfile};

    if ($errors !~ /had compilation errors/) {
        print qq{File "$file" had no Perl problems\n} unless $opt->{quiet};
        return;
    }

    print qq{File "$file" has the following Perl problems:\n};
    for my $line (split /\n/ => $errors) {
        next if $line =~ /had compilation errors/o;
        chomp $line;

        $line =~ s/at $tempfile line (\d+)\.?/exists $mapline{$1} ? "(line $mapline{$1})" : "(original line $1)"/e;
        print "--> $line\n";
    }

    return;
}








More information about the interchange-cvs mailing list