[erlang-questions] newbie question on deploying third party tools
Michael McDaniel
erlangy@REDACTED
Wed Apr 29 16:30:06 CEST 2009
On Wed, Apr 29, 2009 at 09:30:31AM -0400, Larry White wrote:
> I'm trying to learn erlang by reading the books and building an account
> management application that would let me exercise some important
> functionality (cryptography, persistence, sending emails, etc.
>
> Based on recent posts to this list, I'm interested in trying the
> smtp-fsm and epgsql libraries. My general question is: How do you
> deploy these things?
>
> More specifically, I have my own app with its own src subfolder, etc.
> Where do third party libraries get installed relative to something like
> this?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I place smtp_fsm.erl into my application src directory and have
it compile to ebin (which is in my local '-pa /path/to/ebin' when
I invoke erl [i.e. my application]).
If I used a more complex multi-module solution I would probably
have it in its own subdirectory and include a different ebin.
I use smpt_fsm.erl thusly from one of my modules ...
send( From, To, Subj, Msg ) ->
try smtp_fsm:start("mx.some_domain.some_tld")
of {ok, Pid} -> smtp_fsm:ehlo(Pid) ,
smtp_fsm:sendemail(Pid,
From,
To,
"Subject: "++Subj++"\n"++Msg) ,
catch smtp_fsm:close(Pid) ;
_Other -> no_mail_today
catch _:_ -> no_mail_today
end
.
There are other ways of doing it. Some libraries I keep in completely
separate (OTP) directory structures and then include their ebin path
erl -pa /path/to/some/library/ebin -pa /path/to/another/ebin ...
or, if I have a bunch of libraries I want to include
erl -pa /home/libraries/mm/*/ebin
/home/libraries/mm
-----
/lib_one /lib_two ... /lib_n
/ebin /ebin ... /ebin
lib_one ... lib_n have the regular /src, /include, etc. OTP subdirectories
With regard to the above smtp_fsm:start/1, occasionally I will import
a module, e.g.
-import([smtp_fsm]).
and then just make the fun call start/1 (though not in a case like this
where 'start' is so common across modules !). Also, I say 'occassionally'
I will import becuase 'usually' I want to use explicit module names.
~Michael
>
> Also, what if anything, do I then need to do to use the applications?
>
> Thanks.
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
--
Michael McDaniel
Portland, Oregon, USA
http://trip.autosys.us
http://autosys.us
http://mmcdaniel.com/erlview
More information about the erlang-questions
mailing list