Skip to content

The 140 Character WebApp Disclaimer!

February 23, 2009

Re: my last blog post

Disclaimer – While its fun to play don’t go writing your webapps in non strict pigeon bad Perl like my post :)   And also remember to treat all input as dangerous and only output well formed HTML please!!

I’ve formatted the one liners below so that you can see what is going on (at least a bit better!)….

Squatting micro-twitter ( W.pm )…

package W;
use base 'Squatting';


package W::Controllers;
use Squatting':controllers';

@C = C ( 
  w => ['/'], 
  get => sub { 
    ($s) = @_;
    unshift @w, $s->input->{m};
    $s->v->{m} = \@w;
    $s->render('w')
  });


package W::Views;
use Squatting ':views';

@V = V( '',
  w => sub {
    my $r;
    $r .= "<hr>$_" for@{$_[1]->{m}};
    return '<form><input name=m>'.$r
  });

1;

Continuity micro-twitter...

use Continuity;
Continuity->new->loop;

sub main {
  ($r) = @_;
  while (1) {
    $r->print('<form><input name=m>');
    $r->print('<hr>',$_) for @b;
    $r->next;
    unshift @b, $r->param('m')
  }
}

Continuity micro-twitter (save state to file)...

use Continuity;
Continuity->new->loop;

sub main {
  ($r) = @_;
  while (1) {
    $r->print('<form><input name=m>');
    open F, '+<0';
    $r->print('<hr>',$_) for reverse <F>;
    $r->next;
    print F $r->param('m'), "\n"
  }
}

Continuity number counter Twitter compliant webapp!...

use Continuity;
Continuity->new->loop;

sub main {
  ($r) = @_;
  while (1) {
    $r->print('<form><input name=m>');
    $r->next;
    $x += $r->param('m');
    $r->print($x)
  }
}

When I get a mo I may post a "proper" Squatting micro-twitter webapp.

/I3az/

About these ads
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: