Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^5: Perl command line switches

by Corion (Pope)
on Mar 27, 2020 at 17:19 UTC ( #11114733=note: print w/replies, xml ) Need Help??


in reply to Re^4: Perl command line switches
in thread Perl command line switches

Do you know what the -p switch does in your script?

Do you know what the -v switch does in your script?

The -v switch consumes one more argument from @ARGV and writes into a variable $version. That value is then stripped out from the string contained in the $XLFILE variable.

You don't show us where in your code the $XLFILE variable is populated, but most likely that file is what you want?

Or maybe the output filename is c_vewnts.xml - that is mentioned somewhere later.

My approach would be to talk to the people who wrote that program, or to the people who use that program and ask them about what the program does, and what its input parameters are and where it writes its output.

Replies are listed 'Best First'.
Re^6: Perl command line switches
by Irakro1997 (Novice) on Mar 27, 2020 at 17:35 UTC
    Hi the output file should be an .XML file which i believe is in the code as "c_vents.xml" I am just ensure of which arguments to parse on the script to generate the .XML file i tried running the script as follow: perl create_s_t_xml.pl -v 0.1 and it ge , why does it not generate the .XML file ?
      ... i tried running the script as follow: perl create_s_t_xml.pl -v 0.1 and it ge , ...

      I don't understand this statement. Was there absolutely no output at all? In most cases, output statements like

      printf(" <Unc>\n <ProcessArea name=\"%s\">\n", $box); printf(" </ProcessArea>\n </$area>\n"); printf while <COXML> ;
      will output by default to STDOUT (which usually is the terminal), but this need not be the case; see select. From the code I've seen, I would expect some output to the terminal, not to a file.

      ... the output file should be an .XML file which i believe is in the code as "c_vents.xml" ...

      The code

      my $cvents = "c_vents.xml"; if (-f $cvents) { open(COXML, $cvents ) || die("Cannot Open $cvents"); printf while <COXML> ; }
      tries to open the file c_vents.xml for input and then print the contents of the file, probably to STDOUT; see above for the justification for this guess.

      In addition to the points made above, I would ask the following questions, some of which have already been asked by others:

      • Is  main() ever executed? How do you know?
      • Operation of the script depends on the presence of certain files, e.g., ../vents.v$version.pl and apparently whatever $XLFILE is. Do these files exist in your testing configuration? Is your current working directory correct to access the relative path of at least one of these files?
      • What's going on in functions like  print_t_xml_hdr()  create_t_recs()  print_t_xml_tail() which may be generating some kind of output, but which we are never shown?
      • What are the contents of global variables like  $XLFILE  @SBoxes  %P_UCventList on which the operation of the script (and the generation of output) seems to depend, but which we are never shown?

      Normally I would ask to see the entire script, but I'm afraid to do that because what you have shown us so far is such a terrible mess; I really don't want to start a fight with this tar-baby.


      Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11114733]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2020-06-02 15:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?



    Results (19 votes). Check out past polls.

    Notices?