NAME

Lazy::Utils - Utilities for lazy

VERSION

version 1.03

SYNOPSIS

Utilities for lazy

Methods

trim($str)

trims given string

$str: string will be trimed

return value: trimed string

ltrim($str)

trims left given string

$str: string will be trimed

return value: trimed string

rtrim($str)

trims right given string

$str: string will be trimed

return value: trimed string

file_get_contents($path)

gets all contents of file in string type

$path: path of file

return value: file contents in string type

shellmeta($s)

escapes metacharacters of double-quoted shell string

$s: double-quoted shell string

return value: escaped string

_system($cmd, @argv)

executes a system command like Perl system call

$cmd: command

@argv: command line arguments

return value: exit code of command. 511 if fatal error occurs

returned $?: return code of wait call like on Perl system call

returned $!: system error message like on Perl system call

bashReadLine($prompt)

reads a line using bash

$prompt: prompt

return value: line

cmdArgs(@argv)

resolves command line arguments, eg: -opt1 --opt2 val2 command_string parameter1 parameter2 ...

@argv: command line arguments

return value: { -opt1 => 'opt1', --opt2 => 'val2', command => 'command_string', parameters => ['parameter1', 'parameter2', ...] }

INSTALLATION

To install this module type the following

perl Makefile.PL
make
make test
make install

from CPAN

cpan -i Lazy::Utils

DEPENDENCIES

This module requires these other modules and libraries:

  • Switch

  • FindBin

  • Cwd

  • File::Basename

REPOSITORY

GitHub https://github.com/orkunkaraduman/Lazy-Utils

CPAN https://metacpan.org/release/Lazy-Utils

AUTHOR

Orkun Karaduman <orkunkaraduman@gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2016 Orkun Karaduman <orkunkaraduman@gmail.com>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.