I like this code. I have three suggestions:

  1. I'd make $firsttime an explicit package variable (refer to it as $main::firsttime) rather than a top-level lexical. After the top-level while loop, you don't refer to it for a long time, and its appearance in checkfile is a bit disorienting.
  2. Instead of running words together in symbol names, I'd separate them with underscores (so $firsttime would become $first_time). This is quite subjective, but I find it much easier to read.
  3. The massive if...elsif...elsif...else statement in sub ftp is ugly. :-) I'd use a dispatch table instead:
    my %commands = ( 'LS' => \&lsftp, 'DIR' => \&dirftp, 'GET' => \&getftp, 'PUT' => \&putftp, 'DEL' => \&delftp, 'SIZE' => \&sizeftp, ); [...] my $cmd = $commands{$type}; if(&$cmd($value1, $value2) == 1) { sleep $idletime; next; }

    It would take a little bit of work to make the interfaces for each command sub identical (or at least compatible), but I think the savings are worth it.

--
The hell with paco, vote for Erudil!
:wq


In reply to Re: ftp remote-editing script by FoxtrotUniform
in thread ftp remote-editing script by kodo

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.