Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I have a file that looks like this:
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

In reply to Strange File Not Found Error by FouRPlaY

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-03-29 11:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found