Movatterモバイル変換


[0]ホーム

URL:


 / 
new-0.000002
River stage zero No dependents
/new

NAME

new - Object instantiation sugar for one-liners

SYNOPSIS

Simplest possible usage:

perl -Mnew=HTTP::Tiny -E \  'say $O->get("http://trout.me.uk/X11/vimrc")->{content}'

With arguments:

perl -Mnew=HTTP::Tiny,max_redirects,3 -E \  'say $O->get("http://trout.me.uk/X11/vimrc")->{content}'

With custom object name:

perl -Mnew=HTTP::Tiny,\$H -E \  'say $H->get("http://trout.me.uk/X11/vimrc")->{content}'

With both:

perl -Mnew=HTTP::Tiny,\$H,max_redirects,3 -E \  'say $H->get("http://trout.me.uk/X11/vimrc")->{content}'

DESCRIPTION

import

new->import($class, @args)

First werequire the file for$class, then call

$class->new(@args)

then install the resulting object in$O in the calling package.

Caveat: if$class loads successfully but does not have anew method, we install the$class instead since you might want to call class methods.

If the first argument toimport after$class begins with$, this is treated as the name to install the object as, so

new->import($class, '$Obj', @args);

will create a variable$Obj in the calling package instead of$O.

AUTHOR

mst - Matt S. Trout (cpan:MSTROUT) <mst@shadowcat.co.uk>

CONTRIBUTORS

None yet - maybe this software is perfect! (ahahahahahahahahaha)

COPYRIGHT

Copyright (c) 2020 the new"AUTHOR" and"CONTRIBUTORS" as listed above.

LICENSE

This library is free software and may be distributed under the same terms as perl itself.

Module Install Instructions

To install new, copy and paste the appropriate command in to your terminal.

cpanm

cpanm new

CPAN shell

perl -MCPAN -e shellinstall new

For more information on module installation, please visitthe detailed CPAN module installation guide.

Keyboard Shortcuts

Global
sFocus search bar
?Bring up this help dialog
GitHub
gpGo to pull requests
gigo to github issues (only if github is preferred repository)
POD
gaGo to author
gcGo to changes
giGo to issues
gdGo to dist
grGo to repository/SCM
gsGo to source
gbGo to file browse
Search terms
module: (e.g.module:Plugin)
distribution: (e.g.distribution:Dancer auth)
author: (e.g.author:SONGMU Redis)
version: (e.g.version:1.00)

[8]ページ先頭

©2009-2025 Movatter.jp