I would like to interface with linux directly from perl, to execute some calls such as statvfs. I am curious if there is a way of doing this with just the core perl package (no additional modules).
In particular, I’d like to get disk usage information for servers that don’t have df installed/enabled.
The technical, but probably not very useful, answer to your question is that yes, there does indeed exist a way of doing what statvfs does with just core perl and no modules. It works like this:
The problem is you’ll have to figure out the values for
$SYS_statfsand$STATFS_TEMPLATEyourself; the former is easy, and the latter is not hard.However, on some systems you’ll have to use the
statfs64variant of those.So yes, it is possible to do what you want, provided that you’re determined enough. There are better ways to do it, though.