FouRPlaY has asked for the wisdom of the Perl Monks concerning the following question:
I have a file that looks like this:
Which is epoch time followed by user's logged into three different rooms, followed by the total. I use this code to read it in and display it in pretty html:
When I run it gives a file not found error from the die command. But, the file does exist. I've tried running it from a different user's web space with a copy of the file and it works fine. When I run it from the command line, it runs fine. When I run it from the command line and pipe the output to a file, that file contains all the right/vaild html and output.
Does anyone know why, when I try to access the file from it's own directory it would be unable to find a file that exists?
FouRPlaY
Learning Perl or Going To die() Trying
992535783 6 6 7 19 992536692 9 6 9 24 992537600 8 8 7 23 992538508 7 10 6 23 992539415 5 15 8 28 992540322 8 14 8 30 992541229 7 15 10 32 992542137 7 13 10 30 992542984 6 16 8 30 992543891 8 12 6 26
Which is epoch time followed by user's logged into three different rooms, followed by the total. I use this code to read it in and display it in pretty html:
#!/usr/bin/perl -w use strict; use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser); my @headings = ('Time','MC3004','MC3005','MC3027'); my @rows = th(\@headings); open LABS, "/software/polaris-mfcf/data/local/w.stat" or die "Unable t +o open file: $!\n"; for (<LABS>) { my ($time,$num4,$num5,$num7) = split; $time = localtime($time); my $check = substr(localtime(time),4,6); push @rows, td([$time,$num4,$num5,$num7]) if $time =~ /$check/ +; } close LABS; print header; print start_html('Polaris Usage'); print table({-border=>undef}, caption(strong('Polaris Terminal Usage')), Tr(\@rows) ); print end_html;
When I run it gives a file not found error from the die command. But, the file does exist. I've tried running it from a different user's web space with a copy of the file and it works fine. When I run it from the command line, it runs fine. When I run it from the command line and pipe the output to a file, that file contains all the right/vaild html and output.
Does anyone know why, when I try to access the file from it's own directory it would be unable to find a file that exists?
FouRPlaY
Learning Perl or Going To die() Trying
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Strange File Not Found Error
by Chmrr (Vicar) on Jun 14, 2001 at 23:04 UTC | |
by xphase_work (Pilgrim) on Jun 14, 2001 at 23:06 UTC | |
by Chmrr (Vicar) on Jun 14, 2001 at 23:08 UTC | |
by FouRPlaY (Monk) on Jun 14, 2001 at 23:15 UTC | |
Re: Strange File Not Found Error
by Zaxo (Archbishop) on Jun 15, 2001 at 03:41 UTC | |
Re: Strange File Not Found Error
by Anonymous Monk on Jun 14, 2001 at 23:15 UTC | |
by Anonymous Monk on Jun 14, 2001 at 23:18 UTC | |
by FouRPlaY (Monk) on Jun 14, 2001 at 23:22 UTC | |
by tye (Sage) on Jun 15, 2001 at 01:54 UTC | |
by FouRPlaY (Monk) on Jun 15, 2001 at 03:10 UTC | |
by Anonymous Monk on Jun 14, 2001 at 23:28 UTC | |
Re: Strange File Not Found Error
by mr.nick (Chaplain) on Jun 15, 2001 at 01:18 UTC | |
by nardo (Friar) on Jun 15, 2001 at 01:34 UTC | |
A reply falls below the community's threshold of quality. You may see it by logging in. |
Back to
Seekers of Perl Wisdom