Link to home
Start Free TrialLog in
Avatar of tony_cusano
tony_cusano

asked on

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?
ASKER CERTIFIED SOLUTION
Avatar of inq123
inq123

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tony_cusano
tony_cusano

ASKER

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.
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?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I found out that the Crypt::CBC is an Perl-only implementation and does not produce the .so could this be a problem?
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?
I have not used PerlCC that much, I used Perl2Exe whith Crypt::CBC for Net::SSH::Perl.
Like I said I just had to include all the modules specifically.
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.
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