Calling PGP Command Line with Perl Shell Object Causes Error Code 9000
search cancel

Calling PGP Command Line with Perl Shell Object Causes Error Code 9000

book

Article ID: 153193

calendar_today

Updated On:

Products

PGP Command Line

Issue/Introduction

This article describes an error that might occur when Perl for Windows is used to call PGP Command Line.


 

pgp:parser (9000:invalid flag ... )
 
 

Cause

The Perl Shell object does not split on spaces, which causes it to quote entire arguments as flags. Following is an example of a call to PGP Command Line (using the Perl Shell object) that will result in the error: C:\> perl -e "use Shell qw (pgp); $result=pgp('--fingerprint 0xD7E3B4BB'); print $result"
pgp:parser (9000:invalid flag "--fingerprint 0xD7E3B4BB")
 

 

Resolution


When using the Perl Shell object to call PGP Command Line, split on the spaces yourself. Following is the same example, with the spaces explicitly split: C:\> perl -e "use Shell qw (pgp); $result=pgp('--fingerprint', '0xD7E3B4BB'); print $result"
Bob
F691 2559 BE66 903F 71D0 C893 4B77 4964 D7E3 B4BB
1 key found