Packaging Perl Mojolicious web application - linux

I've written a small web application in Perl and I want to package it up so others can use it. My application has the following components
Various Perl modules from CPAN
My own modules
A MySQLdatabase
Apache2 configuration
I'm not really sure where to start. Any help is much appreciated

Submitting a module to CPAN is easy once you get the hang of it, but at first it takes a while to learn. There are several guides to help you, but choose one that was written within the last few years. Here is one: http://www.perlmonks.org/?node_id=879515
You will need to learn at least a little bit about one of the build tools. I like Module::Build, some others like ExtUtils::MakeMaker (I don't personally) or the pseudo-tool Dist::Zilla which may be used to ease the process of using the previous.
I might suggest trying to releasing a tiny toy module under the Acme:: namespace to try things before uploading your real module.
Look at some of the dists written by your favorite authors to see what they do. For example mine are here or here including my Mojolicious app Galileo.
Finally, as documented here, to make a Mojolicious app installable you need to move your static files into an installable location. I have made a plugin which can help (if you follow its recipe) called Mojolicious::Plugin::InstallablePaths.
Good luck!
P.S. if you comment with a link to a github repo I would be happy to make some comments (but you will still have to do the heavy lifting of course :-) )

Related

ElectronJS code protection 2018

I am about to begin the process of creating a Windows-based utility app to manage localized expressjs server that will utilize a graphical Windows based application to manage some of the features of this service
however before I begin I would like to speak with the community to try to get some advice Advice on how to properly protect the code since it will all be node JS bees I need to make sure it’s protected and some of my initial reading online seems to show that using electron by not be the most Safeway saw that being said how are you guys handling this to keep node JS these code protected with electron and in my case On windows environment
Any advice would be greatly appreciated much thanks
tl;dr You can and it is not worth the effort. Just pack your source into an asar file, it keeps most people away from it.
Long answer:
Use the asar option when building your app.
Obfuscate the code with an uglifier.
Use WASM
Language bindings to grab your data from a compiled format
neonjs for Rust
edge-js for C#
N-API, NAN for C/C++
Otherwise, your files are scripts, all these steps only slow down an attacker (tactic of many defenses), but they will not prevent them from accessing them. The devTools are fairly easy to get opened and people will be able to read the code in some way, shape or form. And if someone gets your obfuscated code, it is simple to reconstruct what is happening (see here for reference: https://www.youtube.com/watch?v=y6Uzinz3DRU)
If you want to protect yourself from code manipulation, there are better ways to do it, like Hashing, Context Isolation etc. Electron has a whole chapter on the matter.
https://github.com/electron/electron/blob/master/docs/tutorial/security.md
Small Update (2020):
I've seen this library a few weeks ago and thought it would show a nice way to further obfuscate the code from being read by external parties
https://github.com/OsamaAbbas/bytenode
The basic idea is to compile the JS into bytecode for V8. This works very well for Electron and is definitely a hurdle not everyone will get over. But, this will not protect your code from being turned back into readable JS. It's just another layer of protection to make it more difficult.

When using someone else's application code do I need to run Cmake to get the project structure for my operating system.

I am getting into a position where I have to use other people code for projects, for example openTLD. I want to change some of the code to give it more functionality and use it in a diffrent way. What I have found is that many people have packaged their files in such a way that you are supposed to use
cmake
and then
make
and sometimes after that
make install
I don't want to install the software on my system. What I am looking to do is get these peoples code to a point where I can add to it in Eclipse or even just using Nano and then compile it.
At what point is the code in a workable/usable state. Can I use it after doing cmake or do I need to also call make? Is my thinking correct that it would be better to edit the code after calling cmake as opposed to before? I am not going to want my finished code to be cross platform supported, it will only be on Linux. Is it easer to learn cmake and edit the code befor running cmake as opposed to not learning cmake and using the code afterwards, if that is possible?
You question is a little open ended.
Looking at the opentld project, there is a binary and a library available for use. If you are interested in using the binary in your code, you need to download the executables(Linux executables are not posted). If you are planning to use the library, you have two options. Either you use the pre-built library or build it during your build process. You would include the header files in your custom application and link with the library.
If you add more details, probably others can pitch in with new answers or refine the older ones.

include C++ application in firebreath

I have created a C++ application using Pjsip Stack and my next step to create a plug-in,for which i am using firebreath. Being a newbee, I dont have any idea of including my C++ project in Firebreath application. Although I searched many links for over a week and tried stuff on my own, I couldnt come up with solution to my problem.
If I can get any guidance for the same I'll be grateful.
The first step is to learn how to write a firebreath plugin, which you can do by going to http://firebreath.org and following the tutorials. You need to keep a few things in mind, though:
Plugins have a different lifecycle than applications.
They start when the browser says and have to go away when the browser says and they can't block the main thread.
They run in a process that they don't own.
Global variables are shared between all instances of the plugin
There could be any number of said instances
Things like the current working directory should probably be left alone.
Turning an application into a plugin is more a process of porting than it is of embedding, and how hard it is depends on how well the application is written; remember that your plugin could be instantiated and destroyed many times before the process is unloaded, so if you have memory leaks it can be a major problem.
The main thing, though, as I said earlier, is just to learn how to write a firebreath plugin. You can best start that by looking at the examples in the repo (particularly fbtestplugin) and following the tutorial to create a new project, then just play until you figure it out. There is an IRC chat room and a google group where you can get help.

Dynamically translating liferay's portlets - pootle

I'm looking for some tool, which provide me possibility to dynamically (online) translate portlets in liferay. I mean, I wrote portlet in English, but people from other country may want to use it with their own language, and they can want to make translation. I know that there is Pootle tool, but I'm looking something what I can launch on Java (JBoss). There is a Jython, but I'm newbie on that, and I don't know how run pootle on jython. If someone have idea about way to solve my problem, please help.
Or maybe more simple Is there possibility to deploy pootle as war file in application server ?
regards
To your simplified question: Pootle is a Python application - AFAIK those get rarely packaged as WAR files. It might be possible, but I've never tried it...
That said, the sweet spot of Pootle is to prepare software translations and bring them back into the software development process - e.g. build. Do you want to "live update" your language files or are you ok with exporting them to your build system, then redeploying the updated plugins? If you want to do live-updates, pootle might not be the right system for you.
If you want to use the translations in the development process (e.g. in buildscripts), your real question might be "How do I install pootle?" - but for this you'd have to give some more steps that you tried, what worked and what did not work.
I never installed pootle myself, but I won't expect it to run seamlessly on a Java application server. If you've never done so as well, rather go the easy way and follow the standard installation procedure.

How to develop in Linux using GNU toolchain, coming from Java?

I'm a good Java programmer, albeit the first languages I learnt were C/C++. Anyway, for work reasons, I switched to Java and web languages. Sometimes I get interested in this or that Linux project, usually coming as a git or svn repository... The problem is that I usually clone the repo, I try to configure it, I install all the needed libraries (and this takes ages), maybe finally I succeed... but then make fails or configure itself fails, complaining about some tool that is missing. Or maybe I installed two versions of the same library and the configure script gets the wrong one, or boring problems like this.
Anyway, I see loads of people using those tools everyday, so it must not be so difficult after all!
Can you point out resources that may help in the first steps?
Thanks
What you are referring to are known as autotools and make
autotools are used to generate scripts and build files that can be used to build as well as install a program/package/software (whatever you call it)
Here is wikipedia link for the GNU build system in general.
And refer to this link for details about the autotools and related stuff
It may take longer, but if you are interested in how to fix those problems yourself I recommend learning how autoconf and automake work. I made a positive experience with the book "Autotools: a practitioner's guide to Autoconf, Automake and Libtool". I read the dead-tree version but it is also available online: http://fsmsh.com/2753.

Resources