[25778] in Perl-Users-Digest
Perl-Users Digest, Issue: 8017 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 26 14:10:21 2005
Date: Tue, 26 Apr 2005 11:10:14 -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 Tue, 26 Apr 2005 Volume: 10 Number: 8017
Today's topics:
Re: loading a lot of values into an mysql database and <mark.clementsREMOVETHIS@wanadoo.fr>
Re: loading a lot of values into an mysql database and <hackeras@gmail.com>
Re: loading a lot of values into an mysql database and <mark.clementsREMOVETHIS@wanadoo.fr>
Re: loading a lot of values into an mysql database and <hackeras@gmail.com>
Re: loading a lot of values into an mysql database and <mark.clementsREMOVETHIS@wanadoo.fr>
Re: loading a lot of values into an mysql database and <hackeras@gmail.com>
Re: loading a lot of values into an mysql database and <jgibson@mail.arc.nasa.gov>
Re: loading a lot of values into an mysql database and <hackeras@gmail.com>
Re: loading a lot of values into an mysql database and <hackeras@gmail.com>
Re: loading a lot of values into an mysql database and <glex_nospam@qwest.invalid>
Re: loading a lot of values into an mysql database and <hackeras@gmail.com>
Re: loading a lot of values into an mysql database and <emschwar@pobox.com>
Re: loading a lot of values into an mysql database and <hackeras@gmail.com>
Re: loading a lot of values into an mysql database and <hackeras@gmail.com>
Re: Speeding up glob? <jckstrw@gmail.com>
Re: Speeding up glob? <jckstrw@gmail.com>
Re: Speeding up glob? <jckstrw@gmail.com>
Re: using CGI::Carp <hackeras@gmail.com>
Re: using CGI::Carp <moritz.karbach@desy.de>
Re: using CGI::Carp <tadmc@augustmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 26 Apr 2005 15:51:33 +0200
From: Mark Clements <mark.clementsREMOVETHIS@wanadoo.fr>
Subject: Re: loading a lot of values into an mysql database and looping
Message-Id: <426e4769$0$25032$8fcfb975@news.wanadoo.fr>
Nikos wrote:
> Tad McClellan wrote:
>
> >while (@games) {
> > $st->execute( $_, $descriptions{$_}, 0 );
> >}
>
> for (@games) {
> $st->execute( $_, $descriptions{$_}, 0 );
> }
>
> but still for soem reason the database table games aint loading.
> data::dumper says its empty.
> But it should have been loading.
Trying to break this down one painful step at a time.....
Data::Dumper doesn't show you what is in the database table, it shows
you what is in perl data structures. If @games is empty before you start
the for block, then nothing is going to get inserted. Your population of
@games is probably wrong. Check your glob statement (if that is what you
are still using).
ie (am not convinced you are doing this properly so)
warn Dumper @games;
anything there?
Also, try using explicit variable names where you can to avoid confusion:
foreach my $game(@games) {
$st->execute( $game, $descriptions{$game}, 0 );
}
*but* check the return value of execute
foreach my $game(@games) {
unless( $st->execute( $game, $descriptions{$game}, 0 ) ){
warn $db->errstr;
}
}
What does %descriptions contain? What does
warn Dumper \%descriptions;
give you?
Mark
------------------------------
Date: Tue, 26 Apr 2005 17:19:31 +0300
From: Nikos <hackeras@gmail.com>
Subject: Re: loading a lot of values into an mysql database and looping
Message-Id: <d4lilj$k1u$1@nic.grnet.gr>
Mark Clements wrote:
> Nikos wrote:
>
>> Tad McClellan wrote:
>>
>> >while (@games) {
>> > $st->execute( $_, $descriptions{$_}, 0 );
>> >}
>>
>> for (@games) {
>> $st->execute( $_, $descriptions{$_}, 0 );
>> }
>>
>> but still for soem reason the database table games aint loading.
>> data::dumper says its empty.
>> But it should have been loading.
>
> Trying to break this down one painful step at a time.....
>
> Data::Dumper doesn't show you what is in the database table, it shows
> you what is in perl data structures. If @games is empty before you start
> the for block, then nothing is going to get inserted. Your population of
> @games is probably wrong. Check your glob statement (if that is what you
> are still using).
>
> ie (am not convinced you are doing this properly so)
>
> warn Dumper @games;
>
> anything there?
>
> Also, try using explicit variable names where you can to avoid confusion:
>
> foreach my $game(@games) {
> $st->execute( $game, $descriptions{$game}, 0 );
> }
>
> *but* check the return value of execute
>
> foreach my $game(@games) {
> unless( $st->execute( $game, $descriptions{$game}, 0 ) ){
> warn $db->errstr;
> }
> }
>
> What does %descriptions contain? What does
>
> warn Dumper \%descriptions;
>
> give you?
>
> Mark
Actually to make very very sure that the file is openign ok and the
values of the file is loading into an array i made the following code:
perigarfes.txt coantians the game name and the games descriptions
seperated by a tab character:
#===============================================================================
open (FILE, "<../data/games/perigrafes.txt") or die "Can't open FILE: $!\n";
while (<FILE>) {
chomp;
my @row = split /\t/;
push @row, 0;
print "NAME: $row[0]\n";
print "DESC: $row[1]\n";
print "COUNT: $row[2]\n\n";
}
close FILE;
#===============================================================================
Will you help me move on now that i ensured this?
------------------------------
Date: Tue, 26 Apr 2005 17:03:21 +0200
From: Mark Clements <mark.clementsREMOVETHIS@wanadoo.fr>
Subject: Re: loading a lot of values into an mysql database and looping
Message-Id: <426e583e$0$827$8fcfb975@news.wanadoo.fr>
Nikos wrote:
>
> Actually to make very very sure that the file is openign ok and the
> values of the file is loading into an array i made the following code:
>
> perigarfes.txt coantians the game name and the games descriptions
> seperated by a tab character:
>
> #===============================================================================
>
>
> open (FILE, "<../data/games/perigrafes.txt") or die "Can't open FILE:
> $!\n";
> while (<FILE>) {
> chomp;
> my @row = split /\t/;
> push @row, 0;
> print "NAME: $row[0]\n";
> print "DESC: $row[1]\n";
> print "COUNT: $row[2]\n\n";
> }
> close FILE;
great: so you have just populated @row with a load of 0s.
push @row, 0;
I'm pretty sure you don't want to do this. What is @row being used for
anyway? This is its first appearance.
But anyway, what happened to your glob populating @games? You seem to
have forgotten about it.
my @games = </data/games/*.rar> or die $!;
what is in @games?
I repeat (because you don't seem to be listening):
what is in @games?
Is the path "/data/games/*.rar" correct? What happens if you do
ls /data/games/*.rar
from the command-line?
> Will you help me move on now that i ensured this?
We can't possibly help you with every single line of your program,
especially if you *don't listen to advice*.
Data::Dumper is your friend, but you seem determined not to use it.
You are casting about blindly: you have no idea how to track down
problems and you're hoping that if you throw enough switches then
magically it will all work.
I hope you are now running with strict and warnings.
Nikos: you are asking us to do far too much work.
Mark
------------------------------
Date: Tue, 26 Apr 2005 18:22:30 +0300
From: Nikos <hackeras@gmail.com>
Subject: Re: loading a lot of values into an mysql database and looping
Message-Id: <d4lmbp$nta$1@nic.grnet.gr>
Mark Clements wrote:
$dbh->do( "create table games( onoma text, description text, counter int
)" ) or die $!;
#===============================================================================
my $sth = $dbh->prepare( "INSERT INTO games( name, description, count)
VALUES (?, ?, ?)" );
open (FILE, "<../data/games/perigrafes.txt") or die "Can't open FILE: $!\n";
while (<FILE>) {
chomp;
my @row = split /\t/;
push @row, 0;
next unless scalar @row == 3;
$sth->execute(@row);
}
close FILE;
#===============================================================================
Sorry before i forgot to paste the whole code for you to see why i use
@row which is to fill the games name nad description from the
perigarfex.txt file to the @row array and then in its turn to laod it in
the database but still although the whole make.pl file its correct still
the database table games its empty!!!!!
Iam gonna go nuts wit this thing. :(
------------------------------
Date: Tue, 26 Apr 2005 17:44:45 +0200
From: Mark Clements <mark.clementsREMOVETHIS@wanadoo.fr>
Subject: Re: loading a lot of values into an mysql database and looping
Message-Id: <426e61f2$0$1206$8fcfb975@news.wanadoo.fr>
Nikos wrote:
> Mark Clements wrote:
>
> $dbh->do( "create table games( onoma text, description text, counter int
> )" ) or die $!;
again: no, I didn't. If you are going to quote someone, please do it
properly.
> #===============================================================================
>
>
> my $sth = $dbh->prepare( "INSERT INTO games( name, description, count)
> VALUES (?, ?, ?)" );
>
> open (FILE, "<../data/games/perigrafes.txt") or die "Can't open FILE:
> $!\n";
> while (<FILE>) {
> chomp;
> my @row = split /\t/;
> push @row, 0;
> next unless scalar @row == 3;
> $sth->execute(@row);
> }
> close FILE;
>
> #===============================================================================
>
>
> Sorry before i forgot to paste the whole code for you to see why i use
> @row which is to fill the games name nad description from the
> perigarfex.txt file to the @row array and then in its turn to laod it in
> the database but still although the whole make.pl file its correct still
> the database table games its empty!!!!!
OK: I misread
> my @row = split /\t/;
> push @row, 0;
I don't see why you have 3 bind parameters when only two of them vary.
However: you are *still* not checking the return value of execute. You
are determined to make this as difficult for yourself (and for us) as
possible.
I've said you need to do this several times, but, as usual, you aren't
listening. I'm going to try one last time:
*check the return value of $sth->execute*
From my last posting (did you actually read it), something like:
unless( $st->execute( $game, $descriptions{$game}, 0 ) ){
warn $db->errstr;
}
Alternatively, set RaiseError on the db connection.
You aren't going to take *any* of this on board (see n previous
exchanges like this), so I'm going to give up at this point.
Mark
------------------------------
Date: Tue, 26 Apr 2005 18:57:19 +0300
From: Nikos <hackeras@gmail.com>
Subject: Re: loading a lot of values into an mysql database and looping
Message-Id: <d4lod4$pta$1@nic.grnet.gr>
Mark Clements wrote:
> You aren't going to take *any* of this on board (see n previous
> exchanges like this), so I'm going to give up at this point.
Please dont quit. i am trying:
here i write it with the use of warns:
$dbh->do( "create table games( onoma text, description text, counter int
)" ) or die $!;
#===============================================================================
my $sth = $dbh->prepare( "INSERT INTO games( name, description, count)
VALUES (?, ?, ?)" );
open (FILE, "<../data/games/perigrafes.txt") or die "Can't open FILE: $!\n";
while (<FILE>) {
chomp;
my @row = split /\t/;
my $num = scalar @row;
if ($num == 2) {
push @row, 0;
unless ( $sth->execute(@row) ) warn $dbh->errstr;
if ($dbh->errstr) {
warn "LINE $.: INSERT '$row[0]': $dbh->errstr\n";
}
} else {
warn "Error in line $.: number of fields $num\n";
}
close FILE;
#===============================================================================
Here it the output.
Now it wont even run!!!
Damn it what am i doing wrong?
<h1>Software error:</h1>
<pre>syntax error at
C:\DOCUME~1\beatnik\LOCALS~1\Temp\dirF40.tmp\make.pl line 3
8, near ") warn"
Missing right curly or square bracket at
C:\DOCUME~1\beatnik\LOCALS~1\Temp\dirF4
0.tmp\make.pl line 57, at end of line
syntax error at C:\DOCUME~1\beatnik\LOCALS~1\Temp\dirF40.tmp\make.pl
line 57, at
EOF
Execution of C:\DOCUME~1\beatnik\LOCALS~1\Temp\dirF40.tmp\make.pl
aborted due to
compilation errors.
</pre>
<p>
For help, please send mail to this site's webmaster, giving this error
message
and the time and date of the error.
</p>
[Tue Apr 26 18:56:39 2005] make.pl: syntax error at
C:\DOCUME~1\beatnik\LOCALS~1
\Temp\dirF40.tmp\make.pl line 38, near ") warn"
[Tue Apr 26 18:56:39 2005] make.pl: Missing right curly or square
bracket at C:\
DOCUME~1\beatnik\LOCALS~1\Temp\dirF40.tmp\make.pl line 57, at end of line
[Tue Apr 26 18:56:39 2005] make.pl: syntax error at
C:\DOCUME~1\beatnik\LOCALS~1
\Temp\dirF40.tmp\make.pl line 57, at EOF
[Tue Apr 26 18:56:39 2005] make.pl: Execution of
C:\DOCUME~1\beatnik\LOCALS~1\Te
mp\dirF40.tmp\make.pl aborted due to compilation errors.
------------------------------
Date: Tue, 26 Apr 2005 09:06:39 -0700
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: loading a lot of values into an mysql database and looping
Message-Id: <260420050906395168%jgibson@mail.arc.nasa.gov>
In article <d4jj2c$b6m$1@nic.grnet.gr>, Nikos <hackeras@gmail.com>
wrote:
> Jim Gibson wrote:
>
> > Put your game names and descriptions in a separate file, one game on
> > each line. Put the name first followed by a tab character followed by
> > the description, making sure that the description does not contain any
> > tabs. Read these descriptions into a hash with the following code
> > (untested):
> >
> > my %descriptions;
> > open( my $desc, '<', 'descriptions.txt' ) or
> > die("Can't open descriptions file: $!");
> > while(<$desc>) {
> > chomp;
> > my( $name, $description ) = split(/\t/);
> > $descriptions{$name} = $description;
> > }
>
> Thanks but i was wondering/thinking that there is no need actually to
> put except from the descriptions also the name of the games inside the
> description file since we can get all the games names from the game
> folder they are inside by doing this:
>
> my @games = </data/games/*.rar> or die $!;
>
> What do you think?
I think you need some way to associate the description of the game with
the name of the game. If all you have is a file full of descriptions,
how will you know which description goes with which game? If you have a
better idea than what I proposed, then use that instead.
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
------------------------------
Date: Tue, 26 Apr 2005 19:14:13 +0300
From: Nikos <hackeras@gmail.com>
Subject: Re: loading a lot of values into an mysql database and looping
Message-Id: <d4lpcj$r2n$1@nic.grnet.gr>
Jim Gibson wrote:
> I think you need some way to associate the description of the game with
> the name of the game. If all you have is a file full of descriptions,
> how will you know which description goes with which game? If you have a
> better idea than what I proposed, then use that instead.
No that was the former idea.
I now ahve inside perigrafes.txt both the name of the game and the
description seperated by a tab delimeter character.
------------------------------
Date: Tue, 26 Apr 2005 19:37:48 +0300
From: Nikos <hackeras@gmail.com>
Subject: Re: loading a lot of values into an mysql database and looping
Message-Id: <d4lqor$sia$1@nic.grnet.gr>
Guys do you see soemthing wrong in this?
#!/usr/bin/perl
use strict;
use warnings;
use CGI::Carp qw(fatalsToBrowser);
use CGI qw(:standard);
use DBI;
use DBD::mysql;
print header( -charset=>'iso-8859-7' );
print start_html( -style=>'../style.css', -title=>'Äçìéïõñãßá ÂÜóçò
ÄåäïìÝíùí!', -background=>'../data/images/night.gif' );
my $dbh = ($ENV{'SERVER_NAME'} ne 'nikolas.50free.net')
? DBI->connect('DBI:mysql:test', 'root', '')
: DBI->connect('DBI:mysql:test:50free.net', 'nikos_db', 'tiabhp2r')
or print font({-size=>5, -color=>'Lime'}, $DBI::errstr) and exit 0;
$dbh->do( "drop database if exists nikos_db" );
$dbh->do( "create database nikos_db" );
$dbh->do( "use nikos_db" );
$dbh->do( "create table logs( id int auto_increment primary key, host
text, xronos text, keimeno text, visits int, page int )" ) or die $!;
$dbh->do( "create table public( onoma text, euxoula text, sxolio text,
email text, xronos text, host text )" ) or die $!;
$dbh->do( "create table games( onoma text, description text, counter int
)" ) or die $!;
#===============================================================================
my $sth = $dbh->prepare( "INSERT INTO games( name, description, count)
VALUES (?, ?, ?)" );
open (FILE, "<../data/games/perigrafes.txt") or die "Can't open FILE: $!\n";
while (<FILE>) {
chomp;
my @row = split /\t/;
my $num = scalar @row;
if ($num == 2)
{
push @row, 0;
unless ( $sth->execute(@row) ) { warn $dbh->errstr; }
if ($dbh->errstr)
{
warn "LINE $.: INSERT '$row[0]': $dbh->errstr\n";
}
}
else
{
warn "Error in line $.: number of fields $num\n";
}
close FILE;
#===============================================================================
my @tables = @{ $dbh->selectcol_arrayref('show tables') };
for ( @tables ) {
$sth = $dbh->prepare( "select * from $_" );
$sth->execute();
print font( {-size=>5, -color=>'Cyan'}, $_ );
print font( {-size=>4, -color=>'Lime'}, ol( li( $sth->{NAME} ) ) );
}
This is all the source of make.pl
------------------------------
Date: Tue, 26 Apr 2005 11:54:02 -0500
From: "J. Gleixner" <glex_nospam@qwest.invalid>
Subject: Re: loading a lot of values into an mysql database and looping
Message-Id: <Lmube.225$0U.3783@news.uswest.net>
Nikos wrote:
> while (<FILE>) {
> close FILE;
> <h1>Software error:</h1>
> <pre>syntax error at
> C:\DOCUME~1\beatnik\LOCALS~1\Temp\dirF40.tmp\make.pl line 3
> 8, near ") warn"
> Missing right curly or square bracket at
You should be able to resolve syntax errors. It's telling you exactly
what's wrong.
Your "while" needs to have a closing "right curly", which is '}'.
------------------------------
Date: Tue, 26 Apr 2005 19:56:32 +0300
From: Nikos <hackeras@gmail.com>
Subject: Re: loading a lot of values into an mysql database and looping
Message-Id: <d4lrrv$4o$1@nic.grnet.gr>
J. Gleixner wrote:
> Nikos wrote:
>
>> while (<FILE>) {
>
>
>> close FILE;
>
>
>> <h1>Software error:</h1>
>> <pre>syntax error at
>> C:\DOCUME~1\beatnik\LOCALS~1\Temp\dirF40.tmp\make.pl line 3
>> 8, near ") warn"
>> Missing right curly or square bracket at
>
>
>
> You should be able to resolve syntax errors. It's telling you exactly
> what's wrong.
>
> Your "while" needs to have a closing "right curly", which is '}'.
Yes i was too tense and i didnt notice that. i noticed it just after i
post it before now seeing your post.
I was counting them and it looked fine.
But the problem is the table agmes aint loading.
------------------------------
Date: Tue, 26 Apr 2005 10:53:14 -0600
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: loading a lot of values into an mysql database and looping
Message-Id: <eto7jip4gzp.fsf@wilson.emschwar>
Nikos <hackeras@gmail.com> writes:
> Guys do you see soemthing wrong in this?
> $dbh->do( "create table games( onoma text, description text, counter
> int )" ) or die $!;
....
> my $sth = $dbh->prepare( "INSERT INTO games( name, description, count)
> VALUES (?, ?, ?)" );
Your columns are named differently when you create the table and when
you try to populate it (onoma, description, counter in the first case,
and name, description, count in the second). I suspect this might be
relevant.
-=Eric
--
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
-- Blair Houghton.
------------------------------
Date: Tue, 26 Apr 2005 20:13:50 +0300
From: Nikos <hackeras@gmail.com>
Subject: Re: loading a lot of values into an mysql database and looping
Message-Id: <d4lsse$vj$1@nic.grnet.gr>
Eric Schwartz wrote:
> Your columns are named differently when you create the table and when
> you try to populate it (onoma, description, counter in the first case,
> and name, description, count in the second). I suspect this might be
> relevant.
>
> -=Eric
Just shoot me Eric :-)
You are rigth i changes it back and now the table game shas
smethigncalled <MEMO> in it.
now the scripot is like this( i changes from the beginning all the
columns names to match in greek words)
in games.pl is:
while ( $st->fetchrow_hashref ) {
print table( {class=>'info'},
Tr(
td( submit( -name=>'game', -value=>$_->{onoma} )),
td( $_->{perigrafi} ),
td( $_->{metritis} )
)
)
}
and in make.pl is:
$dbh->do( "create table games( onoma text, perigrafi text, metritis int
)" ) or die $!;
#===============================================================================
my $sth = $dbh->prepare( "INSERT INTO games( onoma, perigrafi, metritis)
VALUES (?, ?, ?)" );
open (FILE, "<../data/games/perigrafes.txt") or die "Can't open FILE: $!\n";
while (<FILE>) {
chomp;
my @row = split /\t/;
my $num = scalar @row;
if ($num == 2)
{
push @row, 0;
unless ( $sth->execute(@row) ) { warn $dbh->errstr; }
if ($dbh->errstr)
{
warn "LINE $.: INSERT '$row[0]': $dbh->errstr\n";
}
}
else
{
warn "Error in line $.: number of fields $num\n";
}
}
close FILE;
#===============================================================================
Iam sorry about my carefullness but i was a bit dizzy trying so many
hours...
------------------------------
Date: Tue, 26 Apr 2005 20:32:56 +0300
From: Nikos <hackeras@gmail.com>
Subject: Re: loading a lot of values into an mysql database and looping
Message-Id: <d4lu08$25n$1@nic.grnet.gr>
As far as the maek.pl is concerned i cnahed it to:
#===============================================================================
my @row;
my $sth = $dbh->prepare( "INSERT INTO games( onoma, perigrafi, metritis)
VALUES (?, ?, ?)" );
open (FILE, "<../data/games/perigrafes.txt") or die $!;
while (<FILE>) {
chomp;
@row = split /\t/;
push @row, 0;
$sth->execute( @row );
}
close FILE;
#===============================================================================
and is fine now! ;-)
------------------------------
Date: Tue, 26 Apr 2005 10:48:12 -0400
From: Jim <jckstrw@gmail.com>
Subject: Re: Speeding up glob?
Message-Id: <MPG.1cd81eb5599094db9896b0@news.duke.edu>
In article <ITcbe.1259$zu.249@newssvr13.news.prodigy.com>,
notvalid@email.com says...
>
> Type this for more info on the diff between $files[0] and @files[0]:
>
> perldoc -q 'difference.*\$array'
>
> > while (<@files>) {
>
> This is doing much more work than you think it is. Change it to:
>
> foreach (@files) {
>
Changing my while to a foreach has sped up the program considerably.
Thanks to those for the help.
Jim
------------------------------
Date: Tue, 26 Apr 2005 10:49:22 -0400
From: Jim <jckstrw@gmail.com>
Subject: Re: Speeding up glob?
Message-Id: <MPG.1cd81efc97353f969896b1@news.duke.edu>
In article <F-2dnao3At7AYfDfRVn-hA@comcast.com>, joe@inwap.com says...
> Jim wrote:
>
> > I have a very simple perl program that runs _very_ slowly.
>
> You posted this question earlier and have already gotten and
> answer. Why are you not accepting the answers already given?
>
> > while (<@files>) {
>
> Big error right there. '<' and '>' are *not* appropriate here.
>
> > $st = stat($_);
> > $mod_time = $time - $st->mtime;
> > # 1440 minutes in a day
>
> Why are you doing that way? Have you not heard of -M()>
>
> if (-M $_ > 7 ) { print 'File $_ is older than 7.000 days\n"; }
>
> -Joe
>
I hadn't posted this question earlier. This is the first time I've
posted it. I hope. Unless I'm losing my mind. :)
The foreach speeds things up noticeably. I'm using that now.
No, I have not heard of -M(). Thanks for pointing it out to me.
Jim
------------------------------
Date: Tue, 26 Apr 2005 10:51:12 -0400
From: Jim <jckstrw@gmail.com>
Subject: Re: Speeding up glob?
Message-Id: <MPG.1cd81f70c28225859896b2@news.duke.edu>
In article <slrnd6qoql.ruu.tadmc@magna.augustmail.com>,
tadmc@augustmail.com says...
> You already have how many in a day, multiply by 90 to get how
> many are in 90 days.
>
>
> > # 7257600 seconds in 90 days
>
>
> Wrong answer...
I would argue that it's not the "wrong answer", just a different answer
than you would've used. Six of one, half dozen of the other it seems to
me.
>
> > if ($mod_time > 7257600) {
>
>
> if ($mod_time > 60 * 60 * 24 * 90) {
>
>
> Perl will constant-fold it for you.
>
>
> > There are several thousand files (~21K) in this directory
>
>
> Then the largest bottleneck is probably the OS and filesystem,
> not the programming language (though your algorithm seems
> sub-optimal too).
>
>
> > It takes a really
> > long time to run this program. What's the holdup?
>
>
> There are several thousand files (~21K) in that directory.
Using a foreach instead of my while (double globbing, I believe it was
referred to as) sped things up noticeably.
Thanks for your help.
Jim
------------------------------
Date: Tue, 26 Apr 2005 16:23:57 +0300
From: Nikos <hackeras@gmail.com>
Subject: Re: using CGI::Carp
Message-Id: <d4lfdb$fqm$1@nic.grnet.gr>
Gunnar Hjalmarsson wrote:
Thats how i use the Carp Moduel and it wokrs fine:
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
Try that.
------------------------------
Date: Tue, 26 Apr 2005 16:29:19 +0200
From: Moritz Karbach <moritz.karbach@desy.de>
Subject: Re: using CGI::Carp
Message-Id: <d4lj7u$2m6jl$2@claire.desy.de>
Gunnar Hjalmarsson wrote:
> Maybe you should try to upgrade CGI::Carp (provided that you don't have
> the latest version...) and see if that makes a difference.
Well ok then - I could use a little help with that.
1. I guess my server is a Red Hat distri.
2. How do I check the version of CGI::Carp?
3. How do I update it?
- Moritz
------------------------------
Date: Tue, 26 Apr 2005 11:04:30 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: using CGI::Carp
Message-Id: <slrnd6spke.232.tadmc@magna.augustmail.com>
Moritz Karbach <moritz.karbach@desy.de> wrote:
> Gunnar Hjalmarsson wrote:
>
>> Maybe you should try to upgrade CGI::Carp (provided that you don't have
>> the latest version...) and see if that makes a difference.
>
> Well ok then - I could use a little help with that.
>
> 1. I guess my server is a Red Hat distri.
That is irrelevant.
> 2. How do I check the version of CGI::Carp?
perl -MCGI::Carp -e 'print $CGI::Carp::VERSION'
> 3. How do I update it?
Please refrain from repeating Frequently Asked Questions.
perldoc -q module
What modules and extensions are available for Perl? What is CPAN?
What does CPAN/src/... mean?
How do I install a module from CPAN?
How do I keep my own module/library directory?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
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 8017
***************************************