[Melbourne-pm] Facebook::Slurp, Filter::Self
Sam Watkins
sam at nipl.net
Mon Feb 8 20:25:17 PST 2010
hi,
I'm writing a program in Perl to incrementally "slurp" data from
facebook, to nice YAML and TSV files (like wget -c). It's not finished
yet but it is working for profile info and streams (your wall, others'
walls, status updates feed). I haven't got it to slurp comments yet.
The streams are presented as simple readable TSV files, for use with
grep, etc, having lines like this:
2010/02/06 01:03:54 Sam Watkins uploaded my first video to youtube, it's a funny thing I did with a flash game "Cargo Bridge" (armor games edition): http://www.youtube.com/watch?v=uguxuuAn4qo
The date comes first and is sortable! (unlike apache logs) so it's a
simple matter to merge several streams for example.
Thanks to PJF for his facebook example script which was very helpful
with getting started. I'll post again when I've finished it.
I also wrote Filter::Self last night, it uses Damien's Filter::Simple to
add some nicer OO / function call syntax to perl. This has I suppose
been done before, anyway you can do things like this:
this code: becomes:
---------- --------
print .name; print $self->{name};
.recalc($alpha); $self->recalc($alpha);
sub say($str) { sub say {
my ($str) = @_;
sub .recalc($alpha) { sub recalc {
my ($self, $alpha) = @_; shift;
print .foo.bar.baz; print $self->{foo}{bar}{baz};
I think that makes it a lot easier / briefer to do OO in perl, it's more
like java, actually sort of inspired by visual basic! I like this
syntax anyway. This is pretty much finished, and there is a tgz here:
http://sam.nipl.net/code/filter-self/
Please let me know what you think of it.
I also got a new job programming perl recently, which is good. I should
also try to get an author account or whatever on CPAN I guess.
Sam
More information about the Melbourne-pm
mailing list