String-Interpolate-Delayed
view release on metacpan or search on metacpan
},
"optional_features" : {},
"prereqs" : {
"configure" : {
"requires" : {
"ExtUtils::MakeMaker" : "6.17"
}
},
"runtime" : {
"requires" : {
"PadWalker" : "1.0",
"PerlX::QuoteOperator" : "0.04",
"String::Interpolate" : "0.3",
"UNIVERSAL::ref" : "0.09"
}
},
"test" : {
"requires" : {
"Test::Fatal" : "0.007"
}
}
- examples
- inc
- t
- xt
optional_features: {}
provides:
String::Interpolate::Delayed:
file: lib/String/Interpolate/Delayed.pm
version: '0.002'
requires:
PadWalker: '1.0'
PerlX::QuoteOperator: '0.04'
String::Interpolate: '0.3'
UNIVERSAL::ref: '0.09'
resources:
X_identifier: http://purl.org/NET/cpan-uri/dist/String-Interpolate-Delayed/project
bugtracker: http://rt.cpan.org/Dist/Display.html?Queue=String-Interpolate-Delayed
homepage: https://metacpan.org/release/String-Interpolate-Delayed
license: http://dev.perl.org/licenses/
repository: git://github.com/tobyink/p5-string-interpolate-delayed.git
version: '0.002'
Makefile.PL view on Meta::CPAN
"meta-spec" => {
url => "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
version => 2,
},
"name" => "String-Interpolate-Delayed",
"no_index" => { directory => ["eg", "examples", "inc", "t", "xt"] },
"prereqs" => {
configure => { requires => { "ExtUtils::MakeMaker" => 6.17 } },
runtime => {
requires => {
"PadWalker" => "1.0",
"PerlX::QuoteOperator" => 0.04,
"String::Interpolate" => 0.3,
"UNIVERSAL::ref" => 0.09,
},
},
test => { requires => { "Test::Fatal" => 0.007 } },
},
"provides" => {
"String::Interpolate::Delayed" => { file => "lib/String/Interpolate/Delayed.pm", version => 0.002 },
},
my $str = delayed/$role of the $thing/;
I prefer the double-quoted style because it fares better with syntax
highlighting.
What is $str? It's actually a blessed object, but it uses UNIVERSAL::ref
to conceal this fact. (`blessed` from Scalar::Util knows the truth
though.)
And it overloads stringification, right? By George! You've got it! Yes, it
overloads stringification and plays silly games with PadWalker and
String::Interpolate.
Methods
As mentioned above, strings with delayed interpolation are blessed
objects. As such, they have methods:
`new($text)`
Object-oriented way to create a string with delayed interpretation,
bypassing the `delayed` quote-like operator.
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://dev.perl.org/licenses/>
dc:title "the same terms as the perl 5 programming language system itself".
<http://purl.org/NET/cpan-uri/dist/String-Interpolate-Delayed/project>
a doap:Project;
dc:contributor <http://purl.org/NET/cpan-uri/person/tobyink>;
doap-deps:runtime-requirement [ doap-deps:on "PadWalker 1.0"^^doap-deps:CpanId ], [
doap-deps:on "PerlX::QuoteOperator 0.04"^^doap-deps:CpanId;
], [
doap-deps:on "String::Interpolate 0.3"^^doap-deps:CpanId;
], [
doap-deps:on "UNIVERSAL::ref 0.09"^^doap-deps:CpanId;
];
doap-deps:test-requirement [ doap-deps:on "Test::Fatal 0.007"^^doap-deps:CpanId ];
doap:bug-database <http://rt.cpan.org/Dist/Display.html?Queue=String-Interpolate-Delayed>;
doap:created "2013-03-01"^^xsd:date;
doap:developer <http://purl.org/NET/cpan-uri/person/tobyink>;
lib/String/Interpolate/Delayed.pm view on Meta::CPAN
package String::Interpolate::Delayed;
our $AUTHORITY = "cpan:TOBYINK";
our $VERSION = "0.002";
our $WORKAROUND = 1;
use overload q[""] => "interpolated", fallback => 1;
use PadWalker ();
use PerlX::QuoteOperator ();
use String::Interpolate ();
use UNIVERSAL::ref;
sub import
{
my $class = shift;
my ($name) = @_;
my $code = sub ($) {
lib/String/Interpolate/Delayed.pm view on Meta::CPAN
if ($WORKAROUND) {
# Workaround for bug in the ->pragma() accessor...
$$stri->{pragmas} = 'import strict "vars";';
}
else {
$$stri->pragma('import strict "vars";');
}
$stri->exec(
_clean(PadWalker::peek_our 1),
_clean(PadWalker::peek_my 1),
grep(ref($_) eq 'HASH', @_),
);
return $stri->exec($$self);
}
sub ref
{
return undef;
}
lib/String/Interpolate/Delayed.pm view on Meta::CPAN
my $str = delayed/$role of the $thing/;
I prefer the double-quoted style because it fares better with syntax
highlighting.
B<< What is C<$str>? >> It's actually a blessed object, but it uses
L<UNIVERSAL::ref> to conceal this fact. (C<blessed> from L<Scalar::Util>
knows the truth though.)
B<< And it overloads stringification, right? >> By George! You've got it!
Yes, it overloads stringification and plays silly games with L<PadWalker>
and L<String::Interpolate>.
=head2 Methods
As mentioned above, strings with delayed interpolation are blessed objects.
As such, they have methods:
=over
=item C<< new($text) >>
( run in 0.311 second using v1.01-cache-2.11-cpan-05444aca049 )