#!/usr/bin/perl ######################## # Demo of various Inline stuff. # If it exists, then ~/.Inline or ./.Inline will be used for the various libraries. # Otherwise, running this creates ./_Inline and puts things there. # # use strict; my $x = 10; my $y = 22; use Inline 'C'; print " Testing C: the sum of $x and $y is ", add_C($x,$y), " .\n"; use Inline 'Java'; print " Testing Java: the sum of $x and $y is ", Adder->new->add($x, $y), " .\n"; use Inline 'Python'; print " Testing Python: the sum of $x and $y is ", add_Python($x,$y), " .\n"; __END__ __C__ double add_C( double a, double b) { return a+b; } __Java__ class Adder { public Adder() {} public int add( int i, int j) { return i+j; } } __Python__ def add_Python(x,y): return x + y def sub_Python(x,y): return x - y