סPerlǤ
äϡEncodeΥХǤϤʤȤŦȡ
#!/usr/bin/env perl use v5.12; use warnings; use utf8; use Encode qw/find_encoding/; use CGI qw/escapeHTML/; my $enc = find_encoding('UTF-8'); my $q = CGI->new("E=MC2"); say escapeHTML($enc->decode($q->param('E'))); # ѥ¸ߤưΤ say escapeHTML($enc->decode($q->param('e'))); # ¸ߤʤưʤ
֤ʤ != undef
֤
㤦ΤǤPerlˤơ֤ʤȤundef
֤ȤϰۤʤΤǤ
ʲ
#!/usr/bin/env perl use v5.12; use warnings; use Carp; use CGI; use Data::Dumper; sub args { carp @_; return 0 + @_; } my $q = CGI->new("E=MC2"); say 'args($q->param("e")) == ', args($q->param("e")); say 'args($q->param("E")) == ', args($q->param("E")); say Dumper($q);
Ĥޤꡢ args($q->param("e"))
arg(undef)
ǤϤʤ arg()
ȤȤǤ
CGI.pmξϡȤФƤǤޤ
#!/usr/bin/env perl use v5.12; use warnings; use Carp; use CGI; use Data::Dumper; sub args { carp @_; return 0 + @_; } my $param = CGI->new("E=MC2")->Vars; say 'args($param->{"e"}) == ', args($param->{'e'}); say 'args($param->{"E"}) == ', args($param->{'E'}); say Dumper($param);
ǤϤʤCGI.pmϤͤˤʤäƤΤǤ礦?
Ǥʤȡ˺äƤޤΤǤ͡
#!/usr/bin/env perl use v5.12; use warnings; use Carp; use CGI; my $q = CGI->new("name=dan&name=kogai"); my @name = $q->param('name'); say join ", " => @name; my $name = $q->param('name'); say $name;
ĤޤꡢĤΥФʣͤꤨʤɤˡʣͤФʤʤä㤦Ȥ櫓Ǥ
ȤϤfunc(tion())
func()
ΰ tion()
ѤäƤޤȤΤϳΤDWIMȤϸ®٤ǤϤʤŻ뤷ˤϡĹˤʤʤ褦ǤϤʤϥåΥե֤褦ˤ褤Ǥ礦
Dan the Context-Driven Perl Monger
Υ֥˥ȤˤɬפǤ
εˤϵĥ桼ȤǤޤ