[30785] in Perl-Users-Digest
Perl-Users Digest, Issue: 2030 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Dec 4 14:09:46 2008
Date: Thu, 4 Dec 2008 11:09:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 4 Dec 2008 Volume: 11 Number: 2030
Today's topics:
dynamic name of a variable in a class <brownie2002@gmail.com>
Re: dynamic name of a variable in a class <peter@makholm.net>
Re: dynamic name of a variable in a class <tadmc@seesig.invalid>
Re: dynamic name of a variable in a class <tadmc@seesig.invalid>
escaping "$" in command line arguments <tiroverus@yahoo.com>
Re: escaping "$" in command line arguments <RedGrittyBrick@spamweary.invalid>
Re: escaping "$" in command line arguments <tadmc@seesig.invalid>
Re: escaping "$" in command line arguments <tadmc@seesig.invalid>
Re: escaping "$" in command line arguments sln@netherlands.com
Re: how detect english subject and predicate in a sente <cwilbur@chromatico.net>
Re: how detect english subject and predicate in a sente <smallpond@juno.com>
Re: how detect english subject and predicate in a sente <tzz@lifelogs.com>
Re: Mathematica 7 compares to other languages <noone@lewscanon.com>
Re: perl segfault - how to troubleshoot sln@netherlands.com
Re: perl segfault - how to troubleshoot <marcumbill@bellsouth.net>
Re: perl segfault - how to troubleshoot <tim@burlyhost.com>
Re: Problem with call to system(), I think. <tzz@lifelogs.com>
Re: Web programming: issues with large amounts og data <tadmc@seesig.invalid>
Re: Web programming: issues with large amounts og data <tzz@lifelogs.com>
Re: Web programming: issues with large amounts og data <r.ted.byers@gmail.com>
Re: Web programming: issues with large amounts og data <tadmc@seesig.invalid>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 4 Dec 2008 03:55:25 -0800 (PST)
From: Brownie <brownie2002@gmail.com>
Subject: dynamic name of a variable in a class
Message-Id: <672f059e-076f-4819-9705-cd3c406e340c@l42g2000yqe.googlegroups.com>
Hello,
I know that my request is ugly, but I need tot do that.
I have a class :
**********************************
package Epoch;
use strict;
use PDL;
sub new {
my ($class) = @_;
my $self = {};
bless($self, $class);
$self->{SOL_L4_A} = Solution->new ();
$self->{SOL_L1_A} = Solution->new ();
return $self;
}
1;
***********************************
SOL_L4_A and SOL_L1_A are to objects of the same class, and the way to
define it is the same (just one parameter is changed in the main
algorithme)
so in the main i have :
[...]
dice_axis($epoch->{SOL_L1_A}->{XYZ},1,$k3-1) .= $solL1_temp[$k];
[...]
dice_axis($epoch->{SOL_L4_A}->{XYZ},1,$k3-1) .= $solL4_temp[$k];
I would like to do something like :
$SOLUTION = L1;
dice_axis($epoch->{SOL_$SOLUTION_A}->{XYZ},1,$k3-1) .= $sol
$SOLUTION_temp[$k];
$SOLUTION = L4;
dice_axis($epoch->{SOL_$SOLUTION_A}->{XYZ},1,$k3-1) .= $sol
$SOLUTION_temp[$k];
I my algorithm, it is not just two lines, ;)
Ty for your attention,
See You
------------------------------
Date: Thu, 04 Dec 2008 13:21:33 +0100
From: Peter Makholm <peter@makholm.net>
Subject: Re: dynamic name of a variable in a class
Message-Id: <877i6gyvua.fsf@vps1.hacking.dk>
Brownie <brownie2002@gmail.com> writes:
> I would like to do something like :
> $SOLUTION = L1;
> dice_axis($epoch->{SOL_$SOLUTION_A}->{XYZ},1,$k3-1) .= $sol
Hash keys are just strings, so beside barewords you can use any string
value as keys, including a double-quoted string:
$epoch->{"SOL_$SOLUTION_A"}->{...}
Or even real expressions:
$epoch->{join "_", "SOL", $SOLUTION, "A"}->{...}
Not that I would do that in you case
//Makholm
------------------------------
Date: Thu, 4 Dec 2008 07:11:51 -0600
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: dynamic name of a variable in a class
Message-Id: <slrngjflon.fbq.tadmc@tadmc30.sbcglobal.net>
Brownie <brownie2002@gmail.com> wrote:
> I know that my request is ugly,
Do you mean that you have already read the FAQ answer for your question?
How can I use a variable as a variable name?
> but I need tot do that.
You only _think_ you need to do that.
Using a more appropriate data structure would avoid needing to use
symbolic references.
> I have a class :
> **********************************
> package Epoch;
>
> use strict;
> use PDL;
>
> sub new {
> my ($class) = @_;
> my $self = {};
> bless($self, $class);
>
> $self->{SOL_L4_A} = Solution->new ();
> $self->{SOL_L1_A} = Solution->new ();
>
> return $self;
> }
> 1;
> ***********************************
> SOL_L4_A and SOL_L1_A are to objects of the same class, and the way to
> define it is the same (just one parameter is changed in the main
> algorithme)
>
> so in the main i have :
> [...]
> dice_axis($epoch->{SOL_L1_A}->{XYZ},1,$k3-1) .= $solL1_temp[$k];
> [...]
> dice_axis($epoch->{SOL_L4_A}->{XYZ},1,$k3-1) .= $solL4_temp[$k];
You have not shown us the declaration for @solL1_temp...
If @solL1_temp is a package variable, then you _could_ use symbolic
references to do what you want (but there be dragons, as pointed out
in the FAQ answer).
If @solL1_temp is a lexical variable, then you _could_ use the
evil "eval EXPR" to do what you want (but there be even scarier
dragons)!
If you instead used a hash to contain your temp arrays, then you
would need neither.
Avoiding dragons is much much safer than slaying dragons. :-)
Instead of:
my @solL1_temp = ( 'one', 'two' );
my @solL4_temp = ( 'three', 'four' );
use a hash-of-arrays:
my %temp = (
solL1 => ['one', 'two' ],
solL4 => ['three', 'four' ],
);
> I would like to do something like :
> $SOLUTION = L1;
Strings in Perl need quotes:
$SOLUTION = 'L1';
> dice_axis($epoch->{SOL_$SOLUTION_A}->{XYZ},1,$k3-1) .= $sol
^^^^^^^^^^^^^^^
> $SOLUTION_temp[$k];
Hash keys are auto-quoted for you only if they are bare words.
If they are not bare words, then you need to quote the hash keys yourself:
dice_axis($epoch->{"SOL_${SOLUTION}_A"}...
or, the somewhat uglier:
dice_axis($epoch->{'SOL_' . $SOLUTION . '_A'}...
Assuming you have adopted a more suitable data structure for your
temp arrays, you can then easily (and safely!) get what you need:
# untested
dice_axis($epoch->{"SOL_${SOLUTION}_A"}->{XYZ},1,$k3-1) .=
$temp{"sol$SOLUTION"}[$k];
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Thu, 4 Dec 2008 08:19:12 -0600
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: dynamic name of a variable in a class
Message-Id: <slrngjfpn0.gfc.tadmc@tadmc30.sbcglobal.net>
Peter Makholm <peter@makholm.net> wrote:
> Brownie <brownie2002@gmail.com> writes:
>
>> I would like to do something like :
>> $SOLUTION = L1;
>> dice_axis($epoch->{SOL_$SOLUTION_A}->{XYZ},1,$k3-1) .= $sol
>
> Hash keys are just strings, so beside barewords you can use any string
> value as keys, including a double-quoted string:
>
> $epoch->{"SOL_$SOLUTION_A"}->{...}
Global symbol "$SOLUTION_A" requires explicit package name at ...
:-)
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Thu, 4 Dec 2008 11:09:40 +0000 (UTC)
From: "Tiro Verus" <tiroverus@yahoo.com>
Subject: escaping "$" in command line arguments
Message-Id: <gh8dpk$nr6$1@chessie.cirr.com>
Can this be done?
I've been trying to count the number of times a given word
appears in an ASCII file. This works for most terms:
==============================
my $search_term = shift;
my $count = 0;
while (<>) {
while (m/\b$search_this\b/g) {
$count++;
}
}
================================
But it doesn't take input search terms beginning with $
such as $fn. I've tried
$./wordcount.pl \$fn textfile
and
$./wordcount.pl '\$fn' textfile
as well as
$./wordcount.pl $fn textfile
Which gives the message "undefined variable" or something like that.
Or the output says " textfile does not contain $fn" when it does.
That was for the '$fn' version. But 'fn' in @ARGV works just fine.
[The code lines with the result msgs have been snipped]
I cannot find anything about this in the Camel Book or the
Cookbook. BTW
$ grep '\$fn' textfile
finds all the lines with "$fn" in them, but I need an occurrence count.
------------------------------
Date: Thu, 04 Dec 2008 12:09:15 +0000
From: RedGrittyBrick <RedGrittyBrick@spamweary.invalid>
Subject: Re: escaping "$" in command line arguments
Message-Id: <4937c86e$0$1343$fa0fcedb@news.zen.co.uk>
Tiro Verus wrote:
> Can this be done?
>
> I've been trying to count the number of times a given word
> appears in an ASCII file. This works for most terms:
> ==============================
> my $search_term = shift;
>
> my $count = 0;
> while (<>) {
> while (m/\b$search_this\b/g) {
> $count++;
> }
> }
> ================================
>
use \Q
$ perl -n -e '\
BEGIN{$x=q($fn)} \
$n++ if /\Q$x/; \
END{print"n=$n\n"}' textfile
n=2
> But it doesn't take input search terms beginning with $
> such as $fn. I've tried
>
> $./wordcount.pl \$fn textfile
>
> and
>
> $./wordcount.pl '\$fn' textfile
>
> as well as
>
> $./wordcount.pl $fn textfile
>
>
> Which gives the message "undefined variable" or something like that.
> Or the output says " textfile does not contain $fn" when it does.
> That was for the '$fn' version. But 'fn' in @ARGV works just fine.
> [The code lines with the result msgs have been snipped]
>
> I cannot find anything about this in the Camel Book or the
> Cookbook. BTW
>
> $ grep '\$fn' textfile
>
> finds all the lines with "$fn" in them, but I need an occurrence count.
>
>
>
grep's c option gives the count of matching lines
$ grep -c '$fn' textfile
2
--
RGB
------------------------------
Date: Thu, 4 Dec 2008 08:12:34 -0600
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: escaping "$" in command line arguments
Message-Id: <slrngjfpai.fbq.tadmc@tadmc30.sbcglobal.net>
Tiro Verus <tiroverus@yahoo.com> wrote:
>
> Can this be done?
Can what be done?
> I've been trying to count the number of times a given word
> appears in an ASCII file. This works for most terms:
^^^^^^^^^^
>==============================
> my $search_term = shift;
^^^^
>
> my $count = 0;
> while (<>) {
> while (m/\b$search_this\b/g) {
^^^^
> $count++;
> }
> }
>================================
No it doesn't.
You should copy/paste working code rather than attempt to retype it.
Have you seen the Posting Guidelines that are posted here frequently?
> But it doesn't take input search terms beginning with $
> such as $fn.
Yes it does.
The real problem is with your pattern rather than with the search term.
Try this:
$_ = 'this has $fn in it';
print "matched boundary\n" if /\b\$fn/;
print "matched without\n" if /\$fn/;
print "matched BOUNDARY\n" if /\B\$fn/;
You should see that only the last two statements make output.
That is because \b requires either \w\W or \W\w and the string being
searched has \W\W (a space and a dollar sign).
This will make output:
$_ = 'this has$fn in it';
print "matched boundary\n" if /\b\$fn/;
because it has \w\W ("s" and dollar sign).
> I've tried
>
> $./wordcount.pl \$fn textfile
>
> and
>
> $./wordcount.pl '\$fn' textfile
>
> as well as
>
> $./wordcount.pl $fn textfile
How to quote things in the shell is a shell question, not a Perl question.
> Which gives the message "undefined variable" or something like that.
^^^^^^^^^^^^^^^^^^^^^^
There is no such message.
Please copy/paste the verbatim text of messages.
Have you seen the Posting Guidelines that are posted here frequently?
> Or the output says " textfile does not contain $fn" when it does.
That is because you have required a word boundary in your pattern.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Thu, 4 Dec 2008 08:20:56 -0600
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: escaping "$" in command line arguments
Message-Id: <slrngjfpq8.gfc.tadmc@tadmc30.sbcglobal.net>
RedGrittyBrick <RedGrittyBrick@spamweary.invalid> wrote:
>
> Tiro Verus wrote:
>> I've been trying to count the number of times a given word
>> appears in an ASCII file.
> grep's c option gives the count of matching lines
> $ grep -c '$fn' textfile
But that does not do what was asked for...
It will report 1 rather than 2 for
$fn is repeated as $fn on the same line
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Thu, 04 Dec 2008 18:13:21 GMT
From: sln@netherlands.com
Subject: Re: escaping "$" in command line arguments
Message-Id: <h57gj4lnmqmb4u1vtr004c3j1kpm3d76e3@4ax.com>
On Thu, 4 Dec 2008 11:09:40 +0000 (UTC), "Tiro Verus" <tiroverus@yahoo.com> wrote:
>
>Can this be done?
>
>I've been trying to count the number of times a given word
>appears in an ASCII file. This works for most terms:
>==============================
>my $search_term = shift;
>
>my $count = 0;
>while (<>) {
> while (m/\b$search_this\b/g) {
> $count++;
> }
>}
>================================
>
>But it doesn't take input search terms beginning with $
>such as $fn. I've tried
>
>$./wordcount.pl \$fn textfile
>
>and
>
>$./wordcount.pl '\$fn' textfile
>
>as well as
>
>$./wordcount.pl $fn textfile
>
>
>Which gives the message "undefined variable" or something like that.
>Or the output says " textfile does not contain $fn" when it does.
>That was for the '$fn' version. But 'fn' in @ARGV works just fine.
>[The code lines with the result msgs have been snipped]
>
>I cannot find anything about this in the Camel Book or the
>Cookbook. BTW
>
>$ grep '\$fn' textfile
>
>finds all the lines with "$fn" in them, but I need an occurrence count.
>
>
------------------------
textfile.txt:
------------------------
But it doesn't take input search terms beginning with $
such as $fn. I've tried
$./wordcount.pl \$fn textfile
and
$./wordcount.pl '\$fn' textfile
------------------------
wordcount.pl:
------------------------
use strict;
use warnings;
my ($search_term, $fname) = @ARGV;
my $count = 0;
open my $fh, $fname or die "Can't open $fname";
while (<$fh>) {
while (/$search_term/g) {
$count++;
}
}
close $fh;
print $count;
------------------------
command line:
------------------------
$./wordcount.pl "\$fn" textfile.txt
3
------------------------------
Date: Thu, 04 Dec 2008 09:58:04 -0500
From: Charlton Wilbur <cwilbur@chromatico.net>
Subject: Re: how detect english subject and predicate in a sentence
Message-Id: <861vwo7zsz.fsf@mithril.chromatico.net>
>>>>> "J" == Jürgen Exner <jurgenex@hotmail.com> writes:
J> Jack <jack_posemsky@yahoo.com> wrote:
>>> That's because it's not a trivial problem.
>>>
>>> Consider: "Time flies like an arrow. Fruit flies like a
>>> banana."
>>>
>>> In the second sentence, what is the subject?
>>
>> Thanks.. So my goal would be to capture what is the subject of
>> the sentence, Time, and Fruit, respectively. However you cant
>> always take
J> You just proved Charlton's point: In the second sentence the
J> subject is not "fruit" but "fruit flies"
And you just proved my actual point: Whether the subject is "fruit" or
"fruit flies" is indeterminate, and that's where the humor in the
statement comes from.
Charlton
--
Charlton Wilbur
cwilbur@chromatico.net
------------------------------
Date: Thu, 4 Dec 2008 07:38:10 -0800 (PST)
From: smallpond <smallpond@juno.com>
Subject: Re: how detect english subject and predicate in a sentence
Message-Id: <2942b93f-27b5-4183-adce-fa5148175c20@f40g2000pri.googlegroups.com>
On Dec 4, 12:49 am, Jack <jack_posem...@yahoo.com> wrote:
> Hi there, just checking to see if anyone knows how to perform this
> basic grammar function ? I searched CPAN and found nothing that was
> able to in Perl..
Here's a good resource of C code, example sentences, and dictionary.
http://www.link.cs.cmu.edu/link/index.html
Haven't seen a perl equivalent.
------------------------------
Date: Thu, 04 Dec 2008 10:34:29 -0600
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: how detect english subject and predicate in a sentence
Message-Id: <867i6frjai.fsf@lifelogs.com>
On Wed, 3 Dec 2008 21:49:14 -0800 (PST) Jack <jack_posemsky@yahoo.com> wrote:
J> Hi there, just checking to see if anyone knows how to perform this
J> basic grammar function ? I searched CPAN and found nothing that was
J> able to in Perl..
If you can limit the input, you're better off. IOW, make your input
conform to some basic templates and then guess from that template.
Otherwise you won't solve it with CPAN, although there are quite a few
commercial NLP products.
What is your real goal? Are you trying to find something in the text,
or accept input to tell you what to do, or analyzing it statistically,
or something else? Each one of those has a specific set of solutions we
can recommend, but there's no generic solution. Language is just too
complex. Don't forget people can use bad grammar, malformed sentences,
misspell, and use English dialects or made-up words.
Ted
------------------------------
Date: Thu, 04 Dec 2008 09:19:04 -0500
From: Lew <noone@lewscanon.com>
Subject: Re: Mathematica 7 compares to other languages
Message-Id: <gh8oso$puq$1@news.albasani.net>
Andreas Waldenburger wrote:
> On Wed, 03 Dec 2008 20:38:44 -0500 Lew <noone@lewscanon.com> wrote:
>
>> Xah Lee wrote:
>>> enough babble ...
>> Good point. Plonk. Guun dun!
>>
>
> I vaguely remember you plonking the guy before. Did you unplonk him in
> the meantime? Or was that just a figure of speech?
I have had some hard drive and system changes that wiped out my old killfiles.
--
Lew
------------------------------
Date: Thu, 04 Dec 2008 16:49:01 GMT
From: sln@netherlands.com
Subject: Re: perl segfault - how to troubleshoot
Message-Id: <lr0gj4d35j214vh0ti7opf7999iuu4rhos@4ax.com>
On Wed, 3 Dec 2008 13:44:00 -0800 (PST), James Harris <james.harris.1@googlemail.com> wrote:
>On 3 Dec, 17:06, xhos...@gmail.com wrote:
>...
>> > Does this mean that the segfault occurred as a result of the close(8)
>> > call - or at least that close() was the last system call prior to the
>> > fault?
>>
>> No to the first--close(8) completed successfully before the segfault.
>> Yes to the second, close(8) was the last system call prior to the fault.
>> So the fault probably occurred in "user space".
>
>To follow up on this, I shut the machine down and ran memtest86+ to
>check the ram. That checked out OK for all tests.
>
>On restart, however, problems with at disk partitions were found. The
>problems reported included
>
>* Block bitmap differences
>* Free inode counts wrong
>* (Most alarming) Buffer I/O errors from which one can only a) ignore
>and b) force rewrite
>* (Most relevant, perhaps, as it relates to Perl's Socket.so though
>not directly):
>
>/usr/lib/perl/5.8.8/auto/Socket/Socket.so.dpkg-tmp mod time Nov 27,
>2007
> has 2 multiply-claimed blocks shared with 0 files
>
>I spent a while running through the reported problems and then let (e2)
>fsck do the rest. It took some time but on subsequent reboot the Perl
>problem had gone away. I expected to have to reinstall Socket.so at
>least but so far it seems to be OK now. As scripts run I'll keep an
>eye on them. Hopefully they will all work now.
>
>I've added a Linux group because this has led to other queries:
>
>1. Is there a way to tell what file systems are corrupt while the
>machine is running normally? - I.e. was Linux (Ubuntu) telling me of
>the faults somewhere?
>2. If it was where does it report this?
>3. If it wasn't why not??? Fsck knew of faults on some of the file
>systems on bootup without having to scan the disks for them. If it
>knows there why not report it sooner?
>
>Thanks to all in the Perl group for the education in debugging tools.
>I'll find other uses for them.
>
>James
I take it you hardly ever shut down/reboot. Every OS seems to do at
least a checksum on the file structure tables (without doing a file
scan) on boot-up.
If all you do is run a particular software all the time, odds are
disk/memory problems manifest in those areas of the disk producing
wild crazy cascading errors .. A typical indication of hardware fatigue.
Replace the whole machine if it is old.
Otherwise, some things to try:
* Run memtest for 24 straight hours, all tests.
* Stress test the cpu/ram, monitoring temperature.
Windows has ORTHOS and Core Temp 94.
* Stress test the disks. Windows has Everest Ultimate.
* Do a full scan on the IDE drives checking for bad physical
sectors.
* Repartition/format and move the software used most frequently
to a new area on the disk. This includes temporary files it
might create, to a new area.
sln
------------------------------
Date: Thu, 4 Dec 2008 19:08:05 +0100 (CET)
From: Bill Marcum <marcumbill@bellsouth.net>
Subject: Re: perl segfault - how to troubleshoot
Message-Id: <rpil06-3o1.ln1@marcumbill.bellsouth.net>
[Followup-To: comp.os.linux.misc]
On 2008-12-04, James Harris <james.harris.1@googlemail.com> wrote:
>
> I was thinking more of indications while Linux is running and the
> disks are mounted, not of taking them down to scan them. I didn't
> explain clearly enough but when restarting Linux the system knew
> immediately that some file systems had errors. It didn't have to scan
> the volumes to know there were errors. It simply said that file system
> X has errors and will be scanned and checked.
>
> If it knew that file system X had errors without scanning it there
> must be a data value somewhere - probably in the affected partition -
> that indicates error. If it wrote this value when closing the system
> down it did so also without scanning the disks. Therefore Linux must
> have known _prior to_ shutdown that file system X had errors. If it
> did so I was wondering if this information is available to the system
> admin prior to shutdown.
>
> Does that make more sense now?
>
Watch for error messages in the log files. Logcheck could help.
------------------------------
Date: Thu, 04 Dec 2008 10:24:33 -0800
From: Tim Greer <tim@burlyhost.com>
Subject: Re: perl segfault - how to troubleshoot
Message-Id: <CfVZk.7743$v37.834@newsfe01.iad>
James Harris wrote:
> I was thinking more of indications while Linux is running and the
> disks are mounted, not of taking them down to scan them.
You can run the checks while the drives/partitions are mounted. fsck
doesn't have to be told to actually try and fix the issues it finds,
but you can simply check with smartctl or similar tools, as well as
running badblocks on a live environment (again, you needn't tell it to
fix the bad blocks or issues it finds). What tools you use, depends on
your drives, drivers, kernel options and what you have installed. I'd
recommend asking in a Linux group or searching google for specifics.
--
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!
------------------------------
Date: Thu, 04 Dec 2008 10:42:41 -0600
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Problem with call to system(), I think.
Message-Id: <86vdtzq4ce.fsf@lifelogs.com>
On 03 Dec 2008 22:53:28 GMT Leon Timmermans <fawaka@gmail.com> wrote:
LT> On Tue, 02 Dec 2008 17:47:31 +0000, sln wrote:
>> @args = (
>> "activity.report.1.pl",
>> "\"$merchant\"",
>> $merchants_usernames{$merchant},
>> $merchants{$merchant},
>> $date_string,
>> "1>$dir\\activity.Report.$merchant.stdout",
>> "2>$dir\\activity.Report.$merchant.stderr",
>> );
>>
LT> Those last few arguments wouldn't work well. It's probably best to use
LT> something like IPC:Open3 here.
IPC::Run is also good, although the docs are a bit confusing.
Ted
------------------------------
Date: Thu, 4 Dec 2008 06:35:54 -0600
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: Web programming: issues with large amounts og data
Message-Id: <slrngjfjla.fbq.tadmc@tadmc30.sbcglobal.net>
Ted Byers <r.ted.byers@gmail.com> wrote:
> mkdir "$now_string";
You should test to see if you actually got what you asked for.
See also:
perldoc -q vars
What's wrong with always quoting "$vars"?
Then make the line above something like:
mkdir $now_string or die "could not create '$now_string' directory $!";
> In general, what would you add to this sort of script to detect any
> kind of failure and take appropriate remedial action should a problem
> arise?
eval BLOCK
perldoc -f eval
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Thu, 04 Dec 2008 10:41:57 -0600
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Web programming: issues with large amounts og data
Message-Id: <86zljbq4dm.fsf@lifelogs.com>
On Wed, 3 Dec 2008 15:19:29 -0800 (PST) Ted Byers <r.ted.byers@gmail.com> wrote:
TB> The problem manifests itself as the download terminating and the
TB> script appearing to freeze. This only happens when the download is
TB> large (many megabytes in size). i have a data feed that I can only
TB> access using POST to a given URI (with query parameters specifyin what
TB> data I am trying to retrieve. Never does this result in an error.
TB> The script just freezes and the download ends.
Try using `curl' from the command line to do the same large download.
Does it also freeze (or rather, hang waiting)? If so, the problem is
not in the Perl code.
If `curl' does not hang, you can trace the HTTP exchange that `curl'
does and compare it with the one that LWP does. That will tell you what
is different between the two, and perhaps point you to the solution.
Ted
------------------------------
Date: Thu, 4 Dec 2008 09:34:14 -0800 (PST)
From: Ted Byers <r.ted.byers@gmail.com>
Subject: Re: Web programming: issues with large amounts og data
Message-Id: <a5a50c61-6325-439d-b7d8-3203bb53395c@d42g2000prb.googlegroups.com>
On Dec 4, 11:41=A0am, Ted Zlatanov <t...@lifelogs.com> wrote:
> On Wed, 3 Dec 2008 15:19:29 -0800 (PST) Ted Byers <r.ted.by...@gmail.com>=
wrote:
>
> TB> The problem manifests itself as the download terminating and the
> TB> script appearing to freeze. =A0This only happens when the download is
> TB> large (many megabytes in size). =A0i have a data feed that I can only
> TB> access using POST to a given URI (with query parameters specifyin wha=
t
> TB> data I am trying to retrieve. =A0Never does this result in an error.
> TB> The script just freezes and the download ends.
>
> Try using `curl' from the command line to do the same large download.
> Does it also freeze (or rather, hang waiting)? =A0If so, the problem is
> not in the Perl code.
>
> If `curl' does not hang, you can trace the HTTP exchange that `curl'
> does and compare it with the one that LWP does. =A0That will tell you wha=
t
> is different between the two, and perhaps point you to the solution.
>
> Ted
Hi Ted,
Thanks.
Where is 'curl' to be found?
Thanks
Ted
------------------------------
Date: Thu, 4 Dec 2008 11:57:54 -0600
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: Web programming: issues with large amounts og data
Message-Id: <slrngjg6h2.j25.tadmc@tadmc30.sbcglobal.net>
Ted Byers <r.ted.byers@gmail.com> wrote:
> Where is 'curl' to be found?
type
curl
into the little dialog box at http://www.google.com.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
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 2030
***************************************