[Israel.pm] web-based script

Yuval Yaari yuval at windax.com
Tue Aug 31 04:34:39 PDT 2004


Shlomo,

This can all be done from the shell.
And as much as I like to write Perl -- I'd rather use already-written tools.

>  	[in the browser]
>  	* goto url x.y.z
>  	* login (username+password) [1]

This can be done with wget and/or lwp-request and/or curl.

>  	<new page>
>  	* select a radio button
>  	* select another radio button
>  	* hit submit

Can you emulate this by hacking the URL?
Otherwise you can use WWW::Mechanize (which means you will write code, but
it's easy).

>  	<wait for a download of a HUGE (over 100 mg) file>
>  	[in the shell prompt]
>  	* run a script on the downloaded file
>  	<new file produced>
>  	* copy the new file to some directory

Of course, this is basic.

>  	* synchronize the directory with its mirror on another server
>  	* run another script that compiles something out of the file
>  	<after a few hours of processing a new file is created>
>  	* sftp the file to server A
>  	* ssh to server C
>  	* ssh from C to server B
>  	* sftp from server B to server A and get the new file
>  	* chmod the file on server B as it should be
>  	DONE

Rsync runs over SSH, and can be used with SSH keys.
That means you can sync the directory, run scripts, chmod, etc.
I wrote a backup script for my former company that backs things up over
SSH using rsync and also chmods stuff.

>
> Can you please give me skeleton code for any of the tasks?
> I see here:
>  	session to handle (pose as a browser)
>  	doing stuff locally (that's easy... I already know this)
>  	synchronization in batch mode (how?!)
>  	transfer of the file by a chain of ssh and sftp [2]

Let me know if my way of thinking is correct :)

  --Yuval





More information about the Perl mailing list