in reply to Re: Need a Help - calling C program from Perl
in thread Need a Help - calling C program from Perl

If you read the documentation or try to run a test script. Use 'Inline C' is the only way to include this. You cannot call this with 'Inline::C' but 'Inline C'. Check the Inline C Documentation.
Here's a quote from the cpan author.
You never actually use Inline::C directly. It is just a support module + for using Inline.pm with C. So the usage is always: use Inline C => +...;
If you know of a way to get around this i would love to hear it.

edited:tone :)

Replies are listed 'Best First'.
Re: Re: Re: Need a Help - calling C program from Perl
by lestrrat (Deacon) on Oct 24, 2002 at 21:06 UTC

    Think of "use" as a function call, with specialized first argument, which is a bareword representing a name, then followed by arbitrary parameters:

    use Module ( $arg1, $arg2, ... );

    So now, think of this:

    use Inline C;

    The first argument ("Inline") is special, so that's ok, but what about the second argument, "C"? It's a bareword. That should raise the flag at which point you say, "Oh, I need to quote it!"

    use Inline 'C';

    Ah, but why did it work when it was

    use Inline C => ...;

    you say? The answer is simple. It's the same reason why the first example below works, but not the second one:

    use strict; foo( FOOBAR => 'baz' ); foo( FOOBAR, 'baz' );

    Yep, the "key" is automatically stringified upon encountering "=>". So when you look at the Inline example, you can clearly see that that's using this stringification trick.

    Just for the record, from perlop:

    The => digraph is mostly just a synonym for the comma operator. It's useful for documenting arguments that come in pairs. As of release 5.001, it also forces any word to the left of it to be interpreted as a string.

    P.S. - you really should reply to the post that you refer to in your node, otherwise the poster to whom you're replying to may not notice