Net::Twitter->updateã®resãMojo::JSONã«éãã¨idããºã¬ã
Tweetã®IDã¯Mojo::JSONãéãéç¨ã§ä¸¸ãããã¦ãã¾ãäºããããã¨ãã話ã
use feature 'say'; use Net::Twitter; use Mojo::JSON 'j'; my $nt = Net::Twitter->new( ... ); my $res = $nt->update( scalar localtime ); say $res->{id}; => 362827222706438144 say j( j( $res ) )->{id}; => 3.62827222706438e+17
JSON ã«ãªã£ããã¼ã¿ãè¦ã¦ã¿ãã¨ç¹ã«ééã£ã¦ã¯ããªãã®ã§ã JSON -> hashref ã®å¤ææã«ä¸¸ã¾ãã®ã ã¨èãããããå¾ã£ã¦ãã®ãã¼ã¿ãå ã«Tweetãæ¢ãã¨ãæã£ãããã«åããªãã
解決ã¨ãã¦ã¯ã id_str ã使ãã°è¯ãã id_str ã¯ãã®åã®éãæååãªã®ã§ãæ°å¤ã¨ãã¦ä¸¸ãããããã¨ã¯ãªãã
say $res->{id}; => 362827222706438144 say j( j( $res ) )->{id_str}; => 362827222706438144
ç¹ã«ãå¾ãçµæã JSON ã§æ ¼ç´ãã¦ããã¨ããªã©ã«ãããããããããªããã¨ãããããã£ããã¨ããè¨é²ã