[Melbourne-pm] Facebook::Slurp, Filter::Self

Drew Taylor drew at drewtaylor.com
Tue Feb 9 01:30:22 PST 2010


I'm not in Melbourne (give me a few years), but I thought I'd put in my
€0.02.

You might also want to look into Moose and/or MooseX::Declare. Mx::D gives
you some nice syntax for defining methods and the parameters passed, while
Moose gives you a nicer OO interface.

Regarding source filtering, Just Don't Do It. Ricardo Signes' review of
Filter::Simple says it all: "Don't write source filters. They will make your
momma cry." Moose (or perhaps Devel::Declare if you want to go really
low-level) is a much better way to achieve the same effect and keep you
sane. :-)

Drew

On Tue, Feb 9, 2010 at 4:25 AM, Sam Watkins <sam at nipl.net> wrote:

> 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/
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/melbourne-pm/attachments/20100209/b1898846/attachment.html>


More information about the Melbourne-pm mailing list