Hi,

We found a small Inline wierdness, today. It's not a bug, and it
doesn't affect any "normal" code. But it's probably worth knowing
about...

It looks like Inline sets the global variable $_ to a string that
looks something like:

"    version : 5.6.1"

when it loads and checks its cached Config file. 

Here's some code that demonstrates this behavior.

  use Inline C;
  greet('Ingy');
  greet(42);
  print "$_\n";
  __END__
  __C__
    void greet(char* name) {
      printf("Hello %s!\n", name);
    }

Running this snippet (which is example #1 in the C Cookbook, plus the
line to print out $_), looks like this:

  [khk: khkramer]$ perl test.pl
  Hello Ingy!
  Hello 42!
      version : 5.6.1

We found this behavior while trying to diagnose some (unrelated) $_
strangeness in a bit of our code. Eventually boiling our test snippet
down to:

  use XML::Comma;
  print "$_\n";

Commenting out the 'use XML::Comma' returns "$_" to its natural,
undefined state. XML::Comma is usually configured to load some modules
that depend on Inline::C, so code that uses XML::Comma sees the
version-string behavior.

I'm not sure why, exactly, the assignment to $_ happens. But it looks
like line 627 of Inline.pm (version 0.43) might be where it does.

Kwin

Reply via email to