[24336] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 6525 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 5 18:11:12 2004

Date: Wed, 5 May 2004 15:10:19 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 5 May 2004     Volume: 10 Number: 6525

Today's topics:
    Re: Help -- Code attached - db2buildts.pl (0/1) <tdyboc@insight.rr.com>
    Re: Help Needed Building Array Of Hashes From CSV <jtc@shell.dimensional.com>
    Re: Is this a bug in PERL or a subtle error by me? <null@example.net>
    Re: Komodo as a editor? <webmaster @ infusedlight . net>
    Re: Out of memory problem <usenet@morrow.me.uk>
        PDF Modules <alien_resident@sbcglobal.net>
        perl out of memory? <mikee@mikee.ath.cx>
    Re: perl out of memory? <Joe.Smith@inwap.com>
    Re: perl out of memory? <mikee@mikee.ath.cx>
    Re: Please Recommend A Good Perl Book. (Randal L. Schwartz)
    Re: Please Recommend A Good Perl Book. <dwall@fastmail.fm>
        read from comma delimited file <dannywork5@hotmail.com>
    Re: Removing windows CR-LF from middle of text <Joe.Smith@inwap.com>
        Strange DBI problem (Gil Vautour)
    Re: Strange DBI problem <ittyspam@yahoo.com>
    Re: Strange DBI problem <spamtrap@dot-app.org>
    Re: Strange DBI problem <dwall@fastmail.fm>
        win32::ole and excel VBA macro conversion: SmallScroll <domenico_discepola@quadrachemicals.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Wed, 05 May 2004 21:41:55 GMT
From: Mulder <tdyboc@insight.rr.com>
Subject: Re: Help -- Code attached - db2buildts.pl (0/1)
Message-Id: <sqni90961nkubtpp2uifdt6afs43mio58j@4ax.com>

On Tue, 04 May 2004 21:44:19 GMT, Mulder <tdyboc@insight.rr.com>
wrote:

>I am new to perl and am having trouble converting an old korn shell
>script into perl.  The attached script when executed simply displays a
>statement to stdout.  My problem is that I cannot figure out how to
>resolve an embedded variable.  The variable in question is
>$container_path and the two variables I want resolved are
>$nbr_data_path and $nbr_partition.
>
>What I ultimately want to do is to allow a dynamic file-system path to
>be specified that can also include these two varaibles.  Not sure how
>to approach this in perl.  In korn shell I simply did an 'eval' to
>send the contents back to the shell and then echo them out and they
>would be resolved into a valid file-system path but 'eval' in perl
>isn't the same.
>
>Any help and/or pointers appreciated.
>
>Thanks

Ok, here is the code I've written, sorry for the other attachment.

#!/usr/local/bin/perl
#
--------------------------------------------------------------------------------
sub _print_tablespace_statement {

if ( $_[0] eq "begin" ) {

print <<EOF;
create $tablespace_type tablespace $tablespace
in database partition group $node_group
pagesize $page_size
managed by $managed_by
EOF

} elsif ( $_[0] eq "containers" ) {

my $nbr_partition = 0;
my $cc = undef;

until ( $nbr_partition == $nbr_max_partitions ) {

print <<EOF;
using ( 
EOF

     my $nbr_data_path = 0;
     $nbr_partition += 1;
     $nbr_partition = sprintf("%04.0f", $nbr_partition);

until ( $nbr_data_path == $nbr_max_data_paths ) {

     $nbr_data_path += 1;
     $nbr_data_path = sprintf("%02.0f", $nbr_data_path);

     if ( $nbr_data_path == $nbr_max_data_paths ) { $cc = undef; }
     else { $cc = ","; }

#    my $path = join "", $container_path;
#    my $path = $_[1];

print <<EOF;
'$_[1]'$cc
EOF

}

print <<EOF;
) on dbpartitionnum $nbr_partition
EOF

}

} elsif ( $_[0] eq "end" ) {

print <<EOF;
extentsize $extent_size
prefetchsize $prefetch_size
bufferpool $bufferpool
dropped table recovery $dropped_table_recovery
;
EOF

}

}
#
--------------------------------------------------------------------------------

