Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

Per Rtf to text conversion.

  • 29-06-2018 09: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,705 ✭✭✭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