| 1 | package SPVM::UV::Handle::FsEvent; | ||
| 2 | |||
| 3 | |||
| 4 | |||
| 5 | 1; | ||
| 6 | |||
| 7 | =encoding utf8 | ||
| 8 | |||
| 9 | =head1 Name | ||
| 10 | |||
| 11 | SPVM::UV::Handle::FsEvent - FsEvent Handle for libuv | ||
| 12 | |||
| 13 | =head1 Description | ||
| 14 | |||
| 15 | C<UV::Handle::FsEvent> in L<SPVM> represents the file system event handle for L<libuv|https://libuv.org/>, corresponding to the C<uv_fs_event_t> structure. | ||
| 16 | |||
| 17 | =head1 Super Class | ||
| 18 | |||
| 19 | L<UV::Handle|SPVM::UV::Handle> | ||
| 20 | |||
| 21 | =head1 Usage | ||
| 22 | |||
| 23 | use UV::Handle::FsEvent; | ||
| 24 | use UV::Constant; | ||
| 25 | |||
| 26 | my $fs_event = UV::Handle::FsEvent->new; | ||
| 27 | |||
| 28 | $fs_event->start(method : void ($fs_event_handle : UV::Handle::FsEvent, $filename : string, $events : int, $status : int) { | ||
| 29 | # Called when a file system event occurs | ||
| 30 | }, ".", UV::Constant->UV_FS_EVENT_RECURSIVE); | ||
| 31 | |||
| 32 | =head1 Fields | ||
| 33 | |||
| 34 | =head2 fs_event_cb | ||
| 35 | |||
| 36 | C<has fs_event_cb : rw L<UV::Callback::FsEvent|SPVM::UV::Callback::FsEvent>;> | ||
| 37 | |||
| 38 | The callback called when a file system event occurs. | ||
| 39 | |||
| 40 | =head1 Class Methods | ||
| 41 | |||
| 42 | =head2 new | ||
| 43 | |||
| 44 | C<static method new : L<UV::Handle::FsEvent|SPVM::UV::Handle::FsEvent> ();> | ||
| 45 | |||
| 46 | Creates a new L<UV::Handle::FsEvent|SPVM::UV::Handle::FsEvent> object, and returns it. | ||
| 47 | |||
| 48 | =head1 Instance Methods | ||
| 49 | |||
| 50 | =head2 start | ||
| 51 | |||
| 52 | C<method start : void ($cb : L<UV::Callback::FsEvent|SPVM::UV::Callback::FsEvent>, $path : string, $flags : int);> | ||
| 53 | |||
| 54 | Starts the file system event handle with the callback C<$cb>, the target path C<$path>, and options C<$flags>. | ||
| 55 | |||
| 56 | The callback C<$cb> is stored in L</"fs_event_cb"> field. | ||
| 57 | |||
| 58 | The callback C<$cb> is invoked when a file system event occurs on C<$path>. | ||
| 59 | |||
| 60 | This method calls the L<uv_fs_event_start|https://docs.libuv.org/en/v1.x/fs_event.html#c.uv_fs_event_start> function. | ||
| 61 | |||
| 62 | Exceptions: | ||
| 63 | |||
| 64 | If $cb is not defined, an exception is thrown. | ||
| 65 | |||
| 66 | If $path is not defined, an exception is thrown. | ||
| 67 | |||
| 68 | If uv_fs_event_start fails, an exception is thrown. | ||
| 69 | |||
| 70 | =head2 stop | ||
| 71 | |||
| 72 | C<method stop : void ();> | ||
| 73 | |||
| 74 | Stops the file system event handle. | ||
| 75 | |||
| 76 | This method calls the L<uv_fs_event_stop|https://docs.libuv.org/en/v1.x/fs_event.html#c.uv_fs_event_stop> function. | ||
| 77 | |||
| 78 | Exceptions: | ||
| 79 | |||
| 80 | If uv_fs_event_stop fails, an exception is thrown. | ||
| 81 | |||
| 82 | =head2 getpath | ||
| 83 | |||
| 84 | C<method getpath : string ();> | ||
| 85 | |||
| 86 | Gets the path being monitored. | ||
| 87 | |||
| 88 | This method calls the L<uv_fs_event_getpath|https://docs.libuv.org/en/v1.x/fs_event.html#c.uv_fs_event_getpath> function, and returns the path string. | ||
| 89 | |||
| 90 | Exceptions: | ||
| 91 | |||
| 92 | If uv_fs_event_getpath fails, an exception is thrown. | ||
| 93 | |||
| 94 | =head1 Details | ||
| 95 | |||
| 96 | |||
| 97 | |||
| 98 | =head1 Interfaces | ||
| 99 | |||
| 100 | |||
| 101 | |||
| 102 | =head1 Enumerations | ||
| 103 | |||
| 104 | |||
| 105 | |||
| 106 | =head1 Well Known Child Classes | ||
| 107 | |||
| 108 | |||
| 109 | |||
| 110 | =head1 See Also | ||
| 111 | |||
| 112 | L<UV::Handle|SPVM::UV::Handle>, L<UV::Callback::FsEvent|SPVM::UV::Callback::FsEvent>, L<UV::Constant|SPVM::UV::Constant> | ||
| 113 | |||
| 114 | =head1 Repository | ||
| 115 | |||
| 116 | |||
| 117 | |||
| 118 | =head1 Author | ||
| 119 | |||
| 120 | Yuki Kimoto C<kimoto.yuki@gmail.com> | ||
| 121 | |||
| 122 | =head1 Copyright & License | ||
| 123 | |||
| 124 | Copyright (c) 2026 Yuki Kimoto | ||
| 125 | |||
| 126 | MIT License |