In linux I used PAR pp and converted my perl code to executable..
while running the filename.pl it is completely fine.
But when I run the executable with ./filename It says it cant locate object methods new and other function (both written in inline c++.)

some hints plssss

Recommended Answers

All 12 Replies

Do you have the #/usr/bin/perl line (edited for your environment) at the top?

I have my hashbang line as /usr/bin/perl -w since my perl interpreter is in this path only...I anything to be done for inline?

my error is
Tk::Error Undefined subroutine &test::test1 where test is the module name and test1 is an inline cpp function in that module.

any hints plss
thanks

do you import (use/require) the pm properly? does the pm file return 1 by default? does the pm file have a package definition? is it in the correct folder? there's a long list of checks...

heres some blocks from two files, one that imports and uses a pm module, and the pm module itself:

top part of "render_xrm.pl"

#!/usr/bin/perl
use strict;
use General::PathArray;
 
  my($root_array) = new General::PathArray($file_root);
  my($clone) = $root_array->clone();
  my($random) = General::PathArray::return_something_static()

top part of "General/PathArray.pm"

#!/usr/bin/perl
package General::PathArray;
 
sub new{
  my($class,$init_path,$lock_depth) = @_;
  my($self) = {};
  bless ($self,$class);
  if($init_path){
    $self->setString($init_path);
  }
  #$self->lockRoot();
  return $self;
}
 
[I]#/////OTHER FUNCTIONS[/I]
 
1; [I]#<<<< IMPORTANT!!![/I]
}

This isn't an especially nice way to import all things, as I import EVERYTHING from that module when I use it, including static variables... Still, it's a small, widely used object without static variables and it should be imported in full.

My files are arranged like this:

->cgi
__->General
_____~PathArray.pm
__~render_xrm.pl

where -> denotes folder and ~ denotes file.

what does your folder hierachy look like? does the Perl interpretter throw an error when you just try:

#!/usr/bin/perl
use test;

hm, i didn't read your topic thouroughly, didn't realise you'd gone for the exe option in the end... there may be a problem with the linkage of things that you have compiled; are there complete linkage/include options in the compiler your using? you may have to compile all your resources (including modules) in a single exe, or you may have to call them externally...

Try compiling a pl + pm but try with something very, very simple structurally; it will help you to find a general solution without the cloudiness of complexity.

Hi ,thanks.
1)Are there any other options while PPing inline code.
2)Along with my files,there is one _Inline folder created during building.thats all.whatelse should be present inside the same folder.


(I have one .pl file which 'use's seven .pm files and one of the .pm is having inline c++ in it (It has use inline CPP;).running it is very fine and working.
while running the executable , all subroutines in the other .pm files are recognised.Only the subroutines in the inline code are erroring as undefined.)

any hints?...

Maybe it is the Inline package itself that is missing from your resulting executable... do you reference any other packages that aren't in YOUR directory structure? i.e things from CPAN, and things that come with Perl but aren't available without being used/imported? If so, what happens when you use them in a compiled pl/pm?

When you downloaded Inline, did you put it in the Perl lib folder? or do you manually add it to the @INC of packages that use it?

Hi,
thanks..INC is proper and everything is in per/bin...So the way is using XS file while craeting par binary.
Pls hint on 'How to use XS in a module' ,while creating a binary using par (of a perl module using inline c++) .
My binary says inline subroutines as undefined...So I grabbed the XS file,inline.h and makefile.PL....How do I proceed?
No results sofar from hunting the internet...helpout. .thanks..
karthika.

How to edit the XS file that is created while creating par binary? what should package name be and module name be?

have you read this: http://search.cpan.org/~autrijus/PAR-0.85/script/pp?

are you using the GUI interface for PP? I would try from the command line, and takenote of:

-M, --module=MODULE Add the specified module into the package, along with its dependencies. Also accepts filenames relative to the @INC path; i.e. -M Module::ScanDeps means the same thing as -M Module/ScanDeps.pm.
If MODULE has an extension that is not .pm/.ix/.al, it will not be scanned for dependencies, and will be placed under / instead of /lib/ inside the PAR file. This use is deprecated -- consider using the -a option instead.
You may specify -M multiple times.

however, i would certainly expect that modules you include explicitly through code to be included automatically o_O

Hi Matt,
Thanks a lot...I made my module into two parts and made the inline module have only c++ code.
Previously 1; was at the end of perl code and so c++ code was not recognised.Now 1; is at the end of c++ code and it worked.
Thanks a lot for helping. keep the good job going.
--karthika.

hmmm that's strange... i start alot of my modules:

#!/usr/bin/perl
package X::X;
use Y::Y;
require Z::Z;
our(@ISA) = Z::Z;
1;
>>> and then put the code o_O
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.