Structs

Mikael Karlsson mikael.karlsson@REDACTED
Thu Jan 16 14:22:54 CET 2003


Sorry, wrong badmatch
guess it should be

connect(Host, User, Password) ->
    case catch connect1(Host, User, Password) of
	{ok,Result} ->
	    {ok,Result};
	{'EXIT´,{ {badmatch,{error, Rsn}},_}} ->
	    {error, otp_ftp:formaterror(Rsn)}
    end.

/Mikael

> Hi Luke,
> Whats wrong with:
>
> connect(Host, User, Password) ->
>     case catch connect1(Host, User, Password) of
> 	{ok,Result} ->
> 	    {ok,Result};
> 	{badmatch,{{error, Rsn}} ->
> 	    {error, otp_ftp:formaterror(Rsn)}
>     end.
>
> connect1(Host, User, Password) ->
>     {ok, Pid} = otp_ftp:open(Host),
>     link(Pid),
>     ok = otp_ftp:user(Pid, User, Password),
>     {ok, Home} = otp_ftp:pwd(Pid),
>     ?event(ftp, "~p: Home is ~p", [self(), Home]),
>     ok = otp_ftp:type(Pid, binary),
>     {ok, {Pid, Home}}.
>
> ?/Mikael
>




More information about the erlang-questions mailing list