Code Comments
Programming Forum and web based access to our favorite programming groups.Hi, when i try to run this simple Crypt::X509 script, i have this error: "Attempt to bless into a reference at /opt/perl_32/lib/site_perl/5.8.8/Crypt/X509.pm line 105." I want to build a mailer to send alerts to our customer, if they have to renew their certificates, the ldap extraction is already running. ________________________________________ ___________ use Crypt::X509; #INITIALIZING my $certfile="46B2D0D7.cer"; my $certificate; open CERTFILE , $certfile or die "Error to open file"; binmode binmode read (CERTFILE, $certificate, 65536); close CERTFILE; $decoded = new Crypt::X509->new( cert => $certificate ); print "Certificate Subject: ".$decoded->Subject; ________________________________________ ___________ Does someone know what's wrong with this? Thank you, JL
Post Follow-up to this messageOn 22/8/07 10:34, "Jean-Luc Boss" <jean-luc.boss@flaschenpost.cetrel.net> wrote: > Hi, > > when i try to run this simple Crypt::X509 script, i have > this > error: "Attempt to bless into a reference at > /opt/perl_32/lib/site_perl/5.8.8/Crypt/X509.pm line 105." > I want to build a mailer to send alerts to our customer, > if they have to renew their certificates, the ldap > extraction is already running. > ________________________________________ ___________ > use Crypt::X509; > #INITIALIZING > my $certfile="46B2D0D7.cer"; > my $certificate; > > open CERTFILE , $certfile or die "Error to open file"; > binmode binmode Presumably that ought to be: binmode CERTFILE; ? > read (CERTFILE, $certificate, 65536); > close CERTFILE; > > $decoded = new Crypt::X509->new( cert => $certificate ); > > print "Certificate Subject: ".$decoded->Subject; > ________________________________________ ___________ > > Does someone know what's wrong with this? What happens if you single-step with the perl debugger? Cheers, Chris
Post Follow-up to this messageHello,
2007/8/22, Chris Ridd <chrisridd@mac.com>:
> On 22/8/07 10:34, "Jean-Luc Boss" <jean-luc.boss@flaschenpost.cetrel.net>=
wrote:
This happens in the following code:
sub new {
=09my ($class,%args) =3D @_;
=09if (!defined ($parser)) {
=09=09$parser=3D_init();
=09}
=09my $self =3D $parser->decode($args{'cert'});
=09
=09$self->{"_error"} =3D $parser->error;
=09bless ($self, $class); <=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Error comes down=
here
=09return $self;
}
This can only happen, when the given cert argument is not a string (or
scalar in Perl speak)
Like Chris already suggested, you probably give the new function an
undef, which leads to an uninitialised parser, that cannot be blessed.
Did the Tests work when you installed Crypt::X509 ? When you look in
the t subdirectory you'll find an example how to read a *binary*
certificate file and use the module.
Mit freundlichen Gr=FC=DFen,
Alexander Jung
Post Follow-up to this messageOn Aug 22, 2007, at 4:34 AM, Jean-Luc Boss wrote: > > $decoded = new Crypt::X509->new( cert => $certificate ); You are calling new on the result of calling new take out that first 'new' Graham.
Post Follow-up to this messageHello, 2007/8/23, Graham Barr <gbarr@pobox.com>: > On Aug 22, 2007, at 4:34 AM, Jean-Luc Boss wrote: > You are calling new on the result of calling new thanks, I just looked into my code and did noch check his. oh well, looks I'm getting old and selfish. Mit freundlichen Gr=FC=DFen, Alexander Jung
Post Follow-up to this messageOn Thu, 23 Aug 2007 08:28:16 +0200 "Alexander Jung" <alexander.w.jung@gmail.com> wrote: >Hello, > > >2007/8/23, Graham Barr <gbarr@pobox.com>: >thanks, I just looked into my code and did noch check >his. oh well, >looks I'm getting old and selfish. > >Mit freundlichen Grüßen, > >Alexander Jung Thank you, It works great now, i'm able to check all the certificates in my LDAP now :) Best regards, Jean-Luc Boss
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.