SPUG: PERL technical interview

Yitzchak Scott-Thoennes sthoenna at efn.org
Tue Jan 24 12:09:23 PST 2006


On Mon, Jan 23, 2006 at 04:21:52PM -0800, Fred Morris wrote:
> Don't ask me to do this in an interview, but I couldn't resist.
> 
> #!/usr/bin/perl -w
> 
> use Inline C;
 ... 
> #include <stdlib.h>
> 
> void SHELL_SUCCESS() {
> 
>     Inline_Stack_Vars;
>     Inline_Stack_Reset;
> 
> #ifdef EXIT_SUCCESS
>     Inline_Stack_Push(sv_2mortal(newSViv(EXIT_SUCCESS)));
> #else
>     Inline_Stack_Push(sv_2mortal(newSV(0)));
> #endif

Just FYI,

$ perl -wl
use POSIX "/EXIT_*/";
print "EXIT_SUCCESS is @{[EXIT_SUCCESS]}, EXIT_FAILURE is @{[EXIT_FAILURE]}";
__END__
EXIT_SUCCESS is 0, EXIT_FAILURE is 1


More information about the spug-list mailing list