• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
TerminalでTwitter
 

TerminalでTwitter

on

  • 1,752 views

Perl Casual Talks#1 の発表資料です。

Perl Casual Talks#1 の発表資料です。
http://perl-casual.org/2009/11/casual-talks1-1.html

Statistics

Views

Total Views
1,752
Views on SlideShare
1,615
Embed Views
137

Actions

Likes
0
Downloads
2
Comments
0

4 Embeds 137

http://d.hatena.ne.jp 134
http://translate.googleusercontent.com 1
http://localhost 1
http://webcache.googleusercontent.com 1

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

TerminalでTwitter TerminalでTwitter Presentation Transcript

  • my $profile = { name => ' ', id => 'sugyan', age => 26, };
  • perl -MText::MeCab -MNet::Twitter -MEncode=encode_utf8 -e ' my $t = '''Net::Twitter'''->new('''username''', ''sugy an''', '''password''', '''******''');my $statuses = $t ->friends_timeline;my $status = $$statuses[rand @$statuses] ;my $text = encode_utf8($$status{'''text'''});my $user = $$status{'''user'''}{'''screen_name'''};$text =~ s/ [^ s]+ /z($&);/egmsx;$t->update("@$user 343201214350250 200343201243343201237: $text");sub z {my $text = shif t @_;my $zenra = "345205250350243270343201247";my $mecab = '''Text::MeCab'''->new;my $n = $mecab->parse($te xt);my $output = '''''';$n = $n->next while $n->next;my $ flg = 0;while (($n = $n->prev)->prev) {if ($flg) {my $inser t = 1;if ($n->feature =~ / A (345220215350251236|34 5211257350251236|345213225350251236) /msx) {$ins ert = 0;}elsif ($n->feature =~ / A 345212251(3452132 25)?350251236 /msx and (split(/,/, $n->prev->feature, 0) )[5] =~ / 351200243347224250 /msx) {$insert = 0;}if ( $insert) {$output = $zenra . $output;$flg = 0;}}$output = $ n->surface . $output;if ($n->feature =~ / A 3452132253 50251236 /msx) {$flg = 1;}}if ($flg) {$output = $zenra . $output;}return $output;}'