Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

is File::Tail usable on Windows ?

by tos (Deacon)
on Nov 27, 2003 at 11:26 UTC ( #310508=perlquestion: print w/ replies, xml ) Need Help??
tos has asked for the wisdom of the Perl Monks concerning the following question:

Hi brethren,

for some reasons i've to observe an applications logfile on a win2000(SP3)-Server. I would like to do this using File::Tail. In the CPAN i read that tests failed just with MSWin32-x86-multi-thread. After downloading File::Tail from ActiveState i realized no Win32-IMPLEMENTATION-entry in th ppd-file. That's astonishing because up to now i've thought that ActiveState-Perl is especially for windows. Long speech, short sense.

  • Did anybody of you implement File::Tail on a windows-System with AS-Perl 5.6.1?
  • Beyond that i'would be interested in a comfortable way of installing ppm-packets without webaccess.

I would appreciate some hints.

greetings, tos

Comment on is File::Tail usable on Windows ?
Re: is File::Tail usable on Windows ?
by inman (Curate) on Nov 27, 2003 at 11:48 UTC
    ActiveState maintain a useful table of the modules that are available through PPD and their current build state for various platforms. The table can be found at http://ppm.activestate.com/BuildStatus/5.6-F.html. Unfortunately the build status for File::Tail on Windows is indeed 'FAIL'.

    As to the second question: The ActiveState built packages can also be downloaded as zip files from http://ppm.activestate.com/PPMPackages/zips/6xx-builds-only/. This allows you to maintain a local copy of the packages for distribution on disk, internal network etc. to computers which can't access the net.

    inman
Re: is File::Tail usable on Windows ?
by PodMaster (Abbot) on Nov 27, 2003 at 12:42 UTC
    In the CPAN i read that tests failed just with MSWin32-x86-multi-thread. After downloading File::Tail from ActiveState i realized no Win32-IMPLEMENTATION-entry in th ppd-file. That's
    That just seems a bit disconnected to me :) Why wouldn't you download the distribution from CPAN (maybe you need to read A Guide to Installing Modules)?

    Did anybody of you implement File::Tail on a windows-System with AS-Perl 5.6.1?
    Just because the test suite fails, doesn't mean the module won't work on a certain platform.

    Worst case scenario, the module doesn't work, but most likely it's just that the tests are flawed (as it actually turns out in this case).

    The fail report in question "is an error report generated automatically by CPANPLUS", meaning a person didn't actually examine the tests. A casual inspection reveals misguided equality tests (a test prints "0\n1\n2\n3\n4", then reads it back, no chomping is done(or binmode), then a string equiality test is used with "\n" -- not kosher). The tests in the File-Tail distribution need updating (looks as though the author has gone awol).

    recommendation: go ahead and install the module, and see if you run into trouble in using it (the part of the module that was being tested appears to work).

    Beyond that i'would be interested in a comfortable way of installing ppm-packets without webaccess
    I wouldn't call it comfortable, but sure, see my readme (in my signature), follow the links (and their links) and read :) update: bart tyepo s/reccommend/recommend/

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

      Well, under Win32, I just grab the source from CPAN, and save it under the appropriate name under the particular directory in the \perl\lib directory tree. I don't use the CPAN shell in other words. I for one got File::Tail to work but I decided to hack up my own script because it didn't suit my needs exactly. Update I guess the question would be, should I use the CPAN shell under Win32? I use it on Linux all the time. Am I missing something by manually installing modules like I've been doing?
        I guess the question would be, should I use the CPAN shell under Win32? I use it on Linux all the time.
        Nope, i'd recommend that you use CPANPLUS (It's already better than CPAN, and it's still improving).
        Am I missing something by manually installing modules like I've been doing?
        Yes, you're missing everything (that is not how you install modules).

        Because you don't know what you're missing is the number one reason you should stop doing that and start installing modules properly.

        Module authors (the perl authors) create distributions, write INSTALL instructions, write Makefile.PLs, write test suites ... do all this work for their benefit and yours, it's just good software development. Don't you want to benefit from their work, collective knowledge, years of experience?

        PS - regardless of how it sounds, I honestly hope you heed my advice (it's not really my advice per se, but it is good advice) :(

        update: bart tyepo s/reccommend/recommend/

        MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
        I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
        ** The third rule of perl club is a statement of fact: pod is sexy.

Re: is File::Tail usable on Windows ?
by JamesNC (Chaplain) on Nov 27, 2003 at 17:58 UTC
    Try using POE, the following code and other goodies are available at http://poe.perl.org in the POE_Cookbook directory under Watching_Logs.

    POE is arrow that is definitely worth the effor of learning IMHO. But this code should get you tail functionality on threaded AS :0)
    #!/usr/bin/perl -w # http://poe.perl.org/?POE_Cookbook/Watching_Logs use POE qw/Wheel::FollowTail/; use strict; $| = 1; my $filename = $ARGV[0]; die "Usage: $0 <filename>\n" unless $filename; die "$0: $filename: No such file or directory\n" unless -e $filename; die "$0: $filename: Permission denied\n" unless -r $filename; POE::Session->create ( inline_states => { _start => sub { $_[HEAP]->{wheel} = POE::Wheel::FollowTail->new( Filename => $_[ARG0], InputEvent => 'got_line', ErrorEvent => 'got_error', SeekBack => 1024, ); $_[HEAP]->{first} = 0; }, got_line => sub { print "$_[ARG0]\n" if $_[HEAP]->{first}++ }, got_error => sub { warn "$_[ARG0]\n" }, }, args => [$filename], ); $poe_kernel->run();
    Happy Thanksgiving!
    JamesNC
      Fantastic, This code works as a good replacement for tail. Meanwhile, can someone let me know how can i do the following - a) There is an exe that is already running and the debug messages are coming on the win32 console b) I need to capture this using the WIN32::GUI or WIN32::Console. c) is there an easy way of doing. d) one way is using tail for the file logging. Please let me know your comments on the following mail id - balvinder.p.singh@gmail.com BR Balvinder.

        It is far easier if you start capturing when you start the command, but see Re: Capturing the text in a Console Window for a simple script that will capture all the text currently in a console buffer.

        This will include any that has scolled off the top, (up to the limits of the console buffer size), but note that if more has already scrolled of than could be held, you'll loose data. And any that comes after you capture will not be available to you.

        You can try doing multiple captures, but then you'll have to try and stitch them together, discarding any that is duplicated in the second and subsequent captures.

        It would be far easier to start the command and redirect the output you want into to a file, perhaps via tee.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.
Re: is File::Tail usable on Windows ?
by runrig (Abbot) on Dec 01, 2003 at 19:53 UTC
    If nothing else here works, or as just another option, you can use Win32::ChangeNotify to watch for any changes in the directory, then check to see if the size of your log file has changed. Or use Win32::AdvNotify if you can find it.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://310508]
Front-paged by broquaint
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2014-11-23 15:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (132 votes), past polls