----- Original Message ----- From: "Ron Grunwald" <ron...@yahoo.com.au>

An interesting and unexpected behaviour about Inline emerged here. Inline does not process multiple "use Inline BC ..." statements in the order in which they appear
in the code.

I haven't gone digging into the source to find out why this might be - and I don't think I want to :-)

It sounds as though the separate statements could be being fed into a hash prior to processing. (The hashing mechanism plays havoc with our notion of order, as you probably know.)

I couldn't reproduce the behaviour with Inline::C (see demo below my sig), except that the "use Inline C => 'DATA';" is always processed last. This might be associated with the fact that the __DATA__ section always comes at the very end of the script.

I find that the "use Inline C => <<'EOC';" sections are being compiled in the order in which they occur in the script.

Cheers,
Rob

use warnings;

use Inline C => Config =>
   PRINT_INFO => 1;

use Inline C => <<'EOC';

void foo() {
    printf("hello from foo\n");
}

EOC

use Inline C => <<'EOC';

void bar() {
    printf("hello from bar\n");
}

EOC

use Inline C => <<'EOC';

void baz() {
    printf("hello from baz\n");
}

EOC

use Inline C => 'DATA';

use Inline C => <<'EOC';

void fubar() {
    printf("hello from fubar\n");
}

EOC

use Inline C => <<'EOC';

void fubarbaz() {
    printf("hello from fubarbaz\n");
}

EOC

foo();
bar();
baz();
rhubarb();
fubar();
fubarbaz();

__DATA__
__C__

void rhubarb() {
    printf("hello from rhubarb\n");
}


Reply via email to