in reply to Reading output of external program without Shell

Apropos pdftotext. What about CAM::PDF to extract the text? As far as i remember it comes with such a feature. Regards, Karl

Update: Just found an example on my box. I didn't remember that it is so simple:

#!/usr/bin/env perl use strict; use warnings; use CAM::PDF; use feature qw(say); my $file = shift; my $pdf = CAM::PDF->new($file); say $pdf->getPageText(1); __END__

«The Crux of the Biscuit is the Apostrophe»

perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

Replies are listed 'Best First'.
Re^2: Reading output of external program without Shell
by Anonymous Monk on Nov 15, 2017 at 18:27 UTC

    Hi karlgoethebier. I tried in the past CAM::PDF; . In the future I may opt for it, but at the moment I think the quality of output of pdftotext (from xpdf) is unbeatable (but I'll run some more tests)

      Thanks for your kind reply. BTW, as far as i vaguely remember this doesn't call a shell:

      #!/usr/bin/env perl use strict; use warnings; use IPC::Run qw( run ); use feature qw(say); my $command = q(cat); my $text = run qq($command $0); say $text; __END__

      Best regards, Karl

      «The Crux of the Biscuit is the Apostrophe»

      perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

        this doesn't call a shell

        The code you showed does, but if you give run an arrayref, it does not (at least on *NIX):

        $ perl -wMstrict -MIPC::Run=run -e' run "pstree -A $$" ' perl---sh---pstree $ perl -wMstrict -MIPC::Run=run -e' run ["pstree","-A",$$] ' perl---pstree