Michael Schilli > Gaim-Log-Parser-0.14 > Gaim::Log::Finder



Annotate this POD


Open  1
View/Report Bugs
Module Version: 0.02   Source  


Gaim::Log::Finder - Find Gaim's Log Files


    use Gaim::Log::Finder;

    my $finder = Gaim::Log::Finder->new(
        callback => sub { print "Found $_[1]\n"; }



Gaim::Log::Finder traverses through all known Gaim log file hierarchies and calls back to the previously defined callback function every time it finds a Gaim log file.


my $finder = Gaim::Log::Finder-new(callback => $coderef)>

The callback function that gets passed in as a code reference will be called later for every log file found (see below).

The finder will start in the .gaim/logs directory under the current user's home directory. If it finds .purple/logs, which is the log file location for gaim > 2.0 logs, it will use that instead. If, for some reason you want to start at a different location, pass it in as start_dir:

    my $finder = Gaim::Log::Finder->new(
        callback  => sub { print "Found $_[0]\n"; },
        start_dir => "/tmp",
my $finder = $parser->find()

Starts the finder, and will call the previously defined callback function every time it finds a Gaim log file. It will pass the following parameters to the callback function:

    sub gaim_log_callback {
        my($self, $logfile, $protocol, $local_user, 
           $remote_user, $file) = @_;
        # ...

$self is an object reference to the finder itself. $logfile is the full path to the logfile. $protocol is the IM transport mechanism/provider used, this could be yahoo, aim, jabber or similar. $local_user is the local user's userid. $local_user is the user's id who's at the other end of the conversation. $file is the name of the text file.


Copyright 2007 by Mike Schilli, all rights reserved. This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.


2007, Mike Schilli <cpan@perlmeister.com>

syntax highlighting: