On Fri, 8 Sep 2006 08:19:21 -0700 (PDT), John Douglas Porter wrote:
If you really want to test the ref type, do so
robustly using the methods in Scalar::Util.
I'm not convinced that is indeed the best approach. So Uri expects
either a plain string, or a scalar ref to a string.
What if instead
Hi Chris,
* Chris Dolan [EMAIL PROTECTED] [2006-09-09 21:00]:
I didn't mean that to be insulting -- I was just teasing. […]
That was for my curiosity and to convince me, […] I apologize
for my less-than-clear motives.
no problem, not your fault. I’m a bit impatient sometimes, which
can lead
On Sep 9, 2006, at 3:12 AM, A. Pagaltzis wrote:
* Chris Dolan [EMAIL PROTECTED] [2006-09-09 03:55]:
Works the same. I often use `local $_` in tiny functions that
mangle just a single value. Matter of taste/style.
Ahh, I see -- cargo cult. ;-)
Err, what? I chose that style for myself. I
Le samedi 09 septembre 2006 à 10:12, A. Pagaltzis écrivait:
* Uri Guttman [EMAIL PROTECTED] [2006-09-09 05:40]:
use local only when you MUST use it. mjd has a good article on
the 7 valid uses of local. just declaring vars in a sub is not
one of them.
If you use $_ in any way within a
* Uri Guttman [EMAIL PROTECTED] [2006-09-07 09:30]:
@{$self-{templates}}{ keys %{$tmpls} } =
map ref $_ eq 'SCALAR' ? \${$_} : \$_, values %{$tmpls} ;
If we're looking for ways to do it differently, possibly better:
my %copy = %$tmpls;
$_ = ref $_ ? \$$_ : \$_ for
A. Pagaltzis [EMAIL PROTECTED] wrote:
sub flatten_copy {
local $_ = shift;
ref $_ eq 'SCALAR' ? $$_ : $_;
}
my %copy = %$tmpls;
$_ = \( flatten_copy $_ ) for values %copy;
@{$self-{templates}}{ keys %copy } = values %copy;
Excellent!
I believe it's
* Chris Dolan [EMAIL PROTECTED] [2006-09-08 17:10]:
Why did you use local? Shouldn't the following work?
sub flatten_copy {
my $s = shift;
ref $s eq 'SCALAR' ? $$s : $s;
}
Works the same. I often use `local $_` in tiny functions that
mangle just a single value.
On Sep 8, 2006, at 6:48 PM, A. Pagaltzis wrote:
* Chris Dolan [EMAIL PROTECTED] [2006-09-08 17:10]:
Why did you use local? Shouldn't the following work?
sub flatten_copy {
my $s = shift;
ref $s eq 'SCALAR' ? $$s : $s;
}
Works the same. I often use `local $_` in tiny
Uri == Uri Guttman [EMAIL PROTECTED] writes:
Uri@{$self-{templates}}{ keys %{$tmpls} } =
Urimap ref $_ eq 'SCALAR' ? \${$_} : \$_, values %{$tmpls} ;
Uri discuss amongst yourselves. topics include: what does it do?
Uh, it throws a lot of warnings when values(%$tmpls) has
On Thu, Sep 07, 2006 at 07:21:07AM -0700, Randal L. Schwartz wrote:
Uri == Uri Guttman [EMAIL PROTECTED] writes:
Uri @{$self-{templates}}{ keys %{$tmpls} } =
Uri map ref $_ eq 'SCALAR' ? \${$_} : \$_, values %{$tmpls} ;
Uri discuss amongst yourselves. topics include: what does
On Thu, 07 Sep 2006 03:29:02 -0400, Uri Guttman wrote:
this line of my code grew to its present form which i find amusing.
@{$self-{templates}}{ keys %{$tmpls} } =
map ref $_ eq 'SCALAR' ? \${$_} : \$_, values %{$tmpls} ;
discuss amongst yourselves. topics include: what
* Uri Guttman [EMAIL PROTECTED] [2006-09-07 09:30]:
this line of my code grew to its present form which i find amusing.
@{$self-{templates}}{ keys %{$tmpls} } =
map ref $_ eq 'SCALAR' ? \${$_} : \$_, values %{$tmpls} ;
my ( $k, $v );
$self-templates-{ $k } = ref
12 matches
Mail list logo