Wednesday, July 11, 2018

Getting started with Python Flask application with MVC structure

I have added a MVC structure and getting started with Python flask application in my Github.  I will continue to contribute to this repository with Database connections and JWT Authentication.

Tuesday, May 16, 2017

Converting JSON to LCOV (infofile)

Wrote a small NPM module that converts JSON to LCOV data

Tuesday, May 9, 2017

Install Cpanm module error : No such file or directory opening compressed index

system$ HOME=/tmp /home/perl/5.10/bin/cpanm REST::Client
! Finding REST::Client on cpanmetadb failed.
! cannot open file '/tmp/.cpanm/sources/': No such file or directory opening compressed index
! Couldn't find module or a distribution REST::Client



The problem is because of "LWP::Protocol::https" module.

Removing the directory worked for me :

/home/perl/5.10/lib/site_perl/5.10.1$ rm –rf LWP*

or try with option "--no-lwp"

Example: cpanm REST::Client --no-lwp

Error while installing Perl 5.10.1

 Error while installing Perl 5.10.1

a -Wdeclaration-after-statement -Wendif-labels -Wc++-compat 
cc -fstack-protector -L/usr/local/lib -o miniperl \
      gv.o toke.o perly.o pad.o regcomp.o dump.o util.o mg.o reentr.o mro.o hv.o av.o run.o pp_hot.o sv.o pp.o scope.o pp_ctl.o pp_sys.o doop.o doio.o regexec.o utf8.o taint.o deb.o universal.o xsutils.o globals.o perlio.o perlapi.o numeric.o mathoms.o locale.o pp_pack.o pp_sort.o  \
    miniperlmain.o opmini.o perlmini.o 
pp.o: In function `Perl_pp_pow':
pp.c:(.text+0x2d79): undefined reference to `pow'
pp.o: In function `Perl_pp_modulo':
pp.c:(.text+0x3b22): undefined reference to `floor'
pp.c:(.text+0x3b58): undefined reference to `floor'
pp.c:(.text+0x3b90): undefined reference to `fmod'
pp.o: In function `Perl_pp_atan2':
pp.c:(.text+0x8985): undefined reference to `atan2'
pp.o: In function `Perl_pp_sin':
pp.c:(.text+0x8b22): undefined reference to `sin'
pp.o: In function `Perl_pp_int':
pp.c:(.text+0x8fc1): undefined reference to `floor'
pp.c:(.text+0x9031): undefined reference to `ceil'
pp.o:(.rodata+0x120): undefined reference to `cos'
pp.o:(.rodata+0x128): undefined reference to `sin'
pp.o:(.rodata+0x130): undefined reference to `sin'
pp.o:(.rodata+0x138): undefined reference to `exp'
pp.o:(.rodata+0x140): undefined reference to `log'
pp.o:(.rodata+0x148): undefined reference to `sqrt'
pp_pack.o: In function `S_pack_rec':
pp_pack.c:(.text+0x740b): undefined reference to `floor'
pp_pack.c:(.text+0x742e): undefined reference to `floor'
pp_pack.c:(.text+0x7453): undefined reference to `floor'
collect2: error: ld returned 1 exit status
makefile:347: recipe for target 'miniperl' failed

make: *** [miniperl] Error 1

This link helped me to find what i was missing:

and finally this worked for me

Step 1: find your lib path which has all libm* files
In most systems it will be under /usr/lib64. Search for the files in your system. 
system:/usr/lib64 $ ls libm*
libm.a         libmcheck.a         libmvec.a      libmvec_nonshared.a
Step 2: Use the path with glibpth option while doing configure
./Configure -des -Dglibpth='/lib/lib64 /usr/lib64'
or I see some forums suggested plibpth
./Configure -des -Dplibpth='/lib/lib64 /usr/lib64' -Dglibpth='/lib/lib64 /usr/lib64' -Dlibpth='/lib/lib64 /usr/lib64'

I have answered the same here :

Friday, April 28, 2017

How to place Perl modules in non-standard locations and use it

If this is the project structure,



In ``, we can include both libraries by,

    use lib '/home/directory/project';
    use lib '/home/directory/lib';


    #include both directory at once, 

    use lib qw(
    use Libary1;
    use Libary2;

``, will have the same path,

    use lib qw(
    use Libary1;
    use Libary2;

The above code is good for 1 or 2 files. But if there are 10+ perl files, we have to include the same lib path in all files. If the library path changes, we had to change all files with the correct path name.
So what I did was to have 1 module `config/` that will have the paths, and all files will include the module.




In ``

    package LibPaths;
    use lib qw(

and I include the `` module In `` as follows

    use File::Basename;
    use Cwd qw(abs_path);
    use lib dirname (abs_path(__FILE__)) . "/config";
    use LibPaths;

-   `use Cwd qw(abs_path)` is needed to get the current file.
-   `use lib dirname (abs_path(__FILE__))` will get the directory name of the current file
-   `use lib dirname (abs_path(__FILE__)) . "/config";` will include the config folder. I liked to put the `` under a config directory and my project has 50+ files. But If the module is in same directory, including config is not needed.

**So now when the library paths changes, I can update in 1 place which is `` **

There are other Perl modules like “FindBin” which will serve this purpose, But I didnt want to introduce a new dependency in my project. So I followed the above hack. I might be an ugly hack, but it works :D


Monday, April 24, 2017

How to private chat using node.js and

Create a room with conversation_id and make users to subscribe to that room, 
so that you can emit a private message to that room it by,

var socket = io.connect('http://ip:port');

socket.emit('subscribe', conversation_id);

socket.emit('send message', {
    room: conversation_id,
    message: "Some message"

socket.on('conversation private post', function(data) {
    //display data.message

socket.on('subscribe', function(room) {
    console.log('joining room', room);

socket.on('send message', function(data) {
    console.log('sending room post',;'conversation private post', {
        message: data.message

Here is my Stackoverflow answer :