[30267] in Perl-Users-Digest
Perl-Users Digest, Issue: 1510 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 5 21:10:24 2008
Date: Mon, 5 May 2008 18:09:17 -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 Mon, 5 May 2008 Volume: 11 Number: 1510
Today's topics:
ANNOUNCE: Win32::SqlServer 2.004 <esquel@sommarskog.se>
Anyone using IPC::Cmd on Windows? <ro.naldfi.scher@gmail.com>
Re: Anyone using IPC::Cmd on Windows? <ben@morrow.me.uk>
EARN US DOLLARS, WITHOUT INVESTMENT, HOME BUSINESS, 100 <Rosapaul4@gmail.com>
How to display 1.234.567.890,00 from 1234567890 ? (Jason Stacy)
Re: How to display 1.234.567.890,00 from 1234567890 ? sheinrich@my-deja.com
Re: How to display 1.234.567.890,00 from 1234567890 ? <jurgenex@hotmail.com>
interacting with another program that requires input whcchoi@gmail.com
Re: interacting with another program that requires inpu <jurgenex@hotmail.com>
Re: interacting with another program that requires inpu <jimsgibson@gmail.com>
IPC::Open3 : Why can't I catch program output here? <ro.naldfi.scher@gmail.com>
Re: IPC::Open3 : Why can't I catch program output here? <ben@morrow.me.uk>
Re: IPC::Open3 : Why can't I catch program output here? <nospam-abuse@ilyaz.org>
maximum hash/array keys/values <slick.users@gmail.com>
Re: maximum hash/array keys/values <1usa@llenroc.ude.invalid>
new CPAN modules on Mon May 5 2008 (Randal Schwartz)
Re: Problem with email attachment, 1 becomes 10 <benkasminbullock@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 5 May 2008 21:55:22 GMT
From: Erland Sommarskog <esquel@sommarskog.se>
Subject: ANNOUNCE: Win32::SqlServer 2.004
Message-Id: <K0F1y2.20us@zorch.sf-bay.org>
I am glad to announce the availability of version 2.004 of Win32::SqlServer.
The main news are support for Perl 5.10 and for new features in SQL 2008
(table parameters, new date/time data types, FILESTREAM).
Win32::SqlServer is intended to be the main choice for Perl programmers
who want to access Microsoft SQL Server from Windows and who have need
for portability.
The source distribution is on its way on CPAN.
A binary distribution (with sources included of course) for ActivePerl
8xx and 10xx is available from
http://www.sommarskog.se/mssqlperl/index.html.
--
Erland Sommarskog, Stockholm, esquel@sommarskog.se
------------------------------
Date: Mon, 5 May 2008 05:39:47 -0700 (PDT)
From: Ronny <ro.naldfi.scher@gmail.com>
Subject: Anyone using IPC::Cmd on Windows?
Message-Id: <9c96a0b7-c139-459e-b53c-11813effcd8a@m73g2000hsh.googlegroups.com>
I'm using ActiveState Perl 5.10.0 for Windows, and wanted to use
IPC::Cmd for running external programs. To my surprise, I found
IPC::Cmd->can_capture_buffer
returning false, meaning that I can't use it to capture the output of
the programs. Also, I found
IPC::Cmd->can_use_ipc_run
returning false, but
IPC::Cmd->can_use_ipc_open3
returning true. Does anybody know about a Perl implementation for
Windows where these features are implemented? Can the
ActiveState implementation of IPC::Cmd be used for anything
useful at all under these circumstances?
Ronald
------------------------------
Date: Mon, 5 May 2008 23:28:27 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Anyone using IPC::Cmd on Windows?
Message-Id: <b9e4f5-sbu.ln1@osiris.mauzo.dyndns.org>
Quoth Ronny <ro.naldfi.scher@gmail.com>:
> I'm using ActiveState Perl 5.10.0 for Windows, and wanted to use
> IPC::Cmd for running external programs. To my surprise, I found
>
> IPC::Cmd->can_capture_buffer
>
> returning false, meaning that I can't use it to capture the output of
> the programs. Also, I found
>
> IPC::Cmd->can_use_ipc_run
>
> returning false, but
>
> IPC::Cmd->can_use_ipc_open3
>
> returning true. Does anybody know about a Perl implementation for
> Windows where these features are implemented? Can the
> ActiveState implementation of IPC::Cmd be used for anything
> useful at all under these circumstances?
You need to install IPC::Run. You can only capture buffers under Win32
if you can use IPC::Run (and if you're not on Win98), and you can only
use IPC::Run if it's installed. Probably IPC::Cmd ought to depend on
IPC::Run if it's being installed under Win32, since it isn't useful
without it.
(As a hint, all of the above is very clear from the source of the
module. If a module's not doing what you expect, it's always worth at
least glancing at the source, to see if there's some obvious reason.)
Ben
--
You poor take courage, you rich take care:
The Earth was made a common treasury for everyone to share
All things in common, all people one.
'We come in peace'---the order came to cut them down. [ben@morrow.me.uk]
------------------------------
Date: Sun, 4 May 2008 20:16:04 -0700 (PDT)
From: ROSA <Rosapaul4@gmail.com>
Subject: EARN US DOLLARS, WITHOUT INVESTMENT, HOME BUSINESS, 100% LEGAL
Message-Id: <84991ace-62c5-40be-a48b-90731134b633@l28g2000prd.googlegroups.com>
Interested in Building Online Business Empire Without Investing
Single
Dollar!!
Explore The Best Online Income Opportunity On The Internet Today -
Absolutely FREE!
EARN UNLIMETED WITHOUT INVESTMENT WITH On The Net..
"on top of the primary purchase and MAKE MORE MONEY WITHOUT DOING ANY
ADDITIONAL WORK!"
For More Details; http://moneybusinessideas.blogspot.com/
------------------------------
Date: 05 May 2008 06:33:21 GMT
From: jjstacy@yahoo.net (Jason Stacy)
Subject: How to display 1.234.567.890,00 from 1234567890 ?
Message-Id: <481eaa30$0$6548$9b4e6d93@newsspool3.arcor-online.net>
Given a decimal value (e.g. 1234567890) I want to print this number with
grouping delimiters (european style with dots: 1.234.567.890,00
and not US style 1,234,567,890.00)
How can I do this in perl?
Jason
------------------------------
Date: Mon, 5 May 2008 00:30:18 -0700 (PDT)
From: sheinrich@my-deja.com
Subject: Re: How to display 1.234.567.890,00 from 1234567890 ?
Message-Id: <e12f9c84-d673-49d8-923c-09666eb32cad@b64g2000hsa.googlegroups.com>
On May 5, 8:33 am, jjst...@yahoo.net (Jason Stacy) wrote:
> Given a decimal value (e.g. 1234567890) I want to print this number with
> grouping delimiters (european style with dots: 1.234.567.890,00
> and not US style 1,234,567,890.00)
>
> How can I do this in perl?
>
> Jason
Adapt any of the methods given at
http://faq.perl.org/perlfaq5.html#How_can_I_output_my_
BTW: the comma as a decimal separator is country _and_ language
specific, and is not common across europe.
------------------------------
Date: Mon, 05 May 2008 13:42:48 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: How to display 1.234.567.890,00 from 1234567890 ?
Message-Id: <vg3u14p8o0tblseu4r6653k74pkpkrt6ue@4ax.com>
jjstacy@yahoo.net (Jason Stacy) wrote:
>Given a decimal value (e.g. 1234567890) I want to print this number with
>grouping delimiters (european style with dots: 1.234.567.890,00
>and not US style 1,234,567,890.00)
>
>How can I do this in perl?
See perldoc -q added
Replacing the comma with a dot in the sub commify() is left as an
excercise to the reader.
jue
------------------------------
Date: Mon, 5 May 2008 11:37:52 -0700 (PDT)
From: whcchoi@gmail.com
Subject: interacting with another program that requires input
Message-Id: <cffdc6bd-a5be-4353-83ce-d26a2c5478dc@m45g2000hsb.googlegroups.com>
Hi,
I have a perl script which executes a command which will in term
requires input, I have the following program:
my $cmd = "ipa add";
print "Executing -> $cmd\n\n";
my $pid = open(H, "$cmd |") or die("\n$cmd failed\n");
my($stat, $data);
my $str;
while (sysread(H, $data, 1)) {
if (defined ($data)) {
$str .= $data;
if ($str =~ /Please enter View name\(use \'quit\' to
exit\): /) {
===> NEED HELP HERE
}
}
}
I need help with "NEED HELP HERE", if my cmd "ipa add" requires input
of "abc", how can I provide that and interact with "ipa add"??
I tried:
print H "abc\n";
syswrite() --> don't know what argument to use
None worked. However, It can accept input from STDIN (i.e. I can
interact with my script in the screen where I run my script)..
Please help.
Thanks,
Claudia
------------------------------
Date: Mon, 05 May 2008 18:43:47 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: interacting with another program that requires input
Message-Id: <95lu14t5nur4jc6g0nnporbd4rcoc27484@4ax.com>
whcchoi@gmail.com wrote:
>I have a perl script which executes a command which will in term
>requires input, I have the following program:
[...]
>I need help with "NEED HELP HERE", if my cmd "ipa add" requires input
>of "abc", how can I provide that and interact with "ipa add"??
You are looking for the Expect module.
jue
------------------------------
Date: Mon, 05 May 2008 11:56:02 -0700
From: Jim Gibson <jimsgibson@gmail.com>
Subject: Re: interacting with another program that requires input
Message-Id: <050520081156028521%jimsgibson@gmail.com>
In article
<cffdc6bd-a5be-4353-83ce-d26a2c5478dc@m45g2000hsb.googlegroups.com>,
<whcchoi@gmail.com> wrote:
> Hi,
> I have a perl script which executes a command which will in term
> requires input, I have the following program:
>
> my $cmd = "ipa add";
> print "Executing -> $cmd\n\n";
>
> my $pid = open(H, "$cmd |") or die("\n$cmd failed\n");
>
> my($stat, $data);
> my $str;
>
> while (sysread(H, $data, 1)) {
>
> if (defined ($data)) {
> $str .= $data;
>
> if ($str =~ /Please enter View name\(use \'quit\' to
> exit\): /) {
> ===> NEED HELP HERE
> }
> }
> }
>
> I need help with "NEED HELP HERE", if my cmd "ipa add" requires input
> of "abc", how can I provide that and interact with "ipa add"??
Open with a pipe ("$cmd |") only affords unidirectional communication.
For bidirectional I/O, see 'perldoc perlipc' and search for
'Bidirectional'. The advice there is to use open2 or, better, the
Expect.pm module from CPAN.
--
Jim Gibson
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
http://www.usenet.com
------------------------------
Date: Mon, 5 May 2008 06:12:36 -0700 (PDT)
From: Ronny <ro.naldfi.scher@gmail.com>
Subject: IPC::Open3 : Why can't I catch program output here?
Message-Id: <b3dc2c7b-f8f3-4d44-8ecb-4574d8965da4@y21g2000hsf.googlegroups.com>
I try to use the program below to catch standard output and standard
error
of a process. The program itself runs well, and it *does* write at
least to
standard output, but in the code below, the line saying "### READING"
is never printed and @msg is still empty afterwards. This means that
$selector->can_read() must have returned false already the first time
it was called. Any suggestion on what could I have done wrong here?
my @msg;
my $pid=open3(*CMD_IN,*CMD_OUT,*CMD_ERR,@cmd)
or confess "Open3 error: $!\n";;
$SIG{CHLD} = sub {
waitpid($pid,0)>0 &&
print "SIGCHILD status=$? pid=$pid\n";
};
my $selector=IO::Select->new();
$selector->add(*CMD_ERR,*CMD_OUT);
while(my @ready=$selector->can_read()) {
foreach my $fh (@ready) {
print "### READING\n";
push @msg,scalar(<$fh>);
$selector->remove($fh) if eof($fh);
}
}
close CMD_OUT;
close CMD_ERR;
------------------------------
Date: Mon, 5 May 2008 23:55:27 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: IPC::Open3 : Why can't I catch program output here?
Message-Id: <vrf4f5-d901.ln1@osiris.mauzo.dyndns.org>
Quoth Ronny <ro.naldfi.scher@gmail.com>:
> I try to use the program below to catch standard output and standard
> error of a process. The program itself runs well, and it *does* write
> at least to standard output, but in the code below, the line saying
> "### READING" is never printed and @msg is still empty afterwards.
> This means that $selector->can_read() must have returned false already
> the first time it was called. Any suggestion on what could I have done
> wrong here?
Works for me here (i686-freebsd). What platform are you on, and what
command are you trying to run? In general, if you can provide a complete
program people can copy/paste/run, you're more likely to get help: in
this case, you omitted the 'use' lines and the contents of @cmd.
> my @msg;
> my $pid=open3(*CMD_IN,*CMD_OUT,*CMD_ERR,@cmd)
> or confess "Open3 error: $!\n";;
I would normally say 'Use lexical filehandles!' at this point;
unfortunately, IPC::Open3 was written before they existed and the
obvious way
my $pid = open3(my $CMD_IN, my $CMD_OUT, my $CMD_ERR, @cmd)...
doesn't work (and can't be made to since undef is already meaningful).
So you have to fall back to the old method of using Symbol::gensym:
use Symbol qw/gensym/;
my ($CMD_IN, $CMD_OUT, $CMD_ERR) = (gensym, gensym, gensym);
my $pid = open3($CMD_IN, $CMD_OUT, $CMD_ERR, @cmd)...
which is definitely ugly, but IMHO worth it (if you must use IPC::Open3
at all: I'd use IPC::Run instead). For one thing, these gensymmed
filehandles close when they go out of scope, just like more usual
lexical filehandles. Of course, I'd use a hash to hold the filehandles:
my %CMD = map {($_, gensym)} qw/IN OUT ERR/;
my $pid = open3(@CMD{qw/IN OUT ERR/}, @cmd)...
> $SIG{CHLD} = sub {
> waitpid($pid,0)>0 &&
> print "SIGCHILD status=$? pid=$pid\n";
> };
> my $selector=IO::Select->new();
> $selector->add(*CMD_ERR,*CMD_OUT);
> while(my @ready=$selector->can_read()) {
> foreach my $fh (@ready) {
> print "### READING\n";
> push @msg,scalar(<$fh>);
> $selector->remove($fh) if eof($fh);
Using eof is nearly always a mistake: it's almost always better to check
the return value of your read statement instead. Something like
my $msg = <$fh>;
defined $msg
? push @msg, $msg
: $selector->remove($fh);
This also means you don't get a spurious undef on the end of @msg.
Ben
--
I must not fear. Fear is the mind-killer. I will face my fear and
I will let it pass through me. When the fear is gone there will be
nothing. Only I will remain.
ben@morrow.me.uk Frank Herbert, 'Dune'
------------------------------
Date: Tue, 6 May 2008 00:26:34 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: IPC::Open3 : Why can't I catch program output here?
Message-Id: <fvo8jq$31ja$1@agate.berkeley.edu>
[A complimentary Cc of this posting was NOT [per weedlist] sent to
Ben Morrow
<ben@morrow.me.uk>], who wrote in article <vrf4f5-d901.ln1@osiris.mauzo.dyndns.org>:
> I would normally say 'Use lexical filehandles!' at this point;
> unfortunately, IPC::Open3 was written before they existed and the
> obvious way
>
> my $pid = open3(my $CMD_IN, my $CMD_OUT, my $CMD_ERR, @cmd)...
>
> doesn't work (and can't be made to since undef is already meaningful).
I have no idea what you mean here.
sub open3 ($$$$@) {
$_[0] = IO::Handle->new unless defined $_[0]; # Or whatever is THE initializer
...
}
Yours,
Ilya
------------------------------
Date: Mon, 5 May 2008 17:04:53 -0700 (PDT)
From: Slickuser <slick.users@gmail.com>
Subject: maximum hash/array keys/values
Message-Id: <fb5a6ceb-5170-41bb-a278-cc630156869f@y18g2000pre.googlegroups.com>
What's the maximum hash/array in Perl can hold for keys and values?
Thanks.
------------------------------
Date: Tue, 06 May 2008 00:18:53 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: maximum hash/array keys/values
Message-Id: <Xns9A95CEA6A860Easu1cornelledu@127.0.0.1>
Slickuser <slick.users@gmail.com> wrote in news:fb5a6ceb-5170-41bb-a278-
cc630156869f@y18g2000pre.googlegroups.com:
> What's the maximum hash/array in Perl can hold for keys and values?
Please explain what you mean in a little bit more detail. What do you mean
by maximum hash or maximum array?
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/
------------------------------
Date: Mon, 5 May 2008 04:42:19 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Mon May 5 2008
Message-Id: <K0Dp2J.rCH@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
AutoXS-0.04
http://search.cpan.org/~smueller/AutoXS-0.04/
Speed up your code after compile time
----
AutoXS-Header-0.03
http://search.cpan.org/~smueller/AutoXS-Header-0.03/
Container for the AutoXS header files
----
Class-Accessor-Fast-GXS-0.01
http://search.cpan.org/~ruz/Class-Accessor-Fast-GXS-0.01/
generate C::A::Fast compatible XS accessors
----
Class-XSAccessor-0.04
http://search.cpan.org/~smueller/Class-XSAccessor-0.04/
Generate fast XS accessors without runtime compilation
----
Class-XSAccessor-Array-0.02
http://search.cpan.org/~smueller/Class-XSAccessor-Array-0.02/
Generate fast XS accessors without runtime compilation
----
Curses-UI-POE-0.031
http://search.cpan.org/~tag/Curses-UI-POE-0.031/
A subclass makes Curses::UI POE Friendly.
----
DBIx-Class-Schema-Slave-0.02000
http://search.cpan.org/~travail/DBIx-Class-Schema-Slave-0.02000/
DBIx::Class::Schema for slave (EXPERIMENTAL)
----
DBIx-Class-Schema-Slave-0.02100
http://search.cpan.org/~travail/DBIx-Class-Schema-Slave-0.02100/
DBIx::Class::Schema for slave (EXPERIMENTAL)
----
DBIx-Class-Schema-Slave-0.02101
http://search.cpan.org/~travail/DBIx-Class-Schema-Slave-0.02101/
DBIx::Class::Schema for slave (EXPERIMENTAL)
----
DataExtract-FixedWidth-0.01
http://search.cpan.org/~ecarroll/DataExtract-FixedWidth-0.01/
The one stop shop for parsing static column width text tables!
----
GD-SecurityImage-AC-1.11
http://search.cpan.org/~snowhare/GD-SecurityImage-AC-1.11/
A drop-in replacement for Authen::Captcha.
----
GStreamer-0.11
http://search.cpan.org/~tsch/GStreamer-0.11/
Perl interface to the GStreamer library
----
Geo-IP-1.32
http://search.cpan.org/~borisz/Geo-IP-1.32/
Look up location and network information by IP Address
----
Hash-Merge-Simple-0.03
http://search.cpan.org/~rkrimen/Hash-Merge-Simple-0.03/
Recursively merge two or more hashes, simply
----
Lingua-PT-Conjugate-1.14
http://search.cpan.org/~egross/Lingua-PT-Conjugate-1.14/
----
Log-Handler-0.40
http://search.cpan.org/~bloonix/Log-Handler-0.40/
Log messages to one or more outputs.
----
MSDOS-Descript-1.03
http://search.cpan.org/~cjm/MSDOS-Descript-1.03/
Manage 4DOS style DESCRIPT.ION files
----
MSN-PersonalMessage-0.02
http://search.cpan.org/~kenwu/MSN-PersonalMessage-0.02/
Perl extension for change MSN Personal Message
----
Math-Quaternion-0.03
http://search.cpan.org/~jchin/Math-Quaternion-0.03/
Perl class to represent quaternions
----
MooseX-Iterator-0.08
http://search.cpan.org/~rlb/MooseX-Iterator-0.08/
Iterate over collections
----
MooseX-MakeImmutable-0.01
http://search.cpan.org/~rkrimen/MooseX-MakeImmutable-0.01/
A convenient way to make many Moose immutable (or mutable) in one shot
----
MooseX-Mutate-0.01
http://search.cpan.org/~rkrimen/MooseX-Mutate-0.01/
A convenient way to make many Moose immutable (or mutable) in one shot
----
MooseX-Mutate-0.02
http://search.cpan.org/~rkrimen/MooseX-Mutate-0.02/
A convenient way to make many Moose immutable (or mutable) in one shot
----
OpenOffice-OODoc-2.101
http://search.cpan.org/~jmgdoc/OpenOffice-OODoc-2.101/
The Perl Open OpenDocument Connector
----
OpenOffice-OODoc-2.102
http://search.cpan.org/~jmgdoc/OpenOffice-OODoc-2.102/
The Perl Open OpenDocument Connector
----
Parse-Marpa-0.211_004
http://search.cpan.org/~jkegl/Parse-Marpa-0.211_004/
Earley's algorithm with LR(0) precomputation
----
Perl-Critic-More-0.999_001
http://search.cpan.org/~elliotjs/Perl-Critic-More-0.999_001/
Supplemental policies for Perl::Critic
----
Test-CheckChanges-0.03
http://search.cpan.org/~gam/Test-CheckChanges-0.03/
Check that the Changes file matches the distribution.
----
Test-CheckChanges-0.04
http://search.cpan.org/~gam/Test-CheckChanges-0.04/
Check that the Changes file matches the distribution.
----
Tk-TextVi-0.011
http://search.cpan.org/~jstrom/Tk-TextVi-0.011/
Tk::Text widget with Vi-like commands
----
WWW-Search-Yahoo-Japan-2.102
http://search.cpan.org/~mthurn/WWW-Search-Yahoo-Japan-2.102/
WWW::Search backend for searching Yahoo! Japan
----
txt2html-2.51
http://search.cpan.org/~rubykat/txt2html-2.51/
convert plain text file to HTML.
If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.
This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
http://www.stonehenge.com/merlyn/LinuxMag/col82.html
print "Just another Perl hacker," # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
------------------------------
Date: Mon, 5 May 2008 02:59:04 +0000 (UTC)
From: Ben Bullock <benkasminbullock@gmail.com>
Subject: Re: Problem with email attachment, 1 becomes 10
Message-Id: <fvlt5n$6mg$1@ml.accsnet.ne.jp>
On Mon, 05 May 2008 03:07:53 +0200, M.O.B. i L. wrote:
> I'm trying to write a program that can send out mails to companies where
> I'm interested in working. These mails are the same except that the
> company name is switched. My CV should be attached as a pdf-file. The
> problem is that I don't get one attachment, but ten! Also the message is
> repeated 10 times. If I change the program by uncommenting the commented
> line in the function load() it works but then it doesn't send the
> correct pdf-file. The CV is 129490 bytes. How could I change this
> program so that there is only one attachment and no repeated messages?
I don't know the answer to your question, but after reading it I wonder
if anyone else can solve it for you, so I'll post my advice instead. One
piece of advice which has been useful to me which I learnt from the
posting guidelines for this group is, before posting, to always try to
reduce the problem to the minimum possible, let's say ten or twenty lines
of code:
"First make a short (less than 20-30 lines) and *complete* program
that illustrates the problem you are having. People should be able
to run your program by copy/pasting the code from your article. (You
will find that doing this step very often reveals your problem
directly. Leading to an answer much more quickly and reliably than
posting to Usenet.)"
In the case of your program there are two big chunks: first, lots of
stuff involving reading lines from the database, which is where I suspect
the problem has occurred, probably some kind of slip-up, but I can't
prove this because I don't have the database available, and then there is
an almost separate piece of code which involves sending a mail with an
attachment, which might be where the bug happened, although I think it's
unlikely.
If I was going to seriously try to solve your problem, I would first of
all split the program into two pieces, one which gets those database
lines and just prints them to STDOUT, and another piece which sends just
one mail with some fixed parameters, written into the file itself rather
than pulled from a database, and see which one of these two pieces is
going wrong.
Then, if I still couldn't debug it myself, I might try posting whichever
of the two pieces the problem had occurred in to the newsgroup. But it's
very hard (for me at least) to work out what might have happened in your
program because of all the dependencies. As it says in the quote above,
if you can reduce the dependencies to a minimum piece of code which
anybody can run, you'll probably end up solving your own problem into the
bargain. I have repeatedly had problems in Perl which I thought were
incredibly difficult, ended up frustrated enough to want to post them
here, and in the business of reducing them into a short newsgroup post as
described, I ended up surprising myself by working out what the bug was
without having to post it.
Having said all that, perhaps someone will spot the bug in your code the
next minute after I post this, so who knows?
------------------------------
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 V11 Issue 1510
***************************************