$SIG{ 'INT' } = sub { die "\nINT signal intercepted, exiting now.\n"
};

use warnings;
#use strict;
use Cwd;
use Pod::Usage;
use Getopt::Long qw(:config no_ignore_case no_auto_abbrev );

my ( 

     $opt_help, $opt_man, $opt_bufferpool, $opt_database,
     $opt_instance, $opt_max_data_paths, $opt_max_partitions,
$opt_managed_by,
     $opt_node_group, $opt_page_size, $opt_tablespace,
$opt_container_path,
     $opt_extent_size, $opt_prefetch_size,
$opt_dropped_table_recovery, $opt_tablespace_type
     
);

our (

     $db2FS, $bufferpool, $database, $instance,
     $nbr_max_data_paths, $nbr_max_partitions, $managed_by,
$node_group,
     $page_size, $tablespace, $container_path, $extent_size,
     $prefetch_size, $dropped_table_recovery, $tablespace_type,

);

GetOptions( "help" => \$opt_help,
            "man" => \$opt_man,
            "with-bufferpool=s" => \$opt_bufferpool,
            "with-database=s" => \$opt_database,
            "with-instance=s" => \$opt_instance,
            "with-max-data-paths=i" => \$opt_max_data_paths,
            "with-max-partitions=i" => \$opt_max_partitions,
            "with-managed-by=s" => \$opt_managed_by,
            "with-node-group=s" => \$opt_node_group,
            "with-page-size=s" => \$opt_page_size,
            "with-tablespace=s" => \$opt_tablespace,
            "with-container-path=s" => \$opt_container_path,
            "with-extent-size=s" => \$opt_extent_size,
            "with-prefetch-size=i" => \$opt_prefetch_size,
            "with-dropped-table-recovery" =>
\$opt_dropped_table_recovery,
            "with-tablespace-type" => \$opt_tablespace_type,
) || pod2usage(-verbose => 0) && exit;

pod2usage(-verbose => 1) && exit if defined $opt_help;
pod2usage(-verbose => 2) && exit if defined $opt_man;

if ( defined $opt_bufferpool ) { $bufferpool = $opt_bufferpool; }
else { $bufferpool = "bp16k"; }

if ( defined $opt_database ) { $database = $opt_database; }
else { $database = "db2db"; }

if ( $opt_instance ) { $instance = $opt_instance; }
elsif ( defined $ENV{ DB2INSTANCE } ) { $instance = $ENV{ DB2INSTANCE
}; }
else { $instance = "db2inst1"; }

if ( defined $opt_max_data_paths ) { $nbr_max_data_paths =
$opt_max_data_paths; }
else { $nbr_max_data_paths = 5; }

if ( defined $opt_max_partitions ) { $nbr_max_partitions =
$opt_max_partitions; }
else { $nbr_max_partitions = 3; }

if ( defined $opt_managed_by ) { $managed_by = $opt_managed_by; }
else { $managed_by = "system"; }

if ( defined $opt_node_group ) { $node_group = $opt_node_group; }
else { $node_group = "ibmdefaultgroup"; }

if ( defined $opt_page_size ) { $page_size = $opt_page_size; }
else { $page_size = 16384; }

if ( defined $opt_tablespace ) { $tablespace = $opt_tablespace; }
else { $tablespace = "testts"; }

if ( defined $opt_container_path ) { $container_path =
$opt_container_path; }
else { $db2FS = "/db2udb";
       $container_path = "$db2FS/" .
                         "$instance/" .
                         "$database/" .
                         "db2data\$nbr_data_path/" .
                         "NODE\$nbr_partition/" .
                         "$tablespace"
}

if ( defined $opt_extent_size ) { $extent_size = $opt_extent_size; }
else { $extent_size = "0ext"; }

if ( defined $opt_prefetch_size ) { $prefetch_size =
$opt_prefetch_size; }
else { $prefetch_size = "0pfs"; }

if ( defined $opt_dropped_table_recovery ) { $dropped_table_recovery =
"on"; }
else { $dropped_table_recovery = "off"; }

