Giter Club home page Giter Club logo

perlhelper's Introduction

PerlHelper

This defines and exports some in my opinion useful perl functions.

List of exported functions

myget($url): Downloads a given URL and caches the output in $options{myget_cache}-dir.

debug @messages: Prints some messages to STDERR in green

warning @messages: Prints some messages to STDERR in orange

error @messages: Prints some messages to STDERR in red and exits

analyze_args %options, @parameters, @ARGV: Analyzes arguments and sets %options accordingly

Dumper: Data::Dumper's Dumper

dd %hash: Prints Dumper %hash

memoize 'subname': Memoizes the sub via Memoize

sys $command: Executes $command and returns it's stdout, stderr and exit-code in a hash

init_dialog($backtitle, $title): Initializes Whiptail-Dialog

derror($msg, $die_on_error): Displays a whiptail error message

dmsg $message": Display a whiptail message

dinput $message, $default": Display a whiptail input field with default value $default

url_encode($param), url_decode($param) de- and encodes URL parameters

md5_hex($param): Creates a hexadecimal md5 from $param

is_root(): true if you are root, false otherwise

See test.pl for examples of all of those codes.

List of not-exported available functions

PerlHelper::enable_debug(): Enables debug-output

PerlHelper::disable_debug(): Disables debug-output

PerlHelper::set_myget_cache($path): Sets the $options{myget_cache}

PerlHelper::get_myget_cache(): Gets the current $options{myget_cache}-path

PerlHelper::no_die_on_error(): Disables dieying on error

PerlHelper::die_on_error(): Enables dieying on error

Other features

When loading a module that does not exist, you will get an error message. Run the program again with sudo-rights and it will be installed automagically from CPAN if available.

Also, you don't need to use warnings, strict and autodie anymore, as these are loaded automatically.

perlhelper's People

Contributors

normantud avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.