Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 941
  • Last Modified:

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?
0
tony_cusano
Asked:
tony_cusano
  • 4
  • 3
  • 2
  • +1
2 Solutions
 
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 4
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now