if ( defined $opt_tablespace_type ) { $tablespace_type =
$opt_tablespace_type; }
else { $tablespace_type = "regular"; }

_print_tablespace_statement( "begin" );
_print_tablespace_statement( "containers", $container_path );
_print_tablespace_statement( "end" );

exit 0;

__END__
=head1 NAME

 db2buildts.pl

=head1 SYNOPSIS

 db2buildts.pl     Build DB2 Create Tablespace Statements

=head1 DESCRIPTION

 A description

=head1 ARGUMENTS

 --help     Print options/arguments (brief)
 --man      Print complete man page

=head1 OPTIONS

 --help
 --man
 --versions

=head1 AUTHOR

=head1 LICENSE

=cut



------------------------------

Date: 5 May 2004 14:37:31 -0600
From: Jim Cochrane <jtc@shell.dimensional.com>
Subject: Re: Help Needed Building Array Of Hashes From CSV
Message-Id: <slrnc9ik4b.aii.jtc@shell.dimensional.com>

In article <4e5mc.27146$IG1.1153180@attbi_s04>, Tim Sheets wrote:
> Jim Cochrane wrote:
> 
>> In article <%iYlc.24520$TD4.3466652@attbi_s01>, Tim Sheets wrote:
>> 
> 
>> I could read your code and guess, but instead, it might save time
>> to first ask: What exactly are you trying to do?  You're describing
>> the problem in terms of an implementation, but I don't see any precise
>> problem description mentioned or implied from the above description (maybe
>> imprecise, but that's not good enough for a computer).  In other words,
>> what are the requirements for your problem?  (If you decide to spend
>> the time to become good at programming, you'll learn that being able to
>> state the problem without mentioning or implying an implementation is
>> one important skill you will need.)
>> 
>> Once your requirements are clear, people can then help you find a solution -
>> an implementation.
>> 
> 
> Jim,
> 
> You may have a point there regarding my ability to "properly" ask a 
> question, but reading the above text, I am completely confused.  Maybe I 
> am just dense, but about all I can understand is you aren't happy with 
> the presentation of my question/problem.
> 
> I thought I did a pretty good job explaining what I was trying to do, 
> and what was working, and what wasn't working (the latter two being 
> after the code I posted).  Maybe I was too verbose, I dunno.

Sorry, Tim - I was probably being a little overly didactic, but I was
trying to point out that you didn't really say why you are trying to build
an array of hashes - that is, what you were going to do with the array
once you built it.  In other words, often if you can specify a problem
from what the program should do from the perspective of a user of the
program who has no idea of what the code looks like, you can be clear
as to what the problem actually is, both in terms of your own thinking
and for presenting it to others.  Often this helps not only in finding
a correct implementation, but in finding a better one (e.g., more efficient,
easier to maintain, or etc.)

I do maintain that to become truly good at programming, it's necessary
to be able to state a problem without mentioning or implying an
implementation (e.g., without talking about hashes, arrays, etc.).
However, becoming a professional programmer may not be your goal, which is
why I was perhaps being overly didactic.

-- 
Jim Cochrane; jtc@dimensional.com
[When responding by email, include the term non-spam in the subject line to
get through my spam filter.]


------------------------------

Date: Wed, 05 May 2004 21:37:28 GMT
From: "Rich Grise" <null@example.net>
Subject: Re: Is this a bug in PERL or a subtle error by me?
Message-Id: <s8dmc.158723$L31.114042@nwrddc01.gnilink.net>


"gnari" <gnari@simnet.is> wrote in message
news:a3196543.0401040546.7d54e131@posting.google.com...
> "John W. Kennedy" <jwkenne@attglobal.net> wrote in message
news:<5sqJb.26$g77.44985@news4.srv.hcvlny.cv.net>...
> >
> > print "Thank you!\n" foreach (0..0x7FFFFFFE);
>
> did you actually try to run this? :-)
>
> gnari

I dunno about the OP, but

#!/usr/bin/perl
print "Thank You!\n" foreach (0..0x7F);

does print out 'Thank You' more than 49 times. ;-)

Cheers!
Rich




------------------------------

