Sys::De...lization(3)
β¨ NAME β¨
okay so bestie, welcome to Sys::Detect::Virtualization β it's the little Perl module that sniffs around and tells you if your UNIX box is secretly running as a virtual machine π
no cap, it literally just detects whether you're a guest under virtualization.
πΈ VERSION πΈ
Version 0.107 β she's giving vintage but she works π
π¦ SYNOPSIS π¦
the vibe check, in code form:
use Sys::Detect::Virtualization;
my $detector = eval { Sys::Detect::Virtualization->new() };
if( $@ ) {
print "Detector may not be supported for your platform. Error was: $@\n";
}
my @found = $detector->detect();
if( @found ) {
print "Possible virtualized system. May be running under:\n";
print "\t$_\n" for @found;
}
π DESCRIPTION π
This module is out here trying to figure out whether your system is running as a guest under virtualization, and it does it with a bunch of heuristics π (fancy word for "educated guessing, bestie"). It's not one perfect test β it's a whole squad of little checks vibing together.
π METHODS π
π Class Methods
new ( $args )β builds you a fresh detector object. Slays on success and hands you the object back. Fails? It dies. π
heads up: this constructor will fail if the system isn't running a supported OS. Currently, only Linux is supported. sorry to the BSD girlies π
$args is an optional hash reference with extra stuff for the constructor. Right now the supported keys are:
verboseβ set to1if you want verbose debugging output,0if you don't. Defaults to0.ignore_hostβ set to1if we should report no virtualization whenever a virtualization host (not a guest) is detected. Defaults to1.
π Instance Methods
detect ( )β runs the detection heuristics and returns a list of possible virtualization systems, or an empty list if it found nothing. Hits come back ordered from most likely to least likely. β¨
fr fr, not detecting anything does NOT mean the system isn't virtualized β it just means we couldn't detect it. absence of evidence, bestie, not evidence of absence π
guess ( )β runs the heuristics and returns a single answer based on the "best guess" available. Currently that's defined as the virt platform with the most heuristic hits. main character energy only, one winner π
π§ Internal Methods
You probably shouldn't ever need to call these β they're backstage, iykyk π
get_detectors ( )β returns a list of all detector subroutines for the given instance._find_bin ( $command )β returns the full path to the given command by searching$ENV{PATH}. If it's not in the path variable, the directories/usr/sbin,/usr/bin,/sbin, and/binget appended._fh_apply_patterns ( $fh, $patterns )β checks the data from$fhagainst the patterns in$patterns, line by line.
$patterns is a listref read pairwise. The first item of each pair is the pattern, and the second item of each pair is a list of names of virt solutions detected by the pattern.
_check_command_output ( $command, $patterns )β checks the output of$commandagainst the patterns in$patterns, line by line.
$patterns is a listref read pairwise. The first item of each pair is the pattern, and the second item of each pair is the name of the virt solution detected by the pattern.
_check_file_contents ( $fileglob, $patterns )β checks the content of each filename in$fileglobagainst the patterns in$patterns, line by line.
$fileglob is a glob that returns zero or more filenames.
$patterns is a listref read pairwise. The first item of each pair is the pattern, and the second item of each pair is the name of the virt solution detected by the pattern.
_check_path_exists ( $paths )β checks whether each path in$pathsexists.
$paths is a listref read pairwise. The first item of each pair is the path name, and the second item of each pair is the name of the virt solution detected by the existence of that $path.
π AUTHOR π
Dave O'Neill, <dmo@dmo.ca> β legend behavior, honestly π«Ά
π BUGS π
Known issues, bestie, let's be transparent:
- No support for non-Linux platforms. Feel free to contribute an appropriate
Sys::Detect::Virtualization::fooclass for your platform. (be the change you want to see β¨) - No weighting of tests so that high-confidence checks can be done first. Patches welcome. π
Please report any bugs or feature requests to bug-sys-detect-virtualization at rt.cpan.org, or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Sys-Detect-Virtualization>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. so you literally never get ghosted π
π SUPPORT π
You can find documentation for this module with the perldoc command.
perldoc Sys::Detect::Virtualization
You can also look for information at:
- RT: CPAN's request tracker
<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Sys-Detect-Virtualization>
- AnnoCPAN: Annotated CPAN documentation
<http://annocpan.org/dist/Sys-Detect-Virtualization>
- CPAN Ratings
<http://cpanratings.perl.org/d/Sys-Detect-Virtualization>
- Search CPAN
<http://search.cpan.org/dist/Sys-Detect-Virtualization/>
- The author's blog
π LICENSE AND COPYRIGHT π
Copyright (C) 2009 Roaring Penguin Software Inc.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See <http://dev.perl.org/licenses/> for more information.
okay that's the whole page, bestie, you ate it all up π this was perl v5.42.0, dated 2025-07-25, and she's filed under Sys::De...lization(3) β iconic, no notes, periodt π
β¨
π¦ where this page comes from
- fedora 43: perl-Sys-Detect-Virtualization 0.107-36.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms