Solved

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

Posted on 2003-11-04
11
865 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
ID: 9680712
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
ID: 9685169
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
ID: 9685524
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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

Assisted Solution

by:acameron
acameron earned 25 total points
ID: 9689085
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
ID: 9692540
I found out that the Crypt::CBC is an Perl-only implementation and does not produce the .so could this be a problem?
0
 
LVL 8

Expert Comment

by:inq123
ID: 9693738
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
ID: 9693906
I have not used PerlCC that much, I used Perl2Exe whith Crypt::CBC for Net::SSH::Perl.
0
 

Expert Comment

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

Expert Comment

by:inq123
ID: 9694237
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
ID: 10049479
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 …
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
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…

822 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