Date: Wed, 5 May 2004 10:39:17 -0800
From: "Robin" <webmaster @ infusedlight . net>
Subject: Re: Komodo as a editor?
Message-Id: <c7bcdk$bqv$1@reader2.nmix.net>


"Robert" <catcher@linuxmail.org> wrote in message
news:dZadnSNoTJ71WgXd4p2dnA@adelphia.com...
> Robin wrote:
>
> > "Robert" <catcher@linuxmail.org> wrote in message
> > news:hJGdnQRF9eMnhAXdRVn-jw@adelphia.com...
> >
> >>I am evaluating Komodo as an editor for work. I am doing a lot of Perl
> >>work as a sysadmin and am starting to get into Perl/Tk as well. We use
> >>PVCS for version control and I see Komodo integrates with that.
> >>
> >>All that to say "Do you use it and what do you think about it?".
> >>
> >>Robert
> >
> >
> > I haven't tried Komodo, but I've read it's good. I like optiPerl,
myself,
> > even though you have to change a lot of settings to get it to work well.
It
> > might be the same way with komodo too, a lot of those dlls, etc are
> > traded/sold from company to company, but if you want to try it, try it
> > man...
> > -Robin
>
> I tried OptiPerl and it seemed a little sluggish. This was about a year
> ago. What I looking at that most is the UI builder in Komodo.

yeah, Optiperl is a bit sluggish, I'll have to try komodo.
-Robin




------------------------------

Date: Wed, 5 May 2004 18:13:54 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Out of memory problem
Message-Id: <c7bat2$qqv$1@wisteria.csv.warwick.ac.uk>


Quoth shikhar_srivastava@tufts-health.com (Shikhar):
> Perl Gurus,
> 
> I have a Perl program that reads certain file(s) and stores contents
> in hash maps. The files are not huge per se,. One of the file is 100
> bytes long * 100,000 records (80 megs).
> 
> I have always thought/read that Perl can read whole file and work
> efficiently.  I had this program running nicely with a 40 meg file.
> Now I am getting "Out of Memory!" problem with 80 meg file.
> 
> In Java I can use heap size parameters to set initial and maximum heap
> sizes and they work nicely.

Do you have a soft limit on memory usage set? Check ulimit.

Otherwise, do you really need to process the whole file in one go? You
may be able to rewrite your program so it processes the file
sequentially.

-- 
Every twenty-four hours about 34k children die from the effects of poverty.
Meanwhile, the latest estimate is that 2800 people died on 9/11, so it's like
that image, that ghastly, grey-billowing, double-barrelled fall, repeated
twelve times every day. Full of children. [Iain Banks]         ben@morrow.me.uk


------------------------------

Date: Wed, 05 May 2004 21:17:19 GMT
From: Alien Resident <alien_resident@sbcglobal.net>
Subject: PDF Modules
Message-Id: <zRcmc.60598$Cb1.890@newssvr25.news.prodigy.com>

Could you please recommend a Module from CPAN for creating PDF's on the fly.

I am still somewhat of a novice to Perl, but I can figure out how to use Mods.

While searching CPAN I get quite a few results when searching for 'PDF' and I was 
wondering if you could help me narrow my choices a bit?

I need to let an online user enter numeric data in a form that will be used to fill in 
price fields in a PDF I will create on the fly. I will need to use a template for static 
parts of the PDF.

I hope this is clear enough.

Any suggestions as to a PDF mod you would favor?

Thank you,

-AR


------------------------------

Date: Wed, 05 May 2004 18:28:04 -0000
From: Mike <mikee@mikee.ath.cx>
Subject: perl out of memory?
Message-Id: <109ichkt0f6odd9@corp.supernews.com>

Given the script (x.pl):

#!/usr/bin/perl

use Net::FTP;

1;

When the command  is executed as root 'perl -wc x.pl' all
works well. When the same command is executed as a user
the errors below are given:

$ perl -wc x.pl
Out of memory!
Callback called exit at x.pl line 3.
END failed--call queue aborted at x.pl line 17.
Callback called exit at x.pl line 17.
BEGIN failed--compilation aborted at x.pl line 3.

