Name

SPVM::Go::Fsnotify - File System Watcher

Description

The Go::Fsnotify class in SPVM has methods to watch file system changes, compatible with Go's fsnotify.

Usage

use Go::Fsnotify;

# Create a new watcher
my $watcher = Go::Fsnotify->new;

# Add a directory to watch
$watcher->add("/path/to/dir");

# Get events channel
my $events_ch = $watcher->events;

# Read events
my $event = (Go::Fsnotify::Event)$events_ch->read;

# Close the watcher
$watcher->close;

Class Methods

new

static method new : Go::Fsnotify ();

Creates a new Go::Fsnotify watcher instance.

Instance Methods

add

method add : void ($dir : string);

Adds a directory to watch for file system events.

Exceptions:

If this watcher is closed, an exception is thrown.

events

method events : Go::Channel ();

Gets the Go::Channel object for receiving file system events (Go::Fsnotify::Event).

close

method close : void ();

Closes the watcher, stops all active file system event handles, and closes the events channel.

Repository

Author

Yuki Kimoto kimoto.yuki@gmail.com

Copyright & License

Copyright (c) 2026 Yuki Kimoto

MIT License