NAME

ore

ABSTRACT

Sugar for Perl 5 one-liners

SYNOPSIS

  BEGIN {
    $ENV{New_File_Temp} = 'ft';
  }

  use ore;

  $ft

  # "File::Temp"

DESCRIPTION

This package provides automatic package handling and object instantiation based on environment variables. This is not a toy, but it's also not a joke. This package exists because I was bored, shut-in due to the COVID-19 epidemic of 2020, and inspired by new and the ravings of a madman (mst). Though you could use this package in a script it's meant to be used from the command-line.

new-example

Simple command-line example using env vars to drive object instantiation:

  $ New_File_Temp=ft perl -More -e 'dd $ft'

  # "File::Temp"

use-example

Another simple command-line example using env vars to return a Data::Object::Space object which calls children and returns an arrayref of Data::Object::Space objects:

  $ Use_DBI=dbi perl -More -e 'dd $dbi->children'

  # [
  #   ...,
  #   "DBI/DBD",
  #   "DBI/Profile",
  #   "DBI/ProfileData",
  #   "DBI/ProfileDumper",
  #   ...,
  # ]

arg-example

Here's another simple command-line example using args as env vars with ordered variable interpolation:

  $ perl -More -E 'dd $pt' New_File_Temp=ft New_Path_Tiny='pt; $ft'

  # /var/folders/pc/v4xb_.../T/JtYaKLTTSo

etc-example

Here's a command-line example using the aforementioned sugar with the ever-awesome Reply repl:

  $ New_Path_Tiny='pt; /tmp' reply -More

  0> $pt

  # $res[0] = bless(['/tmp', '/tmp'], 'Path::Tiny')

AUTHOR

Al Newkirk, awncorp@cpan.org

LICENSE

Copyright (C) 2011-2019, Al Newkirk, et al.

This is free software; you can redistribute it and/or modify it under the terms of the The Apache License, Version 2.0, as elucidated in the "license file".

PROJECT

Wiki

Project

Initiatives

Milestones

Contributing

Issues