Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Per Rtf to text conversion.

  • 29-06-2018 10:47AM
    #1
    Registered Users, Registered Users 2 Posts: 46


    Hello all,

    I am trying to allow a file specified via the command line be converted from rtf to text but I keep getting the same error message.

    The cpan documentation is quite limited for this module but according to whatever I could find the code below should do what i need without an issue.

    #!/usr/bin/perl

    use strict;
    use warnings;
    use RTF::TEXT::Converter;


    my $object = RTF::TEXT::Converter -> new( Output => \*STDOUT );
    $object -> parse_stream(*STDIN);

    However, when running it I get the error.

    Couldn't open '*main::STDIN' for reading at /usr/local/share/perl5/RTF/Parser.pm line 233.


Comments

  • Registered Users, Registered Users 2 Posts: 6,677 ✭✭✭daymobrew


    A filename on the command line won't make an input stream.
    Maybe something like
    cat filename | perl rtf-to-text.pl
    
    might.


Advertisement