I wrote a piece of cam-like software today out of shear laziness and nothing to do at work. I have found a program that works astonishingly well (gqcam) on my linux box. The only problem being that it doesn't auto upload. So, I took it upon myself to write some code for it:
#!/usr/bin/perl -w
use Net::FTP;
my $hostname;
my $username;
my $password;
my $boink;
my $directory;
my $filename;
my $ftp;
my $sleeptime;
$boink = 0;
`gqcam &`;
while ($boink == 0) {
$ftp = Net::FTP->new($hostname) or die "can't connect: $@\n";
$ftp->login($username,$password) or die "can't login: $@\n";
$ftp->cwd($directory) or die "can't cwd to $directory\n";
$ftp->type(binary) or die "cannot change type to binary\n";
$ftp->put($filename) or die "cannot put $filename\n";
$ftp->close;
sleep($sleeptime);
}
Although this is nothing revolutionary, I thought that I might as well post it because it runs under -w, as far as I am aware.
I attempted to launch gqcam from the program with:
`gqcam &` but that generated error after error for the cam program. How could I get perl to call gqcam and not spew forth masses of errors to gqcam?
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.