Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.
  • Comment on Suggestion needed for automating 3 separate programs/components

Replies are listed 'Best First'.
Re: Suggestion needed for automating 3 separate programs/components
by McDarren (Abbot) on Nov 29, 2005 at 13:46 UTC
    Ashutosh,

    If you are wondering why the replies you are getting so far are not quite what you expected, then you may wish to have a read of How (Not) To Ask A Question, go away and have a think about it, and then come back and ask your question again.

    I'm sure you'll find plenty of people here are more than willing to help if you follow a few simple guidelines (that you'll find at that link above).

    cheers,
    Darren :)

Re: Suggestion needed for automating 3 separate programs/components
by tirwhan (Abbot) on Nov 29, 2005 at 13:24 UTC

    No need to use perl for that, just use the shell

    encoder *.xml | decoder | validator

    Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -- Brian W. Kernighan
      He/she might not have a shell, and therefore piping may be unavailable.

      Plus, you're assuming the decoder and the validator work line by line, which is probably not the case.

        You're right I cannot know these things, because the OP did not give any information on them In fact he hardly gave any useful information at all, so I proposed a workable solution under some circumstances and I expect he'll deal with the lack of information on his own :-).


        Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -- Brian W. Kernighan
Re: Suggestion needed for automating 3 separate programs/components
by jonadab (Parson) on Nov 29, 2005 at 15:21 UTC

    Okay, I'm trying to find a Perl question in this post, and this is the closest thing I can find...

    This is to be repeated till all .xml files in directory is exahausted.

    Are you asking how to loop through all the .xml files in a directory? There's more than one way to do that, e.g., you could use glob or File::Find. If I were doing it, I'd probably use readdir. If you use glob or readdir, you can use grep to select only the files whose names end in .xml and run a foreach loop over the results, something like the following (untested):

    opendir(MYDIR, $dirpathname) or die "Cannot open directory: $!"; foreach my $xmlfile (grep { -f $_ and /[.]xml$/ } readdir MYDIR) { do_stuff_with($xmlfile); } closedir MYDIR;

    update: added filetest to prevent inadvertently treating a directory as an XML file if it happens to have a name ending in .xml

Re: Suggestion needed for automating 3 separate programs/components
by Perl Mouse (Chaplain) on Nov 29, 2005 at 13:14 UTC
    I would proceed with
    $ vi myprogram
    Perl --((8:>*