Re: Command line vs. cron

2006-09-13 Thread James Marks
On Sep 13, 2006, at 3:50 PM, John W. Krahn wrote: James Marks wrote: If I've correctly interpreted your suggested changes, the script now reads: -- SCRIPT -- #!/usr/bin/perl use warnings; use strict; my $log_file = '/home/james/httpsd_mysqld.log';

Re: Command line vs. cron

2006-09-13 Thread James Marks
(snip) Here's the script: #!/usr/bin/perl use warnings; use strict; my $log_file = '/home/james/code/cron_code/httpsd_mysqld_log_file'; open FILE_OUT, ">> $log_file" or die "Cannot open log file: $!"; select FILE_OUT; (my $month, my $day, my $year, my $hour, my $minute, my $second) = (l

Re: Command line vs. cron

2006-09-13 Thread James Marks
On Sep 13, 2006, at 1:01 AM, Travis Thornhill wrote: I was just looking into the %ENV hash in my trusty Programming Perl book and found this interesting note on p. 661: "Note that processes running as crontab(5) entries inherit a particularly impoverished set of environment variables. (

Re: Command line vs. cron

2006-09-13 Thread James Marks
On Sep 13, 2006, at 12:29 AM, John W. Krahn wrote: #!/usr/bin/perl use warnings; use strict; my $log_file = '/home/james/code/cron_code/httpsd_mysqld_log_file'; open FILE_OUT, ">> $log_file" or die "Cannot open log file: $!"; select FILE_OUT; (my $month, my $day, my $year, my $hour, my

Re: Command line vs. cron

2006-09-12 Thread James Marks
On Sep 12, 2006, at 11:02 PM, Mumia W. wrote: On 09/12/2006 11:28 PM, James Marks wrote: Hi folks, I don't know if this is a Perl or UNIX problem and I'm hoping you can help me figure that out. I wrote a script that checks to see if the httpsd and mysqld processes are running on

Re: Command line vs. cron

2006-09-12 Thread James Marks
On Sep 12, 2006, at 10:28 PM, Owen Cook wrote: Here's the script: #!/usr/bin/perl use warnings; use strict; my $log_file = '/home/james/code/cron_code/httpsd_mysqld_log_file'; open FILE_OUT, ">> $log_file" or die "Cannot open log file: $!"; select FILE_OUT; (my $month, my $day, my $y

Re: Command line vs. cron

2006-09-12 Thread James Marks
On Sep 12, 2006, at 9:59 PM, Owen Cook wrote: Here's the script: #!/usr/bin/perl use warnings; use strict; my $log_file = '/home/james/code/cron_code/httpsd_mysqld_log_file'; open FILE_OUT, ">> $log_file" or die "Cannot open log file: $!"; select FILE_OUT; (my $month, my $day, my $ye

Command line vs. cron

2006-09-12 Thread James Marks
Hi folks, I don't know if this is a Perl or UNIX problem and I'm hoping you can help me figure that out. I wrote a script that checks to see if the httpsd and mysqld processes are running on my server and to log the results of those tests. When I run the script from the command line, the sc

Re: Can't count array in hash in array - correx

2006-08-09 Thread James Marks
On Aug 9, 2006, at 12:59 AM, Beginner wrote: Are you using this $subdirectory_count = $web_sites_directory_tree[$i]{subdirectory}; or this. my $subdirectory_count = @{$web_sites_directory_tree[$i]{subdirectory} }; print "SUB= $subdirectory_count\n"; Because the first outputs: SUB= array(

Re: Can't count array in hash in array - correx

2006-08-09 Thread James Marks
On Aug 9, 2006, at 12:33 AM, James Marks wrote: Down, near the bottom of this example code (marked), I'm trying to count the number of elements of an array which is the value of a key in a hash which is, itself, an element of an array. So far, I've been unsuccessful and I'

Re: Can't count array in hash in array

2006-08-09 Thread James Marks
On Aug 9, 2006, at 12:40 AM, Beginner wrote: On 9 Aug 2006 at 0:33, James Marks wrote: Ohh ohh. I think I know this (they'll flame me if I'm wrong). Is it? use strict; use warnings; my $no_dirs = @{ $web_sites_directory_tree[$i]{subdirectory} }; I tried that (includ

Can't count array in hash in array

2006-08-09 Thread James Marks
Down, near the bottom of this example code (marked), I'm trying to count the number of elements of an array which is the value of a key in a hash which is, itself, an element of an array. So far, I've been unsuccessful and I'm stumped as to what to try next. Help? my @web_sites_directory_tree

Re: pseudohash

2006-02-11 Thread James Marks
On Feb 11, 2006, at 12:16 PM, Owen wrote: James Marks wrote: On Feb 11, 2006, at 12:04 AM, Owen Cook wrote: Maybe have a read of perlref, try http://perldoc.perl.org/perlref.html To my amusement, when I followed your suggestion, I got: -- Perl 5.8.6 documentation -- Home > Sea

Re: pseudohash

2006-02-11 Thread James Marks
On Feb 11, 2006, at 12:04 AM, Owen Cook wrote: On Sat, 11 Feb 2006, Beast wrote: Could someone explain what is pseudohash means? Maybe have a read of perlref, try http://perldoc.perl.org/perlref.html Owen To my amusement, when I followed your suggestion, I got: -- Perl 5.8.6 document

Re: Text file too large for Perl?

2005-03-07 Thread James Marks
The problem is most likely in your algorithm. Show us the code. (Oops. Replied only to Charles by accident. Reposting to the list:) Sorry. I was posting a part of the real code only to avoid posting an overly long string of code. The problem, it seemed to me, was more likely some other limita

Re: Text file too large for Perl?

2005-03-06 Thread James marks
The problem is most likely in your algorithm. Show us the code. It turns out, after some testing, that if I break the 21.5 meg HTML file into two roughly equal pieces, the script runs with no problem and produces the results expected. So it appears, to my inexperienced eye, that the problem

Re: Text file too large for Perl?

2005-03-06 Thread James marks
The problem is most likely in your algorithm. Show us the code. (Oops. Replied only to Charles by accident. Reposting to the list:) Sorry. I was posting a part of the real code only to avoid posting an overly long string of code. The problem, it seemed to me, was more likely some other limita

Text file too large for Perl?

2005-03-06 Thread James marks
I hope someone can explain this and offer a solution for me, I've written a Perl script to parse an HTML file that was produced as a result of exporting database information from FileMaker Pro. The exported HTML file is 21.5 megs. I tested the script against a subset of the data in the HTML file

Re: traversing (and accessing values in) a hash of hashes

2004-12-12 Thread James marks
Lawrence (and all), I haven't gotten a chance to dig into the examples and work on the problem yet but I wanted to say thanks for the help. For example: Is using the IP address as the key really a good idea? Might an IP address be assigned to two different users -- or might a person use two diffe

Re: traversing (and accessing values in) a hash of hashes

2004-12-11 Thread James marks
Jonathan, That had occurred to me part way through writing the script. I'm learning Linux, Apache, MySQL and Perl/PHP all at the same time so sometimes I get halfway through a project in one area then learn something new in another area that causes me to have to back the first project and do a

Re: traversing (and accessing values in) a hash of hashes

2004-12-11 Thread James marks
In the script, there are two variables produced from a regexp match against the current line in the access_log: $new_ip $user_agent and one that is determined by a subroutine that looks for clues that the user_agent is a robot: $user_type This is the subroutine that builds the hash of hashes. I

traversing (and accessing values in) a hash of hashes

2004-12-11 Thread James marks
Hello folks, I'm wondering if any of you could help me with a code problem? I'm relatively new to Perl, coming to it from AppleScript, and I've written a Perl script that parses my server access_log and creates a hash of hashes that looks essentially like this: 192.168.1.1 =