@kyanny's blog

My thoughts, my life. Views/opinions are my own.



  • Printing source code while running

As a lazy programmer, I want to debug without using the debugger or having to add print statements. In particular, it would be really nice if there was a way to have Perl print each line of the source code (in the package being debugged) as it runs, possibly along with the values of any variables used in that line. Something like stepping through code in the Perl debugger, except without having to step through code. Is such a thing possible?

  • *foo{THING}

In the source of Attribute::Handlers, I found *{$globref}{NAME}. I tried to find documentation on that, but failed.
I know about *foo{THING} in "perlref", but it only describes

  • Protecting passwords in source

This maybe a jr. perl user question. But you guys were really helpful with the my last problem. anyways to the question. Is their any way to encrypt passwords within your code for example:
$password = "password";

  • Is it possible to store an arthimetric operator in a variable?

while (<>) {
$num ="2";
$eq = "==";
if ($num $eq $1) {
print "match\n";

you would need to eval that statement before it would actually work. You are trying to interpolate a variable and then interpolate the result of that variable.

  • Looking for syntactic shortcut

@tmp = function($param);
$elem = $tmp[5]
return \@array;って返してやって$elem = @{$tmp}[5];とかやったら・・・それともwantarrayとか使うともっと綺麗になるのかしら。詳しく読んでない。

  • Repenting after giving bad advice.

I was reflecting upon some bad advice I had just given. Trying to avoid doing that again, I re-read brian_d_foy's excellent brian's Guide to Solving Any Perl Problem. Besides being a great node to reflect upon, I noticed it was the node's birthday - Brian posted it exactly one year ago today

Happy node-day brian's Guide to Solving Any Perl Problem. Join me in giving the node a re-read as a present.



  • Perl World

My first obfuscated code (and my first post to PerlMonks). Not that good (and I'm open to suggestions), but I'm happy with it (for my first one).

$_=q 34727115116117
9201111161 140110141108210
141180140179299270110 1411 3
;s/ \s//gx;$_= reverse
;@b =$_=~/\d{3} /gx; for
(@b) {if(substr($_ ,0,1)== 2)
{ $_=substr($_,1);} $_ =
chr ($_);}$_=reverse# "" `8,
( join "",@b);#" `b
# 'Perl_World' 8
# by~ _ " 8
# zshzn "X a 8
# -----,_____ 8
@a= qw 9 4 12 17 9;
#8, 888888888888' ,8'
for #888888888I a8'
$x (@a){substr #P'
($_ ,$x,0)=#8 dY"
" ";} $_.=",\n" ;#"'
undef @a;undef @b;



  • I'm a Believer, improved

I used to think I would never grasp this Perl
all that code looked like Chinese to me
I did almost give up
so close to quitting Vi
oh, why didn't I just stay with C...

Now I've become a Monk
and it feels like I'm dreaming
Regex's are
not a problem for me
I'm a Monk (hey!)
And I wouldn't have been
without the CeeBee

I hang out there daily, it's a holy place
filled with people of diversity
you can ask your questions
watch, read, learn and see
you will soon write great Perl Code in Vi

Yeah I'm a Perl Monk (hey!)
I wear my robe proudly
Writing great code
Now almost daily
And if I just
will keep on learning
Someday I will be a Saint, you'll see...