Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: Use of AutoLoader in Modern Times (future)

by tobyink (Abbot)
on Nov 16, 2012 at 14:57 UTC ( #1004213=note: print w/replies, xml ) Need Help??


in reply to Re: Use of AutoLoader in Modern Times (future)
in thread Use of Autoloader in Modern Times

Module::Runtime's use_module function may be to your liking...

use_module('My::Utils')->import(qw< min max zip >); my $logger = use_module('My::Logger')->new(-trace => 1);

Update:... some people may well consider this insane but...

BEGIN { package PerlX::qm; no thanks; sub import { my ($me, $name) = @_; require Module::Runtime; require PerlX::QuoteOperator; PerlX::QuoteOperator->new->import($name || "qm", { -parser => 1, -with => sub ($) { Module::Runtime::use_module(grep /\w/, split /\s/, $_[ +0]) }, }, scalar caller); } }; use 5.010; use strict; use warnings; use PerlX::qm; say qm( Math::BigInt 1.000 )->new('4660')->as_hex; say qm( Math::BigFloat )->new('74565')->as_hex;

PerlX::qm defines a quote-like operator (like qq, qw or qx) for module names. Quoted modules are loaded at runtime, and can be followed by an optional version number.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1004213]
help
Chatterbox?
[perldigious]: Being the ignorant one, my initial reaction to that is, "that's sort of a dick move, a lot of people like me expect column names like that to stay the same, why the hell would you change them like that for seemingly no good reason?"
[perldigious]: Or is my irritation/ frustration well founded?
[Corion]: perldigious: That seems to be more the export and likely it's the recipients of that export that like the titles changes
[Corion]: ... "changed"
[Corion]: I usually expect fixed header names, but am sometimes lenient in the order of columns. But changing the report titles often sounds to me as if you are not the sole consument of the export ;)
[shmem]: perldigious: as always - if it ain't broke, don't fix it. Ther must be a very compelling reason for changing column names in a database. Those are rare.

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2017-05-25 13:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?