
Mac::NSGetExecutablePath - Perl interface to the _NSGetExecutablePath darwin (OS X) system call.

Version 0.02

sub get_perl_path {
if ($^O eq 'darwin') {
require Cwd;
require Mac::NSGetExecutablePath;
return Cwd::abs_path(Mac::NSGetExecutablePath::NSGetExecutablePath());
} else {
return $^X;
}
}

This module provides a Perl interface to the _NSGetExecutablePath darwin system call. It will only build on darwin systems.
Note that if you are using perl 5.16 or greater, then the value of $^X is already computed from the return value of _NSGetExecutablePath, making this module mostly irrelevant.

NSGetExecutablePathmy $path = NSGetExecutablePath();
Returns a string representing the path to the current executable. This path may rightfully point to a symlink.
This function may throw exceptions, see "DIAGNOSTICS" for details.

NSGetExecutablePath() wants to return a path too largeThis exception is thrown when _NSGetExecutablePath requires an outrageously large buffer to return the path to the current executable.

The function "NSGetExecutablePath" is only exported on request, either individually or by the tags ':funcs' and ':all'.

perl 5.6.
A C compiler. This module may happen to build with a C++ compiler as well, but don't rely on it, as no guarantee is made in this regard.
Exporter (core since perl 5), XSLoader (since 5.006), base (since 5.004_05).

dyld(3).

Vincent Pit, <perl at profvince.com>, http://www.profvince.com.
You can contact me by mail or on irc.perl.org (vincent).

Please report any bugs or feature requests to bug-mac-nsgetexecutablepath at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Mac-NSGetExecutablePath. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

You can find documentation for this module with the perldoc command.
perldoc Mac::NSGetExecutablePath

The implementation of this module is inspired by Nicholas Clark's work of adding this feature to perl 5.16.

Copyright 2012 Vincent Pit, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.