erls | Build and manage multiple Erlang versions | FTP library
kandi X-RAY | erls Summary
kandi X-RAY | erls Summary
Manage multiple Erlang installs with per directory configuration.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of erls
erls Key Features
erls Examples and Code Snippets
Community Discussions
Trending Discussions on erls
QUESTION
I was trying to use a function from a library. The function I am trying to use is calling erlang:halt()
internally. So it will stop the VM and my program also exits. Is there anyway I can call the this function without exiting my program?
Here is the function trying to call, its from erlscp. The problem I am facing is nothing executes after this call. I am wondering modifying this library is the only way?
...ANSWER
Answered 2020-Nov-16 at 18:25Modifying the library is the only way.
You can sometimes use the meck library or similar tricks to replace a module or individual functions in a module, but that doesn't work for the erlang
module which is tightly bound to the language itself.
You could try mocking the my_halt
function instead, but that wouldn't have any effect in this case, since compile_cmdline
makes a local call to my_halt
, using my_halt(0)
instead of erl_compile2:my_halt(0)
. Only module-qualified calls to exported functions can be mocked using meck.
QUESTION
I have tried to implement a server with Erlang to my Java application. Seems that my server is working, but still full of bugs and dead points. I need to receive a JSON file parsed by the Java application into a map and send it back to all clients, including the one that uploaded the file. Meanwhile, I need to keep track who made the request and which part of the message was sent, in case of any problems the client should be restarted from this point, not from the beginning. Unless the client leaves the application, then it should restart.
My three pieces of code will be below:
The app.erl ...ANSWER
Answered 2017-Oct-26 at 02:44Let's rework this just a little...
First up: Naming
We don't use camelCase in Erlang. It is confusing because capitalized variable names and lower-case (or single-quoted) atoms mean different things. Also, module names must be the same as file names which causes problems on case-insensitive filesystems.
Also, we really want a better name than "server". Server can mean a lot of things in a system like this, and while the system overall may be a service written in Erlang, it doesn't necessarily mean that we can call everything inside a "server" without getting super ambiguous! That's confusing. I'm going to namespace your project as "ES" for now. So you'll have es_app
and es_sup
and so on. This will come in handy later when we want to start defining new modules, maybe some of them called "server" without having to write "server_server" all over the place.
Second: Input Data
Generally speaking, we would like to pass arguments to functions instead of burying literals (or worse, macro rewrites) inside of code. If we are going to have magic numbers and constants let's do our best to put them into a configuration file so that we can access them in a programmatic way, or even better, let's use them in the initial startup calls as arguments to subordinate processes so that we can rework the behavior of the system (once written) only by messing around with the startup calling functions in the main application module.
QUESTION
I am not sure if I can properly articulate my question, but I will try as best I can.
I find it awkward the way you have to set up a supervisor tree(sup, sup-tress, and other more complex trees).
Lets take for example, the following (I have already made these examples and expanded on them): http://learnyousomeerlang.com/supervisors
I dont like the idea of starting my application(supervisor trees), and then having to send erl commands on the shell to get the application to behave the way I want it too. Take the bottom shell example from the site:
...ANSWER
Answered 2017-Aug-31 at 05:45You have some options.
You can define some variables in env
of .app file or in sys.config file and get them in init/1
of supervisor and return enough number of childspecs.
If count of children and other info about them come from other code and they may come in different times, you can have a child named dispatcher
in supervisor, Your dispatcher's duty is getting information about starting children and starting them as child of supervisor.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install erls
erls will create a default config under ~/.config/erls/config if you don’t create it yourself and it’ll contain:.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page