[24732] in Perl-Users-Digest
Perl-Users Digest, Issue: 6887 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 20 03:06:08 2004
Date: Fri, 20 Aug 2004 00:05:10 -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 Fri, 20 Aug 2004 Volume: 10 Number: 6887
Today's topics:
Re: Any YahooPop/fetchyahoo Like For NNTP on Google? <usenet200408@tobyinkster.co.uk>
Re: Can I modify scalars contained in the array ref ret <eric-amick@comcast.net>
Re: Can I modify scalars contained in the array ref ret <postmaster@castleamber.com>
Re: Database vs Text for text search <spamtrap@dot-app.org>
Re: Database vs Text for text search <SaveWorldFromAids@alexa.com>
Re: Help: joining 5 LARGE text files <Joe.Smith@inwap.com>
Re: How Should I Check for Directory existance in a ser <1usa@llenroc.ude.invalid>
Re: How to upload a file from a local pc to a web serv <Joe.Smith@inwap.com>
Re: perl interpreter automatically exit windows so how <end@dream.life>
Re: perl interpreter automatically exit windows so how <end@dream.life>
Re: perl interpreter automatically exit windows so how <end@dream.life>
Re: perl interpreter automatically exit windows so how <1usa@llenroc.ude.invalid>
Re: perl interpreter automatically exit windows so how <1usa@llenroc.ude.invalid>
Re: perl interpreter automatically exit windows so how <sbryce@scottbryce.com>
Re: perl interpreter automatically exit windows so how <spamtrap@dot-app.org>
Re: split inconsistency- why? (David Combs)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 20 Aug 2004 07:06:07 +0100
From: Toby Inkster <usenet200408@tobyinkster.co.uk>
Subject: Re: Any YahooPop/fetchyahoo Like For NNTP on Google?
Message-Id: <pan.2004.08.20.06.06.03.885372@tobyinkster.co.uk>
http://links.i6networks.com wrote:
> The normal one is NOT FREE. Very few ISP provides free NNTP, and it has many
> restrictions. Juno, Netscape, NetZero, People's PC don't have NNTP.
Every ISP I've ever used has had at least one NNTP server.
Most ISP servers have *less* restrictions than Google. (e.g. Google
doesn't carry any binary groups.)
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
------------------------------
Date: Fri, 20 Aug 2004 00:29:57 -0400
From: Eric Amick <eric-amick@comcast.net>
Subject: Re: Can I modify scalars contained in the array ref returned by DBI
Message-Id: <ofvai09oeoohog2768ftcqjuqnsp3i47r4@4ax.com>
On 19 Aug 2004 13:42:27 -0700, anodide@hotmail.com (Aaron Anodide)
wrote:
>sub CleanXMLString
>{
> my $s_ref = shift;
> $$s_ref =~ s/\&/\&\;/g;
> $$s_ref =~ s/\</\<\;/g;
> $$s_ref =~ s/\>/\>\;/g;
>}
The backslashes really aren't necessary.
--
Eric Amick
Columbia, MD
------------------------------
Date: 20 Aug 2004 04:34:15 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Can I modify scalars contained in the array ref returned by DBI
Message-Id: <Xns954AEF91080A8castleamber@130.133.1.4>
Eric Amick <eric-amick@comcast.net> wrote in
news:ofvai09oeoohog2768ftcqjuqnsp3i47r4@4ax.com:
> On 19 Aug 2004 13:42:27 -0700, anodide@hotmail.com (Aaron Anodide)
> wrote:
>
>>sub CleanXMLString
>>{
>> my $s_ref = shift;
>> $$s_ref =~ s/\&/\&\;/g;
>> $$s_ref =~ s/\</\<\;/g;
>> $$s_ref =~ s/\>/\>\;/g;
>>}
>
> The backslashes really aren't necessary.
Also the > doesn't need to be escaped in many cases.
<something> a > b </something> is valid.
--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
Date: Fri, 20 Aug 2004 01:57:24 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Database vs Text for text search
Message-Id: <ArKdnWnrz5ZYD7jcRVn-jQ@adelphia.com>
http://links.i6networks.com wrote:
> At what level a database will be better for a read only text search?
Whenever profiling your app shows that searching the text has become a
bottleneck, and when profiling shows that replacing the offending code
with a database-backed alternative removes that bottleneck.
Why guess when you can measure?
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Fri, 20 Aug 2004 06:02:31 GMT
From: "http://links.i6networks.com" <SaveWorldFromAids@alexa.com>
Subject: Re: Database vs Text for text search
Message-Id: <XtgVc.1144$Yzm.1093@news04.bloor.is.net.cable.rogers.com>
> > At what level a database will be better for a read only text search?
> >
> > I have some records, each has 6 fields. Each record has a pararent
record.
> >
> > Each parent has less than 100 childs.
> >
> > Total records is about 1000-1500.
> >
> > I want to put everthing in one single file, or put each parent and their
> > children in a file so I can have 20-30 files.
> >
> > I am afraid to go to the database route, because the limitation of
concurent
> > connections and the overhead of database search.
> >
> > Is there a cut-off number of records, below that line, text is better,
above
> > it, database is better?
>
> Well, you don't provide nearly enough information to make such a
> decision. Is this a CGI app? Batch lookup? Something else? What
> response time is required? You mention concurrent connections. How
> many? You also mention the "overhead" of a "database search". That
> would be a lot less than the overhead of a brute-force search of a
> flat-file text file (assuming a decent database). The overhead of
> establishing a database connection, however, may well exceed that of a
> brute force text file search. Your file seems quite small -- will it
> ever be bigger, or is that it? How complicated are the lookups?
>
> Assuming your app is CGI with less than a large number of hits, it seems
> like the brute force text file search would be reasonable, given the
> indicated size of the file. Since it is read-only, you don't have to
> worry about file locking, or adding/deleting/changing data, all of which
> dramatically simplifies things.
each record has those fields:
description
product id
current price
old price
i only need to "grep case insentively keys in the description" either OR or
AND operations between searched keys.
It is a CGI/Perl
I have trouble to build the data structure, as I don't know how to store
them in a text file. I am think doing =~ m//i search in perl, but also
consider to run a system call of grep, which seems easier and simpler.
------------------------------
Date: Fri, 20 Aug 2004 06:51:39 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: Help: joining 5 LARGE text files
Message-Id: <%bhVc.50437$TI1.30176@attbi_s52>
Stuart wrote:
> I have some code in PHP but it bombs out at 2gb (seems there is a limit
> and php needs re compiling, something thats not an option for me)
Unless you can use system(), you're screwed.
The application doing I/O *must* be compiled with LARGEFILES enabled.
Perl does not have this limitation when compiled with uselargefiles=define,
which is the usual case for Linux, FreeBSD, Solaris and Cygwin.
-Joe
------------------------------
Date: 20 Aug 2004 06:27:36 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: How Should I Check for Directory existance in a server
Message-Id: <Xns954B1905EF587asu1cornelledu@132.236.56.8>
Bill <wherrera@lynxview.com> wrote in
news:-c2dneK8c978wLjcRVn-tQ@adelphia.com:
> sunilkumar_1480@yahoo.com wrote:
>> I have to create a directory in a FTP server but before I create i
>> should check for the existance of the directory. If the directory
>> does exist then I should not create the directory.
I am no expert, but that smells of a race condition to me. The directory
may be created by another process between your check and attempt to
create it. Why not just try to create it? If creation fails, assume the
directory exists and try changing to that directory. If that fails,
abort.
>> The following is the code which I have written and I am
>> unsuccessful with reading a directory in a server
>>
use strict;
use warnings;
>> my $dir_name = $ARGV[0];
Check if the directory name is acceptable.
>> my $basepath = "c:\\Inetpub\\wwwroot\\$dir_name\\test";
>> my $count = 0;
>> my $server="casr.com";
>> my $user="slb";
>> my $password="bigfiles";
>> my $dir="iDistrict/incoming/baselines/TestReports/";
>> my $success="true";
>> my $filetran="true";
>> my $reason;
>> my $test="true";
>> my @file_list;
>> my $ret;
Don't declare all variables at the top of you script like this. Use a
hash for configuration variables:
my %config = (
server => 'casr.com',
user => 'slb',
pass => 'bigfiles',
dir => 'iDistrict/incoming/baselines/TestReports/',
);
>> my $ftp=Net::FTP->new($server) or $success="false";
Why do you keep on going if the constructor failed? Did you read the
documentation for Net::FTP?
$ftp = Net::FTP->new($config{server})
or die "Cannot connect to $config{server}: $@";
>> $ftp->login($user, $password) or $success="false";
Why do you keep on going if you cannot login? Did you read the
documentation for Net::FTP?
$ftp->login($config{user}, $config{pass})
or die "Cannot login ", $ftp->message;
>> $ftp->pasv() or $success="false";
See above.
>> $ftp->binary() or $success="false";
See above.
>> $ftp->cwd($dir) or $success='false';
See above.
>> print $ftp->cwd($dir);
Why do you repeat the ftp->cwd?
>> # I am unable to open the directory that exists in the server which I
>> have mentioned with $dir name.
>> opendir(SRC, $dir);
>> my @dir_files = readdir(SRC);
>> foreach my $file (@dir_files)
>> {
>> if($file eq $dir_name)
>> {
>> $ret = 0;
>> closedir(SRC);
>> last;
>> }
>> }
WTF?
>> if($ret ne 0)
>> {
>> $ftp->mkdir($folder_name) or $success='false';
>> }
>> $ftp->cwd($dir."/".$folder_name) or $success='false';
Huh?
>> Can anybody help me how to read the contents of a directory in the
>> server.
>
> I think you perhaps are confusing local directories woth the Net::FTP
> directories.
I think Bill is right.
> Read the docs on Net::FTP
Ditto.
--
A. Sinan Unur
1usa@llenroc.ude.invalid
(remove '.invalid' and reverse each component for email address)
------------------------------
Date: Fri, 20 Aug 2004 06:25:27 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: How to upload a file from a local pc to a web server from a html page????
Message-Id: <rPgVc.289630$%_6.59237@attbi_s01>
srini wrote:
> open UPLOADFILE, ">$temp";
> while (<$upload_filehandle>)
> {
> print UPLOADFILE;
> }
> close UPLOADFILE;
1) You should *always* check the results of an open() call.
2) Magic with $_ happens for <>, not for any other read operation,
which means that you have to explictly set $_.
use CGI::Carp qw(:fatalsToBrowser);
open UPLOADFILE, '>', $temp or die "Cannot create file $temp: $!\n";
binmode $upload_filehandle;
binmode UPLOADFILE;
while(defined($_ = <$upload_filehandle>)) {
print UPLOADFILE or warn "Possible disk full error: $!\n";
}
close UPLOADFILE or warn "Possible truncation on $temp: $!\n";
-Joe
------------------------------
Date: Fri, 20 Aug 2004 13:01:20 +0800
From: Alont <end@dream.life>
Subject: Re: perl interpreter automatically exit windows so how I can saw the result of script?
Message-Id: <41308570.171258640@130.133.1.4>
I'm sorry, really sorry, I'll never do that again :-)
at Thu, 19 Aug 2004 13:10:24 -0400
Paul Lalli <mritty@gmail.com>×íõ¸õ¸µÄÄØà«µÀ:--
>Maybe, just maybe, you should wait a few minutes before asking the same
>question again. Usenet is not instantaneous. This question has been
>answered, with a couple different answers, in the original thread.
Your fault as a Government is My failure as a citizen
------------------------------
Date: Fri, 20 Aug 2004 13:02:26 +0800
From: Alont <end@dream.life>
Subject: Re: perl interpreter automatically exit windows so how I can saw the result of script?
Message-Id: <413185b7.171329484@130.133.1.4>
good idea, thank you :-)
at Thu, 19 Aug 2004 13:32:59 -0400
Shawn Corey <shawn.corey@sympatico.ca>×íõ¸õ¸µÄÄØà«µÀ:--
>Try adding this to your script:
>
>END{<STDIN>}
>
>This way the results don't disappear until you press ENTER.
>
Your fault as a Government is My failure as a citizen
------------------------------
Date: Fri, 20 Aug 2004 13:18:06 +0800
From: Alont <end@dream.life>
Subject: Re: perl interpreter automatically exit windows so how I can saw the result of script?
Message-Id: <413287d9.171875906@130.133.1.4>
in fact, before forward friend tell me how to stay on command line
through a perl sentence, I know "Run your Perl scripts from the
command line instead of double clicking on them", but I'm a lazy man,
I want "double clicking" If I don't have to stroking in the command
line again and again....
to use Windows or other tools have different way, I just want find a
way suit me.
at 19 Aug 2004 19:21:41 GMT
"A. Sinan Unur" <1usa@llenroc.ude.invalid>×íõ¸õ¸µÄÄØà«µÀ:--
>Learn how to use Windows XP, why don't you?
>
>Download the "Command Prompt Here" powertoy from Microsoft (google for it).
>Then, you can open a cmd shell window anywhere you want in explorer. Run
>you Perl scripts from the command line instead of double clicking on them
>unless the scripts are designed to interact with you using a GUI. This goes
>for all programs, not just for Perl scripts.
Your fault as a Government is My failure as a citizen
------------------------------
Date: 20 Aug 2004 06:08:18 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: perl interpreter automatically exit windows so how I can saw the result of script?
Message-Id: <Xns954B15C065F68asu1cornelledu@132.236.56.8>
Sherm Pendley <spamtrap@dot-app.org> wrote in
news:ArKdnW7rz5b5DLjcRVn-jQ@adelphia.com:
> Alont wrote:
>
>> I want "double clicking" If I don't have to stroking in the command
>> line again and again....
>
> A long time ago, in a galaxy far, far away, Windows command.com had a
> "history" feature. Pressing F3 would bring up the previous command so
> you could repeat it without having to re-type it.
>
> I don't know if it still works though. Windows and I parted company
> some years ago.
Actually, that still exists. However, cmd.exe has a reasonable history
buffer (like doskey, but you don't actually have to load it) and also has
directory and file name completion. Microsoft's "Command Prompt Here"
utility adds the ability to right click on any directory in explorer and
open a cmd.exe shell in that directory (helps those who have not moved
their home directory from the default
c:\Documents and Settings\user id\My Documents
to a more reasonable place such as C:\Home\user (Microsoft's TweakUI
utility makes it easy to change the location of such 'special'
directories).
--
A. Sinan Unur
1usa@llenroc.ude.invalid
(remove '.invalid' and reverse each component for email address)
------------------------------
Date: 20 Aug 2004 06:10:40 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: perl interpreter automatically exit windows so how I can saw the result of script?
Message-Id: <Xns954B16278A6A7asu1cornelledu@132.236.56.8>
[ Please stop top-posting ]
Alont <end@dream.life> wrote in news:413287d9.171875906@130.133.1.4:
at 19 Aug 2004 19:21:41 GMT
> in fact, before forward friend tell me how to stay on command line
> through a perl sentence, I know "Run your Perl scripts from the
> command line instead of double clicking on them", but I'm a lazy man,
> I want "double clicking" If I don't have to stroking in the command
> line again and again.... to use Windows or other tools have different
> way, I just want find a way suit me.
Well, changing all your scripts to pause at completion is far more work
than using the command line.
--
A. Sinan Unur
1usa@llenroc.ude.invalid
(remove '.invalid' and reverse each component for email address)
------------------------------
Date: Thu, 19 Aug 2004 23:50:22 -0600
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: perl interpreter automatically exit windows so how I can saw the result of script?
Message-Id: <10ib48rch2b0572@corp.supernews.com>
Alont wrote:
> in fact, before forward friend tell me how to stay on command line
> through a perl sentence, I know "Run your Perl scripts from the
> command line instead of double clicking on them", but I'm a lazy man,
> I want "double clicking" If I don't have to stroking in the command
> line again and again....
Is doskey still supported in WinXP? If is is, that will save you all the
keystroking that you are to lazy to do.
------------------------------
Date: Fri, 20 Aug 2004 01:51:32 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: perl interpreter automatically exit windows so how I can saw the result of script?
Message-Id: <ArKdnW7rz5b5DLjcRVn-jQ@adelphia.com>
Alont wrote:
> I want "double clicking" If I don't have to stroking in the command
> line again and again....
A long time ago, in a galaxy far, far away, Windows command.com had a
"history" feature. Pressing F3 would bring up the previous command so
you could repeat it without having to re-type it.
I don't know if it still works though. Windows and I parted company some
years ago.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Fri, 20 Aug 2004 05:00:34 +0000 (UTC)
From: dkcombs@panix.com (David Combs)
Subject: Re: split inconsistency- why?
Message-Id: <cg40hi$9cm$1@reader1.panix.com>
In article <cfdscj$j96$1@agate.berkeley.edu>,
Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote:
SNIP
>
>No. As I said, at some moment I updated the docs so that they
>reflected my "current" understanding of the behaviour of split().
>Unfortunately, even afer reading/cleaninig the source code, I could
>not recognize all the quirks (boundary conditions!); so the
>documentation is not fully "relevant".
>
>Hope this helps,
>Ilya
(1) Where is this Ilya-mostly-fixed documentation? (ie, which
version of perl?)
(2) Did you document, for yourself for maybe later use,
warning-examples of where it hit those boundary-conditions?
Even if you didn't have the time or energy to pursue
maybe fruitless task of (a) finding (not so simple) and
(b) fixing these remaining problem-areas,
it'd probably be useful to see what you did find --
just to know what *not* to approach in split-use.
(3) If this split is *that* weird and unpredictable,
how much work would it be for someone (good like you)
to implement a splitSmall with perhaps fewer features,
but at least do those things robustly, "as advertised"?
(I mean, Perl-5 will probably continue being used
in a major way (for even new projects) long past
when perl-6 starts getting used for serious work,
so it might be well worth it for someone *to*
do something like a splitSmall.)
(4) I haven't looked at perl-6 yet -- but what does *it*
provide for its own split-like capabilities?
Thanks!
David
------------------------------
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 6887
***************************************