use Win32::Clipboard;$cb=Win32::Clipboard();
use Win32::Console;
use Net::FTP;
($ci=new Win32::Console STD_INPUT_HANDLE)->Mode(0);
sub gcnw(){
	$ci->GetEvents() or return'';
	my($type,$down,$code)=(($ci->Input())[0,1,5],0);
	$ci->Flush();$type==1&&$down&&$code?chr$code:''
}
sub gc(){until(length($tmpc=gcnw)){};$tmpc}
sub getpasswd(){
	print"Password:\t";$|=1;for(1..6){$p.=gc;print"*"};$p}
sub checkcl{($fnl=shift||'')=~s/^"(.*)"$/$1/;$fnl}
sub checkcb{
	($fns)=($cb->GetText())=~/^\s*"?([A-Z]:\\.+?)"?\s*$/;
	$fns||($cb->GetFiles())[0]}
sub manually{
	system'explorer','/e,/select,'.
		'"D:\Documents and Settings\Mia\Desktop\Veky\TS"';
	$cb->WaitForChange(4e4);checkcb}
$f=checkcl||checkcb||manually||undef;
($fb)=$f=~/.*[\\\/](\S+)/;
print"\n\n\n$f\n\n$fb\n\n\n";
($c=Net::FTP->new("cromath.math.hr",Debug=>1))
	?print"Success!":die"Error connecting";
$c->login('veky',getpasswd);
$c->binary();
$c->cwd('public_html');
$c->cwd('B');
$c->hash(\*STDERR,128);
print"\n",$c->pwd(),"\n\n";
$c->put($f);
$c->quot("site","chmod 644 $fb");
$c->quit();
$l="http://web.math.hr/~veky/B/$fb";
print"\n\n$l\n\n";
$cb->Set("<a href=\"$l\"></a>");