Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Per Rtf to text conversion.

Options
  • 29-06-2018 10:47am
    #1
    Registered Users 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 Posts: 6,494 ✭✭✭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