Skip Menu |

This queue is for tickets about the Mac-FSEvents CPAN distribution.

Report information
The Basics
Id: 100940
Status: open
Priority: 0/
Queue: Mac-FSEvents

People
Owner: Nobody in particular
Requestors: preaction [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Support strings in addition to importing constants
I'd like to also allow using plain strings as constants instead of requiring the constants themselves. Being able to do: use Mac::FSEvents; my $fsev = Mac::FSEvents->new( path => 'foo', flags => [ "IGNORE_SELF", "FILE_EVENTS" ], ); might be nice. Alternatively, or additionally, I could also make it work like: use Mac::FSEvents; my $fsev = Mac::FSEvents->new( path => 'foo', no_defer => 1, ignore_self => 1, file_events => 1, watch_root => 1, );
On Tue Dec 16 01:41:45 2014, preaction wrote: Show quoted text
> I'd like to also allow using plain strings as constants instead of > requiring the constants themselves. Being able to do: > > use Mac::FSEvents; > my $fsev = Mac::FSEvents->new( > path => 'foo', > flags => [ "IGNORE_SELF", "FILE_EVENTS" ], > ); > > might be nice. > > Alternatively, or additionally, I could also make it work like: > > use Mac::FSEvents; > my $fsev = Mac::FSEvents->new( > path => 'foo', > no_defer => 1, > ignore_self => 1, > file_events => 1, > watch_root => 1, > );
I like the idea behind this, but I'm kind of torn on the two proposed forms. I'm leaning towards the former because it's obvious that the flags are related, but then again at this higher level maybe that's not an important distinction to retain.
On Tue Dec 16 16:07:00 2014, RHOELZ wrote: Show quoted text
> On Tue Dec 16 01:41:45 2014, preaction wrote:
> > I'd like to also allow using plain strings as constants instead of > > requiring the constants themselves. Being able to do: > > > > use Mac::FSEvents; > > my $fsev = Mac::FSEvents->new( > > path => 'foo', > > flags => [ "IGNORE_SELF", "FILE_EVENTS" ], > > ); > > > > might be nice. > > > > Alternatively, or additionally, I could also make it work like: > > > > use Mac::FSEvents; > > my $fsev = Mac::FSEvents->new( > > path => 'foo', > > no_defer => 1, > > ignore_self => 1, > > file_events => 1, > > watch_root => 1, > > );
> > I like the idea behind this, but I'm kind of torn on the two proposed > forms. I'm leaning towards the former because it's obvious that the > flags are related, but then again at this higher level maybe that's > not an important distinction to retain.
Something that may change your mind: The Mac::FSEvents::Event object has individual accessors for all the flags, done with the same translation to c_style_words as that second proposal. The flags in there are also described in better detail (one of the other tickets I mentioned). So, if anything, it'd be consistent with this other thing.
On Wed Dec 17 00:14:20 2014, preaction wrote: Show quoted text
> On Tue Dec 16 16:07:00 2014, RHOELZ wrote:
> > On Tue Dec 16 01:41:45 2014, preaction wrote:
> > > I'd like to also allow using plain strings as constants instead of > > > requiring the constants themselves. Being able to do: > > > > > > use Mac::FSEvents; > > > my $fsev = Mac::FSEvents->new( > > > path => 'foo', > > > flags => [ "IGNORE_SELF", "FILE_EVENTS" ], > > > ); > > > > > > might be nice. > > > > > > Alternatively, or additionally, I could also make it work like: > > > > > > use Mac::FSEvents; > > > my $fsev = Mac::FSEvents->new( > > > path => 'foo', > > > no_defer => 1, > > > ignore_self => 1, > > > file_events => 1, > > > watch_root => 1, > > > );
> > > > I like the idea behind this, but I'm kind of torn on the two proposed > > forms. I'm leaning towards the former because it's obvious that the > > flags are related, but then again at this higher level maybe that's > > not an important distinction to retain.
> > Something that may change your mind: The Mac::FSEvents::Event object > has individual accessors for all the flags, done with the same > translation to c_style_words as that second proposal. > > The flags in there are also described in better detail (one of the > other tickets I mentioned). > > So, if anything, it'd be consistent with this other thing.
Well, I definitely like consistency! I think that the latter form is better with that in mind.