NAME

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

VERSION

Version 0.03

SYNOPSIS

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

DESCRIPTION

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.

FUNCTIONS

NSGetExecutablePath

my $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.

DIAGNOSTICS

NSGetExecutablePath() wants to return a path too large

This exception is thrown when _NSGetExecutablePath requires an outrageously large buffer to return the path to the current executable.

EXPORT

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

DEPENDENCIES

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.6.0), base (since 5.004_05).

SEE ALSO

dyld(3).

AUTHOR

Vincent Pit, <perl at profvince.com>, http://www.profvince.com.

You can contact me by mail or on irc.perl.org (vincent).

BUGS

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.

SUPPORT

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

perldoc Mac::NSGetExecutablePath

ACKNOWLEDGEMENTS

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

COPYRIGHT & LICENSE

Copyright 2012,2013 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.