I am working on a library module to replace an aging shell script. It (among a few other things) reads in a variety of FTP commands from a file and then performs the given FTP transaction. The system in question doesn't have Net::FTP, so that won't work much as I would prefer using that.
My module will read in the config files, set up a hash with all the relevant information and return it upon request.
The problem I am having is that the FTP commands in the file include variables which are set in the module.
In my calling program, I call various methods in the module, print the relevant FTP transaction to a file and then call FTP passing in that file. Easy enough usually.
I have a few lines of code like so:
while (my $command = $ftpgizmo->next_ftp_command )
{
print OUT "${command}\n";
}
Now $command is going to be a string like:
cd $FTPPath
or
type ${TransferMode}
This is exactly what prints out though.
How would I go about making sure that these variables are interpolated so that it prints out
cd /my/ftp/path
or
type ASCII
Currently, in the next_ftp_command, I define and set these variables before returning the given string, but this doesn't work.
Thanks,
Doug
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.