I've changed the limits for the user, logged out and back
in, and still get the same result. What else might be
constraining the user's account such that the simple
script above can't even pass a '-wc'?

Mike


------------------------------

Date: Wed, 05 May 2004 19:57:15 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: perl out of memory?
Message-Id: <vGbmc.37236$Ik.2361694@attbi_s53>

Mike wrote:

> Given the script (x.pl):
> 
> #!/usr/bin/perl
> 
> use Net::FTP;
> 
> 1;
> 
> When the command  is executed as root 'perl -wc x.pl' all
> works well. When the same command is executed as a user
> the errors below are given:
> 
> $ perl -wc x.pl
> Out of memory!
> Callback called exit at x.pl line 3.
> END failed--call queue aborted at x.pl line 17.
> Callback called exit at x.pl line 17.
> BEGIN failed--compilation aborted at x.pl line 3.

The example above does not have 17 lines.  Are you sure you
posted the right code?

What does "perl -v" say when run as root?
What does "perl -v" say when run as user?
Are you using identical PATH and PERL5LIB settings?
	-Joe


------------------------------

Date: Wed, 05 May 2004 21:32:48 -0000
From: Mike <mikee@mikee.ath.cx>
Subject: Re: perl out of memory?
Message-Id: <109inc06peej0f6@corp.supernews.com>

In article <vGbmc.37236$Ik.2361694@attbi_s53>, Joe Smith wrote:
> Mike wrote:
> 
>> Given the script (x.pl):
>> 
>> #!/usr/bin/perl
>> 
>> use Net::FTP;
>> 
>> 1;
>> 
>> When the command  is executed as root 'perl -wc x.pl' all
>> works well. When the same command is executed as a user
>> the errors below are given:
>> 
>> $ perl -wc x.pl
>> Out of memory!
>> Callback called exit at x.pl line 3.
>> END failed--call queue aborted at x.pl line 17.
>> Callback called exit at x.pl line 17.
>> BEGIN failed--compilation aborted at x.pl line 3.
> 
> The example above does not have 17 lines.  Are you sure you
> posted the right code?
> 
> What does "perl -v" say when run as root?
> What does "perl -v" say when run as user?
> Are you using identical PATH and PERL5LIB settings?
> 	-Joe

I posted the right code and I realize the snippet above
does not have 17 lines. The problem was that the application
had a custom libc.a in front of the system libc.a. Unsetting
the SHLIB_PATH and LIBPATH variables allowed this script to work.

Mike


------------------------------

Date: Wed, 05 May 2004 19:26:20 GMT
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Please Recommend A Good Perl Book.
Message-Id: <baafbb898a252fe81cbcac6b55ac3103@news.teranews.com>

>>>>> "Greg" == Greg Bacon <gbacon@hiwaay.net> writes:

Greg> FTR, I'm only arguing that ORA and other publishers ought to toss
Greg> RIAA's playbook in the trash, not, for example, that people ought
Greg> to make unauthorized publications.

And in some senses, I agree.  ORA is certainly looking at economic
models where free copies of books get published for the net alongside
restricted hardcopy.  In fact, any one of my books could have been
published as a free net book, more or less at my choice, but with
economic consequences.

