in reply to Net::FTP - syntax with username containing /

This doesn't have anything to do with Net::FTP I think. I've had a look at the I-Spy-Script, and the part you have to modify there would be:
sub ParseURL { my($url)= shift; my($protocol, $site, $login, $password); $url=~ /^(\w+):\/*([^\/]+)\/(.*)$/; # chunk the URL components $protocol= uc($1); # preserve matches in real variables $site= $2; $path= $3; if ($site=~ /\@/) { # check for the optional login field ($login, $site)= split("\@", $site); ($login, $password)= # check for the optional password field split(":", $login); return($protocol, $site, $login, $password, $path); } else { # no account information return($protocol, $site, "", "", $path); } }

Because there the URL gets splitted into different parts which is given to Net::FTP via CheckViaFTP.
Simply modifiy the split-part and use another char than / to split it. If you don't know how to do that, post a reply here . (I'm short of time at the moment...)

giant

Replies are listed 'Best First'.
Re: Net::FTP - syntax with username containing /
by Abigail-II (Bishop) on Jul 04, 2002 at 14:24 UTC
    If you are going to modify the above subroutine, you'd be better off to leave the URL as is, and do a URI decode on the username and password. (Perhaps also on the path, but I don't know how that's used in the rest of the program). Then escape the slash in the username with %2F.

    Abigail

Re: Re: Net::FTP - syntax with username containing /
by Anonymous Monk on Jul 04, 2002 at 21:29 UTC
    OK, I'm ready to admit defeat in trying to modify the separator regex:

    $url=~ /^(\w+):\/*([^\/]+)\/(.*)$/;

    The way I'm reading this is: between  /^(\w+) is $protocol, between  \/*([^\/]+) is $site, and  \/(.*)$ is $path.

    So, based on the above, if I use a comma separator for the $site portion, the line should look like:

    $url=~ /^(\w+):\/*([^\/]+),(.*)$/;
    and the appropriate line in my text file looks like:

    ftp://XX/yyyy@123.456.789.012,/

    However, when I then run the script, I get several "uninitalized value" errors, one for the pattern match ($site=~ /\@/), one for a line trying to use $host, the other for a line trying to use $path.

    Just for kicks, I tried substituting a comma wherever there was \/, but I got minor variations on the above errors. I also tried substituting \; , but that didn't seem to make a difference.

    So, any help appreciated - if I can learn something about regexs today I will be happy.

    Thanks,

    Glenn

      Sorry, just realized the contents of the file should be:

      ftp://XX/yyyy:password@hostname,/

      Thanks,

      Glenn

Re: Re: Net::FTP - syntax with username containing /
by Anonymous Monk on Jul 04, 2002 at 17:50 UTC
    Whoops. I confused myself, as the syntax in the file is similar to Internet Explorer's ftp syntax - brain fart.

    My bad, thanks for the help.

    Glenn