@kyanny's blog

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

今日のPerlMonks

豊作。大漁。大杉。

  • 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?
超意訳:print文デバッグは便利なんだけど、ソースコードも一緒に出せる方法ない?
その後のやりとり:「Devel::Traceってのがあるよ」「Traceとは思いつかなかったわ」
ううむちょっと使ってみないとどんなモジュールなのかさっぱり。

  • *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
超意訳:モジュールのソース読んでたら*{$globref}{NAME}ってのがあったけど{NAME}ってなに?perlrefには{SCALAR}とかしか書いてないじゃん
その後のやりとり:「{NAME}ってやるとグロブの名前をさすんだよ」
フーン。確かに書いてみたらFOOって表示されるね。でもわからーん。

  • 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 = "==";
/(\d+).*/;
if ($num $eq $1) {
print "match\n";
}
}
超意訳:==みたいな演算子を変数で置換できねーのか?
そりゃ無理だろー。eval使ったらいけるかもしれんけど。

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.
あ、やっぱevalればいけるのね。あとは長いのであとで・・・

  • 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;
print;#88888888888daf23w""

超意訳:みんなみてみて!初めて作って投稿してみたよ!

おめでとう!本当におめでとう!こんなんでも投稿していいんだPerlMonks!俺も勇気が湧いてきたよ!

  • 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...

おいおい何の歌だよ(;´Д`)

タグとかいろいろ書き直さないと読めたもんじゃないな。