```{index} single: glob_error; File::Glob function ``` ```{index} single: File::Glob::glob_error; Perl function ``` # glob_error Report the error status of the most recent `bsd_glob` call. ## Synopsis ```perl my @files = bsd_glob('~nobody', GLOB_TILDE | GLOB_ERR); if (GLOB_ERROR) { warn "glob failed: $!"; } ``` ## What you get back An integer. Zero means the last `bsd_glob` call completed without error. A non-zero value signals that an error interrupted traversal: `GLOB_NOSPACE` for allocation failure, `GLOB_ABEND` for a stopped traversal. When non-zero, `$!` carries the underlying errno. ## Examples ```perl use File::Glob ':bsd_glob'; my @out = bsd_glob('/root/*', GLOB_ERR); # root-only dir print "error\n" if GLOB_ERROR; # usually prints under non-root ``` ## Edge cases - Reading `GLOB_ERROR` without a preceding `bsd_glob` call returns `0`. - Reading it after a successful call returns `0`. ## Differences from upstream - Always returns `0`. pperl does not thread per-call glob error state through the interpreter, so the value is a stub. Scripts that gate on `GLOB_ERROR` will always take the no-error branch. Use `$!` directly if you need to detect filesystem errors during globbing. Covered by `t/81-xs-native/File/Glob/*.t`. ## See also - `bsd_glob` — the call whose outcome this function reports. - `GLOB_ERR` — the flag that makes `bsd_glob` stop (rather than skip) on unreadable directories. - `GLOB_NOSPACE`, `GLOB_ABEND` — the two non-zero values this would return upstream.