On Nov 7, 2010, at 11:15 PM, shawn wilson wrote:
> Ooh, I didn't know about inotify.
Yeah, this is much more appealing. Looks like Linux::Inotify2 is
better-supported than Linux::Inotify.
> It would seem that you can either use it
> within perl (just keep the script running like a service) or
Ooh, I didn't know about inotify. It would seem that you can either use it
within perl (just keep the script running like a service) or from a command
line. I think it really comes down to how often you're expecting new files.
And I don't know how the perl module works - its possible you might have
Perl's flock and then unlink (IIRC, in perl to delete it) and move to the
next one. That, or if you think you'll get too busy, check for a 'lock'
file, if it doesn't exist, create it, run, then delete your lock file.
On Nov 7, 2010 11:46 PM, "Chap Harrison" wrote:
>
> On Nov 7, 2010, at 6:47 PM, s
Hi.
On 8 November 2010 15:46, Chap Harrison wrote:
>
> On Nov 7, 2010, at 6:47 PM, shawn wilson wrote:
>
>> its Unix, I'd use cron as its probably already running. And do something
>> like: script.pl $(find -type f -print0) Every few seconds.
>
> That looks plenty straightforward enough, except
On Nov 7, 2010, at 6:47 PM, shawn wilson wrote:
> its Unix, I'd use cron as its probably already running. And do something
> like: script.pl $(find -type f -print0) Every few seconds.
That looks plenty straightforward enough, except how does one prevent a race
condition wherein cron launches
Cross thread posted at
http://forums.devshed.com/perl-programming-6/error-opening-csv-file-with-open-function-761095.html
J M wrote:
> I was able to figure it out. Here is the update (probably not final) code
> for anyone interested:
>
>
> [code]
> #! /usr/bin/perl
> #
> use DBI;
> use DBD::mysql;
I was able to figure it out. Here is the update (probably not final) code
for anyone interested:
[code]
#! /usr/bin/perl
#
use DBI;
use DBD::mysql;
use Text::CSV;
use strict;
#configure variables
my $host = "localhost";
my $db = "global_stats";
my $table = "station_information";
my $user = "globa
Ok now that John has helped me realize that I've been acting like a fool for
the past 3 hours, I'm getting this error:
DBD::mysql::st execute failed: MySQL server has gone away at [whatever line
number]
Thanks for your help, guys... currently I'm changing the script to use
placeholders and $dbh->
J M wrote:
-- Forwarded message --
From: J M
Date: Sun, Nov 7, 2010 at 8:27 PM
Subject: Re: error opening file with open function
To: shawn wilson
shawn,
I pretty sure it's not a permissions thing but here you go:
[code]
(jmd...@darkstar)-(0)-(07:23 PM Sun Nov 07)->
(~/global_
-- Forwarded message --
From: J M
Date: Sun, Nov 7, 2010 at 8:27 PM
Subject: Re: error opening file with open function
To: shawn wilson
shawn,
I pretty sure it's not a permissions thing but here you go:
[code]
(jmd...@darkstar)-(0)-(07:23 PM Sun Nov 07)->
(~/global_stats)-(5 f
Do an 'ls -l' and a 'whoami' and post the result. Also post the error your
program gives.
On Nov 7, 2010 9:19 PM, "J M" wrote:
> I did hardcode the name in the first version of the script... in two
forms:
> 'file.txt' and '/home/path/to/myfile/file.txt'. Neither made any
difference.
>
> Thank you
I did hardcode the name in the first version of the script... in two forms:
'file.txt' and '/home/path/to/myfile/file.txt'. Neither made any difference.
Thank you for assisting!
On Sun, Nov 7, 2010 at 8:12 PM, Parag Kalra wrote:
> Instead of taking the file as an input parameter, try to parse t
On Sun, Nov 7, 2010 at 8:13 PM, shawn wilson wrote:
> Use strict and warnings. Probably should also use parentheses:
> open(CSV, "< $file")
> On Nov 7, 2010 9:01 PM, "J M" wrote:
> > Hi all,
> >
> > I'm having great issues with my program at the moment... it is supposed
> to
> > take a csv file
Use strict and warnings. Probably should also use parentheses:
open(CSV, "< $file")
On Nov 7, 2010 9:01 PM, "J M" wrote:
> Hi all,
>
> I'm having great issues with my program at the moment... it is supposed to
> take a csv file and parse it, with the output being stored in a MySQL
> database. The
Instead of taking the file as an input parameter, try to parse the file by
hard coding its name in the script and let us know the outcome.
Cheers,
Parag
On Sun, Nov 7, 2010 at 6:00 PM, J M wrote:
> Hi all,
>
> I'm having great issues with my program at the moment... it is supposed to
> take a
Hi all,
I'm having great issues with my program at the moment... it is supposed to
take a csv file and parse it, with the output being stored in a MySQL
database. The problem I'm having is that the file I need to parse
('ish_history.csv') will not open in the program for some reason. I know the
fi
its Unix, I'd use cron as its probably already running. And do something
like: script.pl $(find -type f -print0) Every few seconds. Have the
script die if ARGV[0] is undefined. I don't remember what character
'-print0' puts between files -check the man pages and split on that. Loop
through the fil
Hi folks,
I'm in the thinking stages of creating a table-load utility, which reads a
tab-separated CSV file and inserts or updates rows in a relational table
(probably Oracle). I don't think that will be too hard, having used Perl
DBI/DBD modules in the past. What's different is that customer
18 matches
Mail list logo