develooper Front page | perl.perl5.porters | Postings from March 2006

Using Perl to run Visual Basic code

Thread Next
March 24, 2006 14:57
Using Perl to run Visual Basic code
Message ID:
I have a Perl script running under version 5.8.5 on a sun4-solaris

I have coded it to process a very small subset of Visual Basic code that
is stored in an XML document.  I currently use an eval to run the code
reference (anonymous subroutine).  There are actually 5 separate scripts
in this XML document.  One of the script fields is:

<SCRIPT>' Data.Value function changed to specify number of characters to
pad input for Perl where needed
Dim year
Dim month
Dim day
Dim century

century = Left(Data.Value("Orig IR Chng Date CYY", 3), 1)
year = Right(Data.Value("Orig IR Chng Date CYY", 3), 2)
month = Left(Data.Value("Orig IR Chng Date MMDD", 4), 2)
day = Right(Data.Value("Orig IR Chng Date MMDD", 4), 2)

If IsNumeric(century) And IsNumeric(year) And IsNumeric(month) And
IsNumeric(day) Then

    century = 1900 + (100 * CLng(century))

    year = century + CLng(year)

    Target.Value = Application.MakeDate(month, day, year)


My perl script  translates it into:
# Data.Value function changed to specify number of characters to pad
input for Perl where needed
my $year;
my $month;
my $day;
my $century;

$century = Left(DataValue("Orig IR Chng Date CYY", 3), 1);
$year = Right(DataValue("Orig IR Chng Date CYY", 3), 2);
$month = Left(DataValue("Orig IR Chng Date MMDD", 4), 2);
$day = Right(DataValue("Orig IR Chng Date MMDD", 4), 2);

if (IsNumeric($century) and IsNumeric($year) and IsNumeric($month) and
IsNumeric($day)) {

    $century = 1900 + (100 * CLng($century));

    $year = $century + CLng($year);

    $TargetValue = ApplicationMakeDate($month, $day, $year);


I return the Perl code as return sub { $PerlCode };  storing the code
reference in a hash element.  My eval statement is:
 eval $g_Layout{$column}{Script}() if

It takes a long time to run (23 minutes to process 324,834 records) and
I get the "Out of memory!" error after about 700,000 records.  Is there
a better way of doing this so as to avoid the eval?

/mmrg/usr/local/bin/perl -V
Summary of my perl5 (revision 5 version 8 subversion 5) configuration:
    osname=solaris, osvers=2.8, archname=sun4-solaris
    uname='sunos mmrg2003 5.8 generic_108528-23 sun4u sparc
sunw,sun-fire-880 solaris '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
    cc='gcc', ccflags ='-fno-strict-aliasing -pipe -I/usr/local/include
    cppflags='-fno-strict-aliasing -pipe -I/usr/local/include'
    ccversion='', gccversion='3.3', gccosandvers='solaris2.8'
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -L/usr/local/lib '
    libpth=/usr/local/lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -ldl -lm -lc
    perllibs=-lsocket -lnsl -ldl -lm -lc
    libc=/lib/, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib'

Characteristics of this binary (from libperl):
  Compile-time options: USE_LARGE_FILES
  Built under solaris
  Compiled at Sep  9 2004 14:39:03

Dennis Mulqueeny
Servicing Portfolio Management
Wells Fargo Home Mortgage
7911 Forsyth Boulevard, Suite 500
Clayton, MO 63105
Work: (314) 719-8349
  Cell: (618) 567-7767

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About