[22936] in Perl-Users-Digest
Perl-Users Digest, Issue: 5156 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 30 14:06:19 2003
Date: Mon, 30 Jun 2003 11:05:09 -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, 30 Jun 2003 Volume: 10 Number: 5156
Today's topics:
Re: BTree examples ?? ctcgag@hotmail.com
Re: BTree examples ?? (Mark Jason Dominus)
Re: Can the Repetition Operator Be Nested? (MES)
Re: Fast CGI Vs Java Application Servers <cwilbur@mithril.chromatico.net>
Re: Fast CGI Vs Java Application Servers ctcgag@hotmail.com
Re: Fast CGI Vs Java Application Servers <Kyler@news.Lairds.org>
Re: Finding cycles and Graph::Base ctcgag@hotmail.com
foreach county <todd@asgweb.net>
Re: How do you sort a 2D array with column headers? ctcgag@hotmail.com
Re: How to create a file <levin.spambox@telia.com>
Re: Installing CtCmd on Windows (Sherman Willden)
Re: Is there a good free/not so expensive Perl IDE for <syscjm@gwu.edu>
Monitoring a W2K Service <ellem52@mail.com>
Re: Monitoring a W2K Service <ThomasKratz@REMOVEwebCAPS.de>
Re: Monitoring a W2K Service (Greg Bacon)
Re: Monitoring a W2K Service <ellem52@mail.com>
Re: No error for calling undefined sub's? <GPatnude@HotMail.com>
Re: non-blocking writing to file ... <ben.goldberg@hotpop.com>
Re: reading buffered form data (Greg Bacon)
Re: reading buffered form data <cyberjeff@sprintmail.com>
SHIFT not shuffling ? (stu7)
Re: Speed of file vrs dbase access <fatted@yahoo.com>
Re: transform 3*0.0 into 0.0, 0.0, 0.0 <starobs99@yahoo.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 30 Jun 2003 15:53:38 GMT
From: ctcgag@hotmail.com
Subject: Re: BTree examples ??
Message-Id: <20030630115338.369$qh@newsreader.com>
tivolinewbie@canada.com (Kenjis Kaan) wrote:
> Hello. I am wondering if anyone has an example of using BTree for
> storing data on a disk file.?? I found some BTree modules on the
> web, but none give example of how you would then store it and retrieve
> it from disk drive. I have a need to store hundred of thousands of
> key, data values but told not to use a RDBMS.
Were you told *why* not to use a RDBMS? If there is a valid reason
to exclude RDBMS, that same reason might exclude other suggestions.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service New Rate! $9.95/Month 50GB
------------------------------
Date: Mon, 30 Jun 2003 16:58:21 +0000 (UTC)
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: BTree examples ??
Message-Id: <bdpq7d$v66$1@plover.com>
In article <bdigil$a5a$1@troll.powertech.no>,
Vlad Tepes <minceme@start.no> wrote:
>A small note: If you have a very big hash, you'd might like to save
>memory by doing
>
> while ( (my $k, undef) = each %h ) {
> print "$k\n";
> }
>
>instead of using the foreach loop in the above example.
It's legal to assign a two-element list to a list of only one scalar;
the second element is discarded, which is just what you want here. So
why wouldn't you just do this?
while ( my ($k) = each %h ) {
print "$k\n";
}
or simpler yet, call 'each' in scalar context:
while ( my $k = each %h ) {
print "$k\n";
}
------------------------------
Date: 30 Jun 2003 10:04:08 -0700
From: mesmith@mygfa.org (MES)
Subject: Re: Can the Repetition Operator Be Nested?
Message-Id: <f6104297.0306300904.7285db79@posting.google.com>
Thanks for the suggestions.
I used the -w flag but misinterpreted the error message. I also
slightly misrepresented the problem. I should have used printf instead
of print. What I want to do is build a format string. This prints out
the format string I expect
print (("This %s" x 2 . "\n") x 2);
But this does not produce the results I expect from printf
printf (("This %s" x 2 . "\n") x 2, "one", "two", "three", "four");
I suspect that the second copy of the format string is being supplied
as the argument for the first %s. "one" is supplied as the argument
for the second %s. The remaining supplied arguments are discarded
because the end of the format string has been reached.
------------------------------
Date: Mon, 30 Jun 2003 15:44:37 GMT
From: Charlton Wilbur <cwilbur@mithril.chromatico.net>
Subject: Re: Fast CGI Vs Java Application Servers
Message-Id: <87k7b3zioy.fsf@mithril.chromatico.net>
Kyler Laird <Kyler@news.Lairds.org> writes:
> Outstanding points. For trivial applications, CGI is fine, but beyond
> that we get into the need for this infrastructure. Creating it from
> scratch (or bundling it into each application) is a pain and demands
> ongoing maintenance. It's great for "tinkerers" but doesn't make
> sense for someone wanting to concentrate on building applications.
>
> A Python solution for all of this is Zope.
There are several solutions for Perl, and I'd imagine that there's at
least one for Tcl, but that's sort of beside the point.
Going the Java route buys you some things. There are a lot of Java
developers out there, and with baseline-competent management, Java can
do a decent job of protecting you from less competent developers.
(Much as I like Perl, the same cannot be said for it.) There is a
standard interface between the web application and the container that
can handle the more annoying problems such as object persistence,
session state, and authentication, not to mention more difficult
things like load balancing and clustering.
At the same time, Java has a lot more overhead. You'll need more
hardware and probably more support staff, and the easy availability of
Java support staff is no indication that they're any good. And then
you get to run into the single biggest Java headache. Because the
implementation involves everything running in a virtual machine, and
many code libraries are closed-source, with just the interface and the
compiled bytecode available, it can be extremely difficult to track
down a bug: even identifying with any certainty whether the issue lies
in your code, in the library you're calling, or in the JVM can be a
pain.
I suppose what I'm getting at is that if you're comparing FastCGI to
Java based solely on performance, you're ignoring a whole host of
criteria that can be equally as important: development speed,
available support, and scalability, just to name a few. In
particular, if you've got programmers and admins on staff who can do
good work with FastCGI, don't force them to use Java instead; the
results will probably be horrible at first, and any performance
improvement you expect to see by switching to Java will be more than
offset by the learning curve.
My advice would be to use Java for a project or site that is large
enough to afford the overhead, and to use a language-based approach
(mod_perl, Mason, Zope) otherwise. If you're the only person working
on the project, it's almost certainly too small to be worth the
overhead.
Charlton
------------------------------
Date: 30 Jun 2003 16:09:24 GMT
From: ctcgag@hotmail.com
Subject: Re: Fast CGI Vs Java Application Servers
Message-Id: <20030630120924.209$qh@newsreader.com>
Charles Handy <chppxf1@NOSPAM_yahoo.com.au> wrote:
> How does FastCGI compare against java Apps running in java app servers
> like TomCat, Sun One, WebLogic and WebSphere? Is there a business case
> for switching from CGI to Java?
Do you want there to be one?
> Performance?
I've seen dozens of features that were implemented in CGI (not mod_perl
or FastCGI) rewritten to run on a java app server on a beefier machine.
None of them were noticably faster, and many were slower.
> Productivity?
I'm about 5x less productive in Java.
> Features?
Yeah, they have features out the wazzoo.
> Object orientation?
I write object oriented perl, when I feel it's productive to do so.
> Code Reuse?
Switching a working application to a new language is about the
greatest possible crime there is against code reuse.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service New Rate! $9.95/Month 50GB
------------------------------
Date: Mon, 30 Jun 2003 16:27:17 GMT
From: Kyler Laird <Kyler@news.Lairds.org>
Subject: Re: Fast CGI Vs Java Application Servers
Message-Id: <p485t-22h.ln1@jowls.lairds.org>
Wojciech Kocjan <wojciech@n0spam-kocjan.org> writes:
>> Outstanding points. For trivial applications, CGI is fine, but beyond
>> that we get into the need for this infrastructure. Creating it from
>> scratch (or bundling it into each application) is a pain and demands
>> ongoing maintenance. It's great for "tinkerers" but doesn't make
>> sense for someone wanting to concentrate on building applications.
>That depends. Many companies want to write their own base modules, so
>that they can be extended to meet their needs. This is very time
>consuming, but the upside is that you know the code perfectly and are
>able to fix bugs/enhance the code very fast.
Sure, and I do this. But I do it under Zope where I don't have to
create from scratch (and maintain) anything that is not specific to
my projects.
--kyler
------------------------------
Date: 30 Jun 2003 17:59:48 GMT
From: ctcgag@hotmail.com
Subject: Re: Finding cycles and Graph::Base
Message-Id: <20030630135948.533$v5@newsreader.com>
William Goedicke <goedicke@goedsole.com> wrote:
> Dear Y'all -
>
> Has anybody come up with a way of finding cycles in graphs created
> with Graph::Base?
I don't know Graph::Base specifically, but an easy way to find
cycles, if performance isn't a huge concern, is:
foreach $e (edge()) {
my ($v1,$v2)=get_vertices($e);
delete($e);
if (is_path($v1,$v2)) {
restore($e);
edge_is_in_cycle($e);
}
else {
restore($e);
};
};
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service New Rate! $9.95/Month 50GB
------------------------------
Date: Mon, 30 Jun 2003 10:51:08 -0600
From: Todd Anderson <todd@asgweb.net>
Subject: foreach county
Message-Id: <3F00692D.48B8C073@asgweb.net>
Dear Persons,
The code below doesn't work on some computers. The county list isn't
being displayed. I can't firgure out why it would on most computers but
not on some. I say computer because it's intermittent on the same browsers.
Any help is appreciated and thanks in advance.
sub Chooser_page {
if($name eq "Defaults"){ @counties = split (/\,/, $Defaults); }
if($name eq "Trustees"){ @counties = split (/\,/, $Trustees); }
if($name eq "Fsbos"){ @counties = split (/\,/, $Fsbos); }
&generic_header("Choose County");
&pagesetup;
print qq~
<table width="100%"><tr><td align="center">
<font id="font20">Choose a $name County</font>
<P>~;
foreach $county (@counties){
print qq~<a href="customerservice.cgi?$where=on&county=$county&session_key=$session_key&site_key=$site_key">$county<BR>~;
}
print qq~</td></tr></table>~;
&pageclose;
}# page
------------------------------
Date: 30 Jun 2003 17:23:21 GMT
From: ctcgag@hotmail.com
Subject: Re: How do you sort a 2D array with column headers?
Message-Id: <20030630132321.238$lk@newsreader.com>
mjd@plover.com (Mark Jason Dominus) wrote:
...
> The details of the study are at
> http://perl.plover.com/yak/flags/dollar-pound/. Here is the short
> version. $#array is commonly used for five things:
>
> 1. Generating a list of indices for an array. (Your example above is
> one of these; it is @{$m}[1..$#$m].)
I wish the ".." operator, when occuring in a slice, were sufficiently
magical to allow @{$m}[1..-1] to replace the above.
>
> 2. The upper bound of a C-style 'for' loop, as
>
> for ($i=0; $i <= $#array; $i++) {
> do something with $array[$i];
> }
I use this very frequently when I have parallel arrays. Of course,
that might not exactly fit in your criteria for inclusion in this
category. I also use this when I want to change the length of @array
during the loop.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service New Rate! $9.95/Month 50GB
------------------------------
Date: Mon, 30 Jun 2003 15:23:49 GMT
From: Bernt Levinsson <levin.spambox@telia.com>
Subject: Re: How to create a file
Message-Id: <b5l0gv42agd334efm6vh5vu7noj65uchnl@4ax.com>
>This I've learned:
>open(OUTFILE, ">output.txt");
>
>But, if the file doesn't exists, how can get the file handle to write
>to a new file?
My misstake all folks!
I was reading in a book that had this example:
unless (open(OUTFILE, ">test.zzz")) {
die ("cannot open input file: test.zzz\n");
}
print OUTFILE ("Testing...");
I didn't even test it becouse it didn't tell eg "created if necessary"
, becouse of that I was certain it should go to "die".
http://w1.321.telia.com/~u32102551/
------------------------------
Date: 30 Jun 2003 11:00:04 -0700
From: sherman.willden@hp.com (Sherman Willden)
Subject: Re: Installing CtCmd on Windows
Message-Id: <3a80d8d6.0306301000.112e8868@posting.google.com>
Ok, I got it.
1. Didn't have ClearCase in the path, lib, or inc
2. Even after putting in the path to ClearCase the scripts still
couldn't find it. The path should be C:\Program
Files\rational\ClearCase\bin. The path where ClearCase is installed is
C:\Program Files\rational\bin. I set the CLEARCASEHOME environment
variable to C:\Program Files\rational\bin.
CtCmd is now installed.
Sherman
sherman.willden@hp.com (Sherman Willden) wrote in message news:<3a80d8d6.0306271051.31b2fd3e@posting.google.com>...
> I reinstalled Visual Studio on my hosts and CtCmd installed
> wonderfully on one of them. The other produces this output:
>
> Microsoft (R) Program Maintenance Utility Version 6.00.8168.0
> Copyright (C) Microsoft Corp 1988-1998. All rights reserved.
>
> cp CtCmd.pm blib\lib\ClearCase\CtCmd.pm
> AutoSplitting blib\lib\ClearCase\CtCmd.pm
> (blib\lib\auto\ClearCase\CtCmd)
> perl autoDef cmdsyn.conf
> getOrdinal failed on cmdsyn_exec
> NMAKE : fatal error U1077: 'perl' : return code '0x9d'
> Stop.
>
> H:\ClearCase\CtCmd-1.03\CtCmd>
>
> Any ideas? Where do I look when I get errors like this?
>
> Thanks;
>
> Sherman
------------------------------
Date: Mon, 30 Jun 2003 13:10:11 -0400
From: Chris Mattern <syscjm@gwu.edu>
Subject: Re: Is there a good free/not so expensive Perl IDE for Linux
Message-Id: <3F006EF3.5070603@gwu.edu>
Bernard El-Hagin wrote:
> Gary Blydenburgh wrote:
>
>
>
>>Subject: Is there a good free/not so expensive Perl IDE for Linux
>
>
>
> Yes. xterm.
>
>
Combined with vi, for preference.
Chris Mattern
------------------------------
Date: Mon, 30 Jun 2003 11:30:29 -0400
From: LM <ellem52@mail.com>
Subject: Monitoring a W2K Service
Message-Id: <qnl0gvs5m13rco7j921g2v1hfu9la5fssm@4ax.com>
I am looking to write a few scripts that will monitor various W2K
Services (like FTP for instance) and simply email me when thy are
down.
I (despite having several Perl books including WIN32 PERL SCRIPTING by
Roth) am having a total brain freeze on this topic. (I haven't had to
write a Perl script in about a year.) Can someone shove me in the
right direction please?
--
There's more than one way to do it, but only some of them work
------------------------------
Date: Mon, 30 Jun 2003 18:18:32 +0200
From: "Thomas Kratz" <ThomasKratz@REMOVEwebCAPS.de>
Subject: Re: Monitoring a W2K Service
Message-Id: <3f0062ce.0@juno.wiesbaden.netsurf.de>
DQoiTE0iIDxlbGxlbTUyQG1haWwuY29tPiB3cm90ZS4uLg0KPiBJIGFtIGxvb2tpbmcgdG8gd3Jp
dGUgYSBmZXcgc2NyaXB0cyB0aGF0IHdpbGwgbW9uaXRvciB2YXJpb3VzIFcySw0KPiBTZXJ2aWNl
cyAobGlrZSBGVFAgZm9yIGluc3RhbmNlKSBhbmQgc2ltcGx5IGVtYWlsIG1lIHdoZW4gdGh5IGFy
ZQ0KPiBkb3duLg0KPiANCj4gSSAoZGVzcGl0ZSBoYXZpbmcgc2V2ZXJhbCBQZXJsIGJvb2tzIGlu
Y2x1ZGluZyBXSU4zMiBQRVJMIFNDUklQVElORyBieQ0KPiBSb3RoKSBhbSBoYXZpbmcgYSB0b3Rh
bCBicmFpbiBmcmVlemUgb24gdGhpcyB0b3BpYy4gIChJIGhhdmVuJ3QgaGFkIHRvDQo+IHdyaXRl
IGEgUGVybCBzY3JpcHQgaW4gYWJvdXQgYSB5ZWFyLikgIENhbiBzb21lb25lIHNob3ZlIG1lIGlu
IHRoZQ0KPiByaWdodCBkaXJlY3Rpb24gcGxlYXNlPw0KDQpJZiB5b3UgYXJlIHdpbGxpbmcgdG8g
cG9sbCB0aGUgU2VydmljZXMsIGhhdmUgYSBsb29rIGF0IFdpbjMyOjpQZXJmTGliLiBCdXQgaXQg
c2VlbXMgZWFzaWVyIHRvIG1lIHRvIGhhdmUgVzJLIGNhbGwgYSBzY3JpcHQgaWYgdGhlIHNlcnZp
Y2Ugc2hvdWxkIGZhaWwgKG9yIHlvdSBjYW4gaGF2ZSBpdCByZXN0YXJ0ZWQgYXV0b21hdGljYWxs
eSkuIEp1c3QgbG9vayBhdCB0aGUgJ1JlY292ZXJ5JyB0YWIgaW4gdGhlIHNlcnZpY2UgcHJvcGVy
dGllcy4NCg0KVGhvbWFz
------------------------------
Date: Mon, 30 Jun 2003 16:42:51 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: Monitoring a W2K Service
Message-Id: <vg0q4bie39un23@corp.supernews.com>
In article <qnl0gvs5m13rco7j921g2v1hfu9la5fssm@4ax.com>,
LM <ellem52@mail.com> wrote:
: I am looking to write a few scripts that will monitor various W2K
: Services (like FTP for instance) and simply email me when thy are
: down.
:
: [...]
Have you looked at the Win32::Service module? Here's a program to
examine services:
C:\Temp>type try.pl
#! perl
use warnings;
use strict;
BEGIN {
# hardcoded, yuck
my %state = (
SERVICE_STOPPED => 0x00000001,
SERVICE_START_PENDING => 0x00000002,
SERVICE_STOP_PENDING => 0x00000003,
SERVICE_RUNNING => 0x00000004,
SERVICE_CONTINUE_PENDING => 0x00000005,
SERVICE_PAUSE_PENDING => 0x00000006,
SERVICE_PAUSED => 0x00000007,
);
for (keys %state) {
eval "sub $_ () { $state{$_} }";
}
sub state_name {
my $state = shift;
for (keys %state) {
return $_ if $state == $state{$_};
}
'<UNKNOWN STATE>';
}
}
use Win32::Service qw/ GetServices GetStatus /;
my %service;
unless (GetServices '', \%service) {
die "$0: GetServices: $^E";
}
my @running;
my @other;
foreach my $long_name (keys %service) {
my $short_name = $service{$long_name};
my %status;
unless (GetStatus '', $short_name, \%status) {
push @other => [ $long_name, $^E ];
next;
}
if ($status{CurrentState} == SERVICE_RUNNING) {
push @running => $long_name;
}
else {
push @other => [ $long_name, state_name($status{CurrentState}) ];
}
}
print "Running:\n",
map(" - $_\n", sort { lc($a) cmp lc($b) } @running),
"\n",
"Other:\n",
map(
" - $_->[0]: $_->[1]\n",
sort { lc($a->[0]) cmp lc($b->[0]) } @other
);
C:\Temp>perl try.pl
Running:
[...]
- System Event Notification
- Task Scheduler
[...]
Other:
- Alerter: SERVICE_STOPPED
- Application Management: SERVICE_STOPPED
[...]
Hope this helps,
Greg
--
I'm sorry, Dave, but that's a feature.
-- Larry Wall in <200001261652.IAA02866@kiev.wall.org>
------------------------------
Date: Mon, 30 Jun 2003 12:59:21 -0400
From: LM <ellem52@mail.com>
Subject: Re: Monitoring a W2K Service
Message-Id: <t1r0gv8jqejl4jah365tkvm2fnd1aiqh4q@4ax.com>
On Mon, 30 Jun 2003 18:18:32 +0200, "Thomas Kratz"
<ThomasKratz@REMOVEwebCAPS.de> wrote:
>
>"LM" <ellem52@mail.com> wrote...
>> I am looking to write a few scripts that will monitor various W2K
>> Services (like FTP for instance) and simply email me when thy are
>> down.
>>
>> I (despite having several Perl books including WIN32 PERL SCRIPTING by
>> Roth) am having a total brain freeze on this topic. (I haven't had to
>> write a Perl script in about a year.) Can someone shove me in the
>> right direction please?
>
>If you are willing to poll the Services, have a look at Win32::PerfLib. But it seems easier to me to have W2K call a script if the service should fail (or you can have it restarted automatically). Just look at the 'Recovery' tab in the service properties.
>
thanks we are trying to figure out why it is going down, it's more of
a project than a valid IT concern.
Thanks for the idea.
>Thomas
--
There's more than one way to do it, but only some of them work
------------------------------
Date: Mon, 30 Jun 2003 15:59:40 GMT
From: "codeWarrior" <GPatnude@HotMail.com>
Subject: Re: No error for calling undefined sub's?
Message-Id: <M7ZLa.21283$Jw6.8862050@news1.news.adelphia.net>
"kalasend" <kalasend@yahoo.com> wrote in message
news:bb2cde26.0306271605.7a2addd6@posting.google.com...
> Hi,
> I am having this problem:
> Since some point in time the script is not complaining about calls of
> any undefined subroutines(e.g. by a typo). It simply exits, like it
> finished running. It didn't use to do that but I can't possibly
> remember what change I made caused this.
> What is likely to be wrong here?
>
> thanks
> ben
Read up on AUTOLOAD....
------------------------------
Date: Mon, 30 Jun 2003 12:37:02 -0400
From: Benjamin Goldberg <ben.goldberg@hotpop.com>
Subject: Re: non-blocking writing to file ...
Message-Id: <3F00672E.56010F86@hotpop.com>
Dieter D'Hoker wrote:
>
> I write a gameserver written in perl ,
> so pign is very important ,
What is "pign" ?
> every 15 minutes it writes winlist , configuration ,s tatistics ,
> profiles , ... to different files ...
> It takes some time to do so , so if there was a game goign on at that
> moment it will "block" for a some time .
> (not that much the files aren't that big but still ...)
You may be able to cut down the speed of this by opening the filehandles
once when your program starts, and never closing them. After each time
that you write all your stuff to a particular file, seek() that handle
back to the beginning.
> Now I first tried it to make it non-bloking by forking my server ,
> and writing the file in my child ,
This will only improve your program's speed if you do it on unix, where
real fork()ing exists -- if you're on windows, fork() is emulated using
something called "ithreads." Although ithreads provides much of the
functionality of fork, the startup time is quite big.
Oh, and it will only help the program's speed if the data segment of a
process's memory is copied using copy-on-write.
> but that even results in even more time lost I noticed ,
> I guess because it has to copy the entire server into memory ,
> and the server does take quite an amount of ram ...
>
> next option would be using threading ,
> but becaus emy shell doesn't support threading this is not an option
> ...
If this were C, then threads would be your best bet.
Or possibly posix AIO, or some other asynchronous IO module.
> maybe there is a module that can do this ?
To magically speed up your program? Not likely.
> or some other method ?
Besides keeping the filehandles open, you might consider writing the
data only at times when a delay won't be noticable.
Also, writing a little data at a time might help -- just write the
winlist, and then later on, just write the configuration, then later on,
just write the statistics, etc.
> I thought of preforkign a child , running a server on the child ,
> where the parent can conenct to from time to time passing thourgh the
> files , and the the child saves them , but that's kinda complicated do
> do I guess
> ...
Not just complicated, but (even ignoring the overhead of preforking and
connecting), you still will need to transfer the data from the parent to
the child!
> any ideas ?
> or examples of code ?
--
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}
------------------------------
Date: Mon, 30 Jun 2003 15:14:02 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: reading buffered form data
Message-Id: <vg0ktq30avkcc9@corp.supernews.com>
In article <3EFFDF35.183314E5@sprintmail.com>,
Jeff Thies <cyberjeff@sprintmail.com> wrote:
: I have a multipart form with several fields including an imput
: type="file" that needs to be FTP'd elsewhere. The file input may be
: quite large.
:
: If I were to read in the file using CGI.pm, CGI.pm would slurp in
: the entire "file" into a temp file, potentially exceeding the storage
: quota.
Doesn't your provider at least enforce separate quotas for temporary
directories such as /usr/tmp, /var/tmp/, and /tmp?
: I think I'm going to have read from STDIN directly.
: [...]
Probably a bad idea. Have you considered patching CGI.pm to return
the file data in a scalar? Even so, what are you going to do with
the data then? Net::FTP deals in terms of files.
Greg
--
Of all the enemies to public liberty war is, perhaps, the most to be dreaded,
because it comprises and develops the germ of every other.
-- James Madison
------------------------------
Date: Mon, 30 Jun 2003 17:49:10 GMT
From: Jeff Thies <cyberjeff@sprintmail.com>
Subject: Re: reading buffered form data
Message-Id: <3F0077B0.B91017CF@sprintmail.com>
Greg Bacon wrote:
>
> In article <3EFFDF35.183314E5@sprintmail.com>,
> Jeff Thies <cyberjeff@sprintmail.com> wrote:
>
> : I have a multipart form with several fields including an imput
> : type="file" that needs to be FTP'd elsewhere. The file input may be
> : quite large.
> :
> : If I were to read in the file using CGI.pm, CGI.pm would slurp in
> : the entire "file" into a temp file, potentially exceeding the storage
> : quota.
>
> Doesn't your provider at least enforce separate quotas for temporary
> directories such as /usr/tmp, /var/tmp/, and /tmp?
They seem to vary. At least one I work with doesn't, which has been a
big problem in the past.
>
> : I think I'm going to have read from STDIN directly.
> : [...]
>
> Probably a bad idea. Have you considered patching CGI.pm to return
> the file data in a scalar?
Nope. Is that a tough thing to do? I assumed that it was written in C,
which I have only a passing knowledge of. I'll go look now...
> Even so, what are you going to do with
> the data then? Net::FTP deals in terms of files.
Well maybe I'm wrong but I see that Net::FTP has an append method.
Thanks for the reply, after I posted this I realized this may have been
more of a CGI that perl question
Cheers,
Jeff
------------------------------
Date: 30 Jun 2003 10:56:29 -0700
From: stuseven@hotmail.com (stu7)
Subject: SHIFT not shuffling ?
Message-Id: <d7dd90b0.0306300956.27120761@posting.google.com>
+ Perl's SHIFT function seems to say that it both
reads, and removes, the first element of whatever array
is being used with it... shift or unshift for the first
or last array element is a handy idea, although I'm not
too sure why a separate function is needed for this...
...thats not my problem though :)
I tried using shift to erase the first element of an
array repeatedly, until it was empty... nice for a counting
program maybe...
$a = shift(@oneTOfive) ;
print $a ;
...here is where I got stuck... how do you print the first
shifted element, and then get to the next ? I actually tried
"next", which perl didnt accept.
I then tried a GOTO loop... and I know this function has
many fans in the perl community :)... odd, with a goto, the
first element seemed to reprint, like it never got erased ?
Also, I tried my first big plate of perl spaghetti :)
So finally... after copying the above two lines for each
element, I was able to erase every element in the array, but
isn't there a simple [next type of thing] to use with SHIFT...
or is it just one of those simple functions that were never
intended to do fancy work ?
------------------------------
Date: Mon, 30 Jun 2003 18:43:40 +0200
From: "Fatted" <fatted@yahoo.com>
Subject: Re: Speed of file vrs dbase access
Message-Id: <3f0067ea$0$45377$1b62eedf@news.wanadoo.nl>
"Abigail" <abigail@abigail.nl> wrote in message
news:slrnbg07ro.el.abigail@alexandra.abigail.nl...
> fatted (fatted@yahoo.com) wrote on MMMDXC September MCMXCIII in
> <URL:news:4eb7646d.0306300038.2be15c80@posting.google.com>:
<snippity snip>
> First of all,
Thanks for replying Abigail.
> that's not a Perl question.
I think it is :) I want to carry out data access using a Perl script.
(We could argue that this is a Perl newsgroup not an OS / dbase
newsgroup, but I think from previous posts to the group, usually, people
don't mind briefly discussing these things, especially when popular
modules and built in functions are used).
> Second, it depends. It depends
> on how the data is stored, and how you make requests.
Data currently is stored in a plain text file on linux system, less than
600 ascii chars per file, perhaps 100 files. Accessed using perls open
command and <>.
I'm thinking of storing contents of each file in a table, 1 file content
per row. The data would then be accessed using the DBI module interface
to MySQL (select statement). With the provision that a database handle
had already been created (dbase handle used previously in script).
In both cases the MySQL database and plain text files would be stored on
the same machine as the perl script.
> The only way to know for sure is it do some extensive testing, under
> production circumstances.
I was just wondering whether there would be appreciable differences,
between the two, perhaps answers of the "Are you crazy doing it like
that, stick to ..." variety (and maybe a because :).
------------------------------
Date: Mon, 30 Jun 2003 11:43:51 -0500
From: CM <starobs99@yahoo.com>
Subject: Re: transform 3*0.0 into 0.0, 0.0, 0.0
Message-Id: <bdppak$6tg7o$1@ID-189674.news.dfncis.de>
Bob Walton wrote:
> Brian McCauley wrote:
>
>> CM <starobs99@yahoo.com> writes:
>
> ...
>
>> s/(\d+)\*(^[,]+)/join ", ", ( $2 ) x $1/eg;
>
>
> [^----------^^
>
Thanks to all, I finaly adopted the following program (just for people
who could have a similar question) :
--------------------------------------------------------------------
#!/usr/bin/perl
# Transform e.g. 3*4.5 into 4.5 4.5 4.5
# Transform , into _space_
# Usage: removestars.pl input.dat > output.dat
#
open(INPUT, "<$ARGV[0]") || die "Cannot open $ARGV[0]";
while (<INPUT>)
{
$a =$_;
$a =~ s/(\d+)\*(\S+)(,)/print "$2 " for 1 .. $1/e;
$a =~ s/(\d+)\*(\S+)($)/print "$2 " for 1 .. $1/e;
$a =~ s/,/ /g;
print $a;
}
close(INPUT);
--------------------------------------------------------------------
------------------------------
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.
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 5156
***************************************