1 package Mac::NSGetExecutablePath;
10 Mac::NSGetExecutablePath - Perl interface to the _NSGetExecutablePath darwin (OS X) system call.
26 if ($^O eq 'darwin') {
28 require Mac::NSGetExecutablePath;
29 return Cwd::abs_path(Mac::NSGetExecutablePath::NSGetExecutablePath());
37 This module provides a Perl interface to the C<_NSGetExecutablePath> darwin system call.
38 It will only build on darwin systems.
40 Note that if you are using L<perl> 5.16 or greater, then the value of C<$^X> is already computed from the return value of C<_NSGetExecutablePath>, making this module mostly irrelevant.
46 XSLoader::load(__PACKAGE__, $VERSION);
51 =head2 C<NSGetExecutablePath>
53 my $path = NSGetExecutablePath();
55 Returns a string representing the path to the current executable.
56 This path may rightfully point to a symlink.
58 This function may throw exceptions, see L</DIAGNOSTICS> for details.
62 =head2 C<NSGetExecutablePath() wants to return a path too large>
64 This exception is thrown when C<_NSGetExecutablePath> requires an outrageously large buffer to return the path to the current executable.
68 The function L</NSGetExecutablePath> is only exported on request, either individually or by the tags C<':funcs'> and C<':all'>.
72 use base qw<Exporter>;
76 'funcs' => [ qw<NSGetExecutablePath> ],
78 our @EXPORT_OK = map { @$_ } values %EXPORT_TAGS;
79 $EXPORT_TAGS{'all'} = [ @EXPORT_OK ];
86 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.
88 L<Exporter> (core since perl 5), L<XSLoader> (since 5.006), L<base> (since 5.004_05).
96 Vincent Pit, C<< <perl at profvince.com> >>, L<http://www.profvince.com>.
98 You can contact me by mail or on C<irc.perl.org> (vincent).
102 Please report any bugs or feature requests to C<bug-mac-nsgetexecutablepath at rt.cpan.org>, or through the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Mac-NSGetExecutablePath>.
103 I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
107 You can find documentation for this module with the perldoc command.
109 perldoc Mac::NSGetExecutablePath
111 =head1 ACKNOWLEDGEMENTS
113 The implementation of this module is inspired by Nicholas Clark's work of adding this feature to perl 5.16.
115 =head1 COPYRIGHT & LICENSE
117 Copyright 2012 Vincent Pit, all rights reserved.
119 This program is free software; you can redistribute it and/or modify it
120 under the same terms as Perl itself.
124 1; # End of Mac::NSGetExecutablePath