Debugging with file read in by STDIN

Help
2009-04-17
2013-05-20
  • Woodzmeister

    Woodzmeister - 2009-04-17

    Hi

    Apologies if this is a stupid question - I'm fairly new to the whole PERL/Eclipse thing - but I'm trying to get debug working on a Perl script that reads in from a text file via STDIN.

    For example - if I run from the shell - './MyScript.pl -t 10 < ./Input.txt' - (the script currently has a single argument) then the script works.

    However I don't appear to be able to find a way of doing this in debug from within Eclipse. In debug configuration I can set a program arguments up to read '-t 10 < ,/Input.txt' - but whilst the script goes into debug and correctly picks up the argument it doesn't appear to take in the text file (no STDIN is seen).

    I have tried an alternate approach of using the 'Run as External Tools' to call a shell script - which runs the script correctly but doesn't allow me to debug the script (i.e. none of my breakpoints are hit).

    I'm sure I'm missing something obvious - but any help would be much appreciated.

    Kind regards,

    Stephen

     
    • Jan Ploski

      Jan Ploski - 2009-04-18

      There is currently no way to set STDIN for a script from EPIC, but you can do it in a wrapper Perl script:

      close(STDIN);open(STDIN,'</path/to/your/input.txt');
      do 'script.pl';

      (or reopen STDIN directly in the target script if you can modify it)

       
      • Woodzmeister

        Woodzmeister - 2009-04-22

        Thanks for the help. Will try that. In the interim I decided to use a program argument to tell the script to either use STDIN or read in from a file - and then just tell the script to read in from the file via the arguments in Eclipse.

         

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks