File::Trash::FreeDesktop is a Perl module that lets you trash/erase/restore files, also list the contents of trash directories. This module follows the freedesktop.org trash specification , with some notes/caveats:
- For home trash, $HOME/.local/share/Trash is used instead of $HOME/.Trash
This is what KDE and GNOME use these days.
- Symlinks are currently not checked
The spec requires implementation to check whether trash directory is a symlink, and refuse to use it in that case. This module currently does not do said checking.
- Currently cross-device copying is not implemented/done
- Currently meant to be used by normal users, not administrators
This means, among others, this module only creates $topdir/.Trash-$uid instead of $topdir/.Trash. And there are less paranoid checks being done.
my $trash = File::Trash::FreeDesktop->new;