01 September 2006
This post may be outdated due to it was written on 2006. The links may be broken. The code may be not working anymore. Leave comments if needed.
as perfaq9, 我们可以通过如下代码得到本机的 IP 地址:
use Sys::Hostname;
use Socket;
my $host = hostname();
my $address = inet_ntoa( scalar gethostbyname( $host || 'localhost' ) );
print $address

PS, the previous post, the "single and find" one shows that ->single don't support order_by attribute, but ->find support it. :)

Want to get a session data by sessionid in Catalyst?
u can insert a seesion_id in TT by [% c.sessionid %]
code like:
my $sid = $c->req->param('sid');
$c->log->debug("sid is $sid");
my $session_data = $c->get_session_data("session:$sid");
return $c->res->body(Dumper($session_data));

don't forget the "seesion:" before $sid.

Good luck.

blog comments powered by Disqus