diff options
Diffstat (limited to 'lib/Event/File.pm')
| -rw-r--r-- | lib/Event/File.pm | 92 |
1 files changed, 0 insertions, 92 deletions
diff --git a/lib/Event/File.pm b/lib/Event/File.pm deleted file mode 100644 index f5f7ad5..0000000 --- a/lib/Event/File.pm +++ /dev/null @@ -1,92 +0,0 @@ -#we need Event.pm -use Event; -use IO::File; -package Event::File; - -=head1 NAME - -Event::File is a wrapper module to write perl modules that deal with Files thru Event. -It tries to mimics Event.pm model. - -=cut - -use strict; -use vars qw($VERSION); -$VERSION = '0.1.1'; - -#we clone this from Event -sub _load_watcher { - my $sub = shift; - eval { require "Event/File/$sub.pm" }; - die if $@; - - croak ("Event/File/$sub.pm did not define Event::File::$sub::new") - unless defined &$sub; - 1; -} - -#we clone AUTOLOAD style from Event.pm -sub AUTOLOAD { - my $sub = ($Event::File::AUTOLOAD =~ /(\w+)$/)[0]; - _load_watcher($sub) or croak $@ . ', Undefined subroutine &' . $sub; - - goto &$sub; -} - - -#The register routine -#this will turn Event::File::foo into Event::File->foo() == Event::File::foo->new(); -sub register { - no strict 'refs'; - my $package = caller; - - my $name = $package; - $name =~ s/Event::File:://; - - my $sub = \&{"$package\::new"}; - - die "can't find $package\::new" - if !$sub; - *{"Event::File::".$name} = sub { - shift; - $sub->("Event::File::".$name, @_); - }; - - #no hooks - #&Event::add_hooks if @_; -} - - -1; -__END__ - -=head1 Supported Events - -Right now only Event::File->tail is supported. -For more information on it please refere to the Event::File::tail man page. - -=head1 External Modules - -This module makes use of - -=over - -=item * - -Event >= 0.80 - -=item * - -IO::File - -=back - -=head1 SEE ALSO - -Event(3), File::File::tail(3), cmc - -=head1 AUTHOR - -Raul Dias, <raul@dias.com.br> - -=cut |
