Solved

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

Posted on 2003-11-04
11
830 Views
Last Modified: 2010-07-27
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
Comment
Question by:tony_cusano
  • 4
  • 3
  • 2
  • +1
11 Comments
 
LVL 8

Accepted Solution

by:
inq123 earned 25 total points
Comment Utility
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
 

Author Comment

by:tony_cusano
Comment Utility
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
 
LVL 8

Expert Comment

by:inq123
Comment Utility
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
 

Assisted Solution

by:acameron
acameron earned 25 total points
Comment Utility
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
 

Author Comment

by:tony_cusano
Comment Utility
I found out that the Crypt::CBC is an Perl-only implementation and does not produce the .so could this be a problem?
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 8

Expert Comment

by:inq123
Comment Utility
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
 

Expert Comment

by:acameron
Comment Utility
I have not used PerlCC that much, I used Perl2Exe whith Crypt::CBC for Net::SSH::Perl.
0
 

Expert Comment

by:acameron
Comment Utility
Like I said I just had to include all the modules specifically.
0
 
LVL 8

Expert Comment

by:inq123
Comment Utility
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
 
LVL 20

Expert Comment

by:jmcg
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This video discusses moving either the default database or any database to a new volume.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now