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?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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/ /usr/perl5/5.00503/sun4-solaris/auto/Fcntl/ /usr/perl5/site_perl/5.005/sun4-solaris/auto/Crypt/DES/ /usr/perl5/site_perl/5.005/sun4-solaris/auto/Crypt/CBC/ -o d  -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?
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

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 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.
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?
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).


EE Cleanup Volunteer
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.