My point is that the existing rules need to be followed.  If the
CD-ROM is copyrighted, then don't be copying it! It's up to the copyright
owner (O'Reilly) to say yea or nay, not some random individual.

print "Just another Perl hacker,";

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


------------------------------

Date: Wed, 05 May 2004 20:11:56 -0000
From: "David K. Wall" <dwall@fastmail.fm>
Subject: Re: Please Recommend A Good Perl Book.
Message-Id: <Xns94E0A4C8B680Adkwwashere@216.168.3.30>

Greg Bacon <gbacon@hiwaay.net> wrote:

> In article <2e12fbc.0404290201.3e68f45@posting.google.com>,
>     Daniel N. Andersen <daniel_n_andersen@yahoo.com> wrote:
> 
>: If it wasn't for that site, I wouldn't own all the new editions
>: of those books (except 'Learning Perl on Win32 Systems' which I
>: haven't read) today. [...]
> 
> Economic analysis seems to point the same direction:
> 
>     Also, experience suggests that online and offline books
>     are different goods that serve different purposes (quick
>     reference versus deep reading; quote checking versus
>     extended study; etc.). What's more, these different
>     purposes are complementary. On and offline books are
>     complements (like bacon and eggs) not substitutes (like
>     bacon and sausage).
> 
>     http://www.mises.org/fullstory.asp?control=1473

I bought a copy of the Perl CD Bookshelf a few years ago, thinking it 
would be useful for quick reference. Once the novelty wore off, I 
never used it. I found the CD a few days ago in a box in the garage, 
a box I hadn't opened since I moved three years ago. The books, on 
the other hand, are well-thumbed and within arm's reach.

Books are so much more user-friendly than CDs. You can insert 
bookmarks, annotate them, carry them anywhere to read them, and they 
don't require a computer or power source. (unless you count a light 
source) 

> FTR, I'm only arguing that ORA and other publishers ought to toss
> RIAA's playbook in the trash, not, for example, that people ought
> to make unauthorized publications.
> 
> But what do I know?  I own Perl books mostly for the sake of
> owning them, and I'm no MP3 ripper/burner/trader/whatever.
> 
> Actually, I can't wait to own a copy of mjd's upcoming book[*] and
> plan to spend lots of time (re)reading the dead tree rendering,

No "re" about it for me, but I will definitely buy a copy and read 
it.

> but he secured contract terms that will allow him to publish the
> complete text beerfree on the web.  I don't know his motivation
> behind this particular move, but the indication is (and I'm sure
> all our hopes are) that it will help rather than hurt his
> royalties. 
> 
> [*] http://perl.plover.com/book/

I hope it will help, too.

ESR did the same thing with the Jargon File some years back. It must 
have worked reasonably well, because he recently did the same thing 
with _The Art of Unix Programming_. (I bought a copy of it, too)



------------------------------

Date: Wed, 05 May 2004 22:01:09 GMT
From: "Danny" <dannywork5@hotmail.com>
Subject: read from comma delimited file
Message-Id: <Fudmc.146062$Gd3.35177306@news4.srv.hcvlny.cv.net>

How can I read from a comma delimited text file and export to a tab
delimited file using perl.
the file has quotes around the fields when another comma is in the string,
but nothing if it is a regular string.
Like:
"this field has a comma, in it", but tihs field does not, good bye

I have searched for this but most do not account for the "quotes" around the
fields

THanks in advance




------------------------------

Date: Wed, 05 May 2004 19:53:18 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: Removing windows CR-LF from middle of text
Message-Id: <OCbmc.37228$kh4.1862245@attbi_s52>

v796 wrote:

> I have text on multiple lines in text files on Windows. Example: 
> " Your voting instructions have been
>  received.
> Thank you! "

 From what I've seen, text like that is really
   " Your voting instructions have been\n received.\nThank you!"\r\n
in that the soft line breaks are bare LF and hard returns are CRLF.

This becomes visible when using
   od -c whatever.csv
at the Unix/Linux command line.

> I need a regex to remove CR-LF and convert them to space in the middle
> of the text.

I've had some success with this:

   binmode IN;		# Preserve CR in input stream
   local $\ = "\r\n";	# Read DOS-style records
   while (<IN>) {
     s/\n/ /gs;		# Convert soft breaks into spaces
     s/\r /\n/;		# Convert what used to be CRLF to plain LF
     ...
   }

> Currently the text in excel writes to multiple lines in Excel file,
> when it should only be in 1 cell.

The above code recognizes that as a single cell on a line.

Of course, using a CPAN module to parse CSV would be better.
	-Joe


------------------------------

Date: 5 May 2004 13:32:41 -0700
From: vautour@unb.ca (Gil Vautour)
Subject: Strange DBI problem
Message-Id: <7087ed01.0405051232.52565402@posting.google.com>

I have a Perl CGI script that was failing with a Server 500 error and
I think I have traced it back to a DBI subroutine that is inserting
the form data into a MySql table.  I can submit the form with
identical data except for one field (email) and it will work sometimes
and sometimes not depending on the email address that is submitted. 
Has anyone seem anything like this or have any idea of what I should
be looking for?

Thanks,


------------------------------

Date: Wed, 5 May 2004 16:55:56 -0400
From: Paul Lalli <ittyspam@yahoo.com>
Subject: Re: Strange DBI problem
Message-Id: <20040505165406.T25082@dishwasher.cs.rpi.edu>

On Wed, 5 May 2004, Gil Vautour wrote:

> I have a Perl CGI script that was failing with a Server 500 error and
> I think I have traced it back to a DBI subroutine that is inserting
> the form data into a MySql table.  I can submit the form with
> identical data except for one field (email) and it will work sometimes
> and sometimes not depending on the email address that is submitted.
> Has anyone seem anything like this or have any idea of what I should
> be looking for?

The very first thing you should be looking for is the error message in
your server logs.  What does it say?  If you don't have direct access to
your server logs, add the following lines to the top of your script:

use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
warningsToBrowser(1);

That will cause the Perl error messages to be printed to the browser
instead of (or may in addition to?  I forget) the server logs.

Paul Lalli


------------------------------

Date: Wed, 05 May 2004 16:58:22 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Strange DBI problem
Message-Id: <3L6dneKN7YLzyATdRVn-uQ@adelphia.com>

Gil Vautour wrote:

> Has anyone seem anything like this or have any idea of what I should
> be looking for?

One (or both) of two things:

1. Look in your web server's error logs to get the error message from Perl
that triggered the "500 Server Error" response.

2. "use CGI::Carp qw(fatalsToBrowser);" in your script, so that Perl error
messages are reported in the output, instead of buried in the server log.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


------------------------------

Date: Wed, 05 May 2004 21:18:45 -0000
From: "David K. Wall" <dwall@fastmail.fm>
Subject: Re: Strange DBI problem
Message-Id: <Xns94E0B01C72E79dkwwashere@216.168.3.30>

Gil Vautour <vautour@unb.ca> wrote:

> I have a Perl CGI script that was failing with a Server 500 error
> and I think I have traced it back to a DBI subroutine that is
> inserting the form data into a MySql table.  I can submit the form
> with identical data except for one field (email) and it will work
> sometimes and sometimes not depending on the email address that is
> submitted. Has anyone seem anything like this or have any idea of
> what I should be looking for?

I have some guesses, but without code or error messages, guesses are 
all they would be.

Check the server logs and see what the error is. If you don't have 
access to the server logs, put

    use CGI::Carp qw(fatalsToBrowser);

in your program and try it again. That will send warnings and error 
messages to the browser. If you can't figure it out from that, post a 
*short* piece of code that exhibits the problem.

OK, now the guess: I suspect you're not using placeholders and 
instead are constructing the SQL something like this:

    my $email = param('email');
    my $sql = "insert into TableName (email) values ($email)";
    my $dbh = DBI->connect( ... );
    $dbh->do($sql);

Or maybe the '@' in the email address is being interpreted as the 
beginning of an array name. (not as likely, IMO, but possible)



------------------------------

Date: Wed, 5 May 2004 15:14:36 -0400
From: "Domenico Discepola" <domenico_discepola@quadrachemicals.com>
Subject: win32::ole and excel VBA macro conversion: SmallScroll
Message-Id: <61bmc.36807$kc2.541638@nnrp1.uunet.ca>

Hello all.  I'm trying to write some code to scroll my window pane (in
Microsoft Excel) & wish convert the following VBA macro to Perl format:
ActiveWindow.SmallScroll ToRight:=-3

I have defined the following: $excel (excel object), $worksheet (worksheet
object), $workbook (workbook object).

I tried:
$excel->ActiveWindow->SmallScroll->{ToRight} = -3;
$workbook->ActiveWindow->SmallScroll->{ToRight} = -3;
$worksheet->ActiveWindow->SmallScroll->{ToRight} = -3;

all without success...  Any suggestions would be appreciated.





------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 6525
***************************************


home help back first fref pref prev next nref lref last post