Skip to content

Commit 6822251

Browse files
committed
File::stat: show examples of (not) overriding stat
That is, show how to access File::stat::stat without overriding anything and how to access CORE::stat despite overriding stat.
1 parent 97ffc62 commit 6822251

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

lib/File/stat.pm

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -288,11 +288,18 @@ variables named with a preceding C<st_> in front their method names.
288288
Thus, C<$stat_obj-E<gt>dev()> corresponds to $st_dev if you import
289289
the fields.
290290
291-
To access this functionality without the core overrides,
292-
pass the C<use> an empty import list, and then access
293-
function functions with their full qualified names.
294-
On the other hand, the built-ins are still available
295-
via the C<CORE::> pseudo-package.
291+
To access this functionality without the core overrides, pass the C<use>
292+
an empty import list, and then access functions with their full qualified
293+
names:
294+
295+
use File::stat ();
296+
my $st = File::stat::stat($file);
297+
298+
On the other hand, the built-ins are still available via the C<CORE::>
299+
pseudo-package even if you let File::stat override them:
300+
301+
use File::stat;
302+
my ($dev, $ino, $mode) = CORE::stat($file);
296303
297304
As of version 1.15 (provided with perl 5.44) C<stat> and C<lstat> can be
298305
called without arguments, in which case C<$_> is used (just like the

0 commit comments

Comments
 (0)