zoukankan      html  css  js  c++  java
  • Erlang Code Auto Reloader

    I wrote this post a few months ago when I was developing a new Erlang application. I eventually ended up using the reloader I mentioned at the end, but never documented it. Now I’m about to start writing a new app, and I’m on a different machine.

    First, get the reloader. It was developed as part of mochiweb but functions just fine on it’s own. Just put it somewhere accessible – I use the ebin directory in my home folder. (yes, I just copied & pasted the source) Then compile it like so:

    erlc reloader.erl

    Now you can load the reloader automatically on startup by adding this to your ~/.erlang config file:

    code:load_abs(“/path/to/your/ebin/reloader”).
    reloader:start().

    Change your path to match your reloader. Do not add the .beam extension. See the code module documentation.

    When you start your Eshell, you’ll automatically get the reloader running. If you didn’t do it right, you’ll get output that looks like this:

    computer:~ jhaddad$ erl
    Erlang R14B (erts-5.8.1) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]

    {“init terminating in do_boot”,{undef,[{reloader,start,[]},{init,start_it,1},{init,start_em,1}]}}

    After loading a module, if you rebuild it, it’ll automatically get reloaded. If you’ve added the eunit .hrl file, it’ll also run your unit tests for you.

    There’s not a lot of documentation out there on this incredibly useful library – hopefully this helps a few of you out.

  • 相关阅读:
    模块
    javacript一键换肤
    ajax请求
    jquery获取元素的方法
    ajax请求里的contentType: "application/json"作用
    Underscore.js 入门-常用方法介绍
    .NET Core调用WCF的最佳实践
    证伪主义——科学与伪科学的量尺
    高效的筒仓
    此时此刻,一个项目正在走向失败
  • 原文地址:https://www.cnblogs.com/xiayong123/p/3717067.html
Copyright © 2011-2022 走看看