Here's an example of what I mean by "reduce the problem to 5-25 lines of code". The portion of the code you're having trouble with could be reduced to the following test:

use strict; use warnings; use File::Tail; use POSIX (); my $filename = POSIX::strftime('ServerLog(%m-%d-%Y).log', localtime ); print "\$filename = <<<$filename>>>\n"; my $log = "D:\\ServerTools\\Logs\\$filename"; print "\$log = <<<$log>>>\n"; my $file = File::Tail->new($log); while( defined( my $line = $log->read ) ) { print "\$line = <<<$line>>>\n"; } unlink $log or die $!;

And then it would become quite clear to see that $log contains a file path. A file path is not a File::Tail object. Your File::Tail object is referred to by $file. Therefore, if you want to invoke the read method on your File::Tail object, you should be invoking it as:

while( defined( my $line = $file->read ) ) { ...

It's pretty obvious that the database stuff wasn't the problem you're asking about. So as you're trying to nail down what the issue is by creating some test code, you can immediately eliminate it. Eliminating that, and any other unrelated code-noise, you're left with just the problem, and it becomes easier to see. I hope this exercise is helpful to you.


Dave


In reply to Re^4: Help w/ regex in filename by davido
in thread Help w/ regex in filename by dcthehole

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.