Can't locate object method "new" via package "Crypt::CBC"

I have a perl script which works with no problems, but when I use perlcc to compile the perl script I receive the following error: Can't locate object method "new" via package "Crypt::CBC"

Have anyone any idea why this happens once compiled?
tony_cusanoAsked:
Who is Participating?
 
inq123Commented:
That means it can't find the path of Crypt::CBC.  It's the same as not using "use Crypt::CBC" in your perl script.  You might need to change the compile options for perlcc to make sure paths are correctly set.  I have not used perlcc myself, so can't say for sure where to look, but -I might be useful.  Also it might help to see if the compiled file works in certain directory but not others, which would mean a certain relative path was compiled in, but not absolute path.  You might try to include "use lib" in your script with absolute path spelled out there.
0
 
tony_cusanoAuthor Commented:
Unfortunate the -I or the use lib does not resolve my issue.

Here's the syntax

cc  -xO3 -xdepend -I/usr/perl5/5.00503/sun4-solaris/CORE /usr/perl5/site_perl/5.005/sun4-solaris/auto/Digest/MD5/MD5.so /usr/perl5/5.00503/sun4-solaris/auto/Fcntl/Fcntl.so /usr/perl5/site_perl/5.005/sun4-solaris/auto/Crypt/DES/DES.so /usr/perl5/site_perl/5.005/sun4-solaris/auto/Crypt/CBC/CBC.so -o d d.pl.c  -L/usr/perl5/5.00503/sun4-solaris/CORE -lperl -lsocket -lnsl -ldl -lm -lc -lcrypt

that gives me the problem.
0
 
inq123Commented:
are you using compiled executable on the same machine and got the complaint?  If it's a different machine it's easier to understand.

I can't see any reason why compiled as above with the so files ready would cause problem like that.  Can you try perlcc with -gen or -sav enabled to see if anything looks unusual in C code?
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
acameronCommented:
This is the main reason perl compilers stink.  ALL of them have this problem, Perl App, Perl2Exe etc etc etc.

It is a problem with the includes, you are using an include like use myApp::Module and the module.pm has an include Crypt::CBC and when you compile it the crypt CBC is not getting pulled in.  Find the module/file you are using that uses Crypt::CBC and above its include/require line put use Crypt::CBC;

Then you should be able to compile and run with no problems.
0
 
tony_cusanoAuthor Commented:
I found out that the Crypt::CBC is an Perl-only implementation and does not produce the .so could this be a problem?
0
 
inq123Commented:
yelp, I think so.  It's perlcc's convention to compile pm to so files, if it can't, then I guess your program has problem at run time finding the implementation of Crypt::CBC.  Basically Crypt::CBC is compiled as a shared library, but if it fails to produce that library, then the executable can't use it.  But I wonder if any other expert would have some work-around suggestion?
0
 
acameronCommented:
I have not used PerlCC that much, I used Perl2Exe whith Crypt::CBC for Net::SSH::Perl.
0
 
acameronCommented:
Like I said I just had to include all the modules specifically.
0
 
inq123Commented:
I kinda agree with acameron (and his suggestion slight differs from mine but follows the same principle), I also had experience with perl2exe and also met with the same problem, and all I had to do is to add command line to include the module specifically (I think) or maybe I used "use lib".  I think I probably added "use lib" at the start of the script or something.  Anyway it worked for me.
0
 
jmcgOwnerCommented:
Nothing has happened on this question in more than 8 weeks. It's time for cleanup!

My recommendation, which I will post in the Cleanup topic area, is to
split points [grade B] between inq123 and acameron (only partial resolution).

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.