Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the AnyEvent-Filesys-Notify CPAN distribution.

Report information
The Basics
Id:
104714
Status:
resolved
Priority:
Low/Low

People
Owner:
Nobody in particular
Requestors:
dave [...] jetcafe.org
Cc:
AdminCc:

BugTracker
Severity:
(no value)
Broken in:
(no value)
Fixed in:
(no value)



Subject: BUILD method prevents subclassing
Date: Tue, 26 May 2015 11:49:10 -0700
To: bug-AnyEvent-Filesys-Notify@rt.cpan.org
From: Dave Hayes <dave@jetcafe.org>
This issue is found in AnyEvent::Filesys::Notify v1.18 (and earlier). For the record: this issue was detected on perl 5.18 and FreeBSD 10.1, however I suspect it's in all versions on all operating systems. Because of this line in your BUILD method: $self->_old_fs( _scan_fs( $self->dirs ) ); it is impossible to replace _scan_fs with a non recursive one without modifying this code directly. :) I suggest either: $self->_old_fs( $self->_scan_fs( $self->dirs ) ); or providing a switch whereby the object will not recurse into subdirectories; a common use case (at least for me) when using the kqueue backend. Thanks in advance. -- Dave Hayes - Consultant - Altadena CA, USA - dave@jetcafe.org
Show quoted text
>>>> *The opinions expressed above are entirely my own* <<<<
It is difficult to make things foolproof because fools are so ingenious.
Subject: Re: [rt.cpan.org #104714] AutoReply: BUILD method prevents subclassing
Date: Tue, 26 May 2015 11:57:01 -0700
To: bug-AnyEvent-Filesys-Notify@rt.cpan.org
From: Dave Hayes <dave@jetcafe.org>
Here's a quick UNTESTED patch for this issue, it's pretty simple: --- /usr/local/lib/perl5/site_perl/AnyEvent/Filesys/Notify.pm 2015-05-21 16:00:14.000000000 -0700 +++ Notify.pm 2015-05-26 11:54:12.959642308 -0700 @@ -30,7 +30,7 @@ sub BUILD { my $self = shift; - $self->_old_fs( _scan_fs( $self->dirs ) ); + $self->_old_fs( $self->_scan_fs( $self->dirs ) ); $self->_load_backend; return $self->_init; # initialize the backend @@ -77,6 +77,7 @@ # Keys are absolute path and values are path/mtime/size/is_dir # Takes either array or arrayref sub _scan_fs { + my $self = shift; my (@args) = @_; # Accept either an array of dirs or a array ref of dirs -- Dave Hayes - Consultant - Altadena CA, USA - dave@jetcafe.org
Show quoted text
>>>> *The opinions expressed above are entirely my own* <<<<
Objects are defined subjectively. Since objects are defined arbitrarily, this gives rise to your arbitrary subjectivity.
Thanks Dave. I've turned all the utility function in Notify.pm into methods. Releasing as 1.19. I also like the idea of a flag to avoid recursing. I'll add that to the todo/wish list, and think it through a bit more when time permits.


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.