Mac::SysProfile

Mac::SysProfile is a Perl extension for OS X system_profiler.
Download

Mac::SysProfile Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Daniel Muey
  • Publisher web site:
  • http://search.cpan.org/~dmuey/

Mac::SysProfile Tags


Mac::SysProfile Description

Mac::SysProfile is a Perl extension for OS X system_profiler. Mac::SysProfile is a Perl extension for OS X system_profiler.SYNOPSIS use Mac::SysProfile; my $pro = Mac::SysProfile->new(); print 'OS X Version ' . $pro->osx() . "n"; print 'Darwin Version ' . $pro->darwin() . "n";OO interface to your Mac's system_profilerMETHODS$pro->types()Returns an array ref of the datatypes available use for $pro->gettype()$pro->gettype()Returns a hashref of the given type's data. my $soft = $pro->gettype('SPSoftwareDataType');Once you call it for a type it returns the cached data on the next call unless the second argument is true. my $soft = $pro->gettype('SPSoftwareDataType',1);$pro->osx()Returns the system's OSX version. The first time it is called it finds it and stores it in the object for less overhead: if($pro->osx() eq '10.3.9') { # initially finds it print 'Do you want to upgrade from ' . $pro->osx() . "n"; # already processed so it returns the cached value (IE Fast) } print 'Your current version is: ' . $por->osx() . "n"; # already processed so it returns the cached value (IE Fast)You can make it reprocess and find it again fresh by giving it a true value: if($pro->osx() eq '10.3.9') { # initially finds it print 'Do you want to upgrade from ' . $pro->osx(1) . "n"; # finds it again from scratch instead of the cached value (IE slower) } print 'Your current version is: ' . $por->osx(1) . "n"; # finds it again from scratch instead of the cached value (IE slower)$pro->darwin()Same useage as $pro->osx() but returns the version of the system's Darwin.$pro->state_hashref()Returns a hashref of the entire object so far. Anything that has not been called it undef.$pro->xml()Returns an xml document of the type specified. An optional file handle or file to write the output to can be specified as the second argument. If you put it in a file that has a .spx extension then it will be an XML file which can be opened by System Profiler.app my $raw = $pro->xml('SPSoftwareDataType'); $pro->xml('SPSoftwareDataType','./software.spx') or die "Could not create xml file: $!"; $pro->xml('SPSoftwareDataType',*FH); Requirements: · Perl


Mac::SysProfile Related Software