"Myers, Dirk" wrote:
> $mode = 0755 ;
> $file = "Foobar" ;
>
> #include <sys/types.h>
> #include <sys/stat.h>
>
> chmod($mode, $file) ;
>
> Which chmod gets called, perl or C? What are the rules for figuring this
> out?
>
> Dirk
Following the documentation at
http://www.perl.com/pub/doc/manual/html/pod/perlsub.html#Overriding_Builtin_Functions
on the way one can overload a perl builtin, functions (and bareword variables)
defined in the current package in C would hide their homonyms. So in your
example, the C chmod would be called, after $mode and $file are coerced into
a mode_t and a char*.
The hashbang would need to take switches just like cc does to indicate where
to find required system libraries, which would be remembered if possible, similar
to the way the Inline.pm
http://www.xray.mpe.mpg.de/mailing-lists/modules/2000-08/msg00078.html
module does it.
To use the perl function even after it has been hidden,
it can be referred to by its absolute name CORE::chmod.
--
David Nicol 816.235.1187 [EMAIL PROTECTED]
perl -e'@w=<>;for(;;){sleep print[rand@w]}' /usr/dict/words