Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use Dist::Zilla::Role::FileWatcher #18

Merged

Conversation

karenetheridge
Copy link

This makes your code simpler, so you don't have to mess around with applying the role directly.

I think your pod_for_source_file code from https://github.com/DarwinAwardWinner/Dist-Zilla-Role-DistFileReader/blob/master/lib/Dist/Zilla/Role/PerlModuleReader.pm#L31 would be best added directly to Dist::Zilla::Role::PPI (where you can cache the PPI document, being even more efficient).


# If the new content is actually different, recalculate
# the content based on the updates.
if ($watched_file->content ne $self->_last_source_content)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this test actually necessary? Doesn't File::ChangeNotification already do this check?

https://github.com/karenetheridge/Dist-Zilla-Role-File-ChangeNotification/blob/master/lib/Dist/Zilla/Role/File/ChangeNotification.pm#L74

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not. It was there before so I left it in.

I think the point of this was to address a concern you'd raised initially - that if a munger changed the content, and then it was later changed back again to the first form, we wouldn't want to re-munge the file in that case as it is just a waste of resources. But there's no other harm that I can see in re-munging. Your call.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I think I previously assumed that File::ChangeNotification would trigger every time the file was written to, even if the contents hadn't changed. As far as I can tell, the test here is completely redundant with the same check in File::ChangeNotification (assuming there are no hash collisiions).

@karenetheridge
Copy link
Author

I force-pushed an improvement.

DarwinAwardWinner added a commit that referenced this pull request Sep 4, 2014
@DarwinAwardWinner DarwinAwardWinner merged commit 00fbfe0 into DarwinAwardWinner:master Sep 4, 2014
@karenetheridge karenetheridge deleted the topic/filewatcher branch September 6, 2014 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants