Changeset 1513

Show
Ignore:
Timestamp:
11/14/07 23:59:36 (6 years ago)
Author:
charsbar
Message:

lang/perl/Jipotter: added clear_sessions command, which would vacuum more than half of the jipotter db

Location:
lang/perl/Jipotter/trunk
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/Jipotter/trunk/MANIFEST

    r1433 r1513  
    1919lib/Jipotter/Script.pm 
    2020lib/Jipotter/Script/Aggregate.pm 
     21lib/Jipotter/Script/ClearSessions.pm 
    2122lib/Jipotter/Script/Schema.pm 
    2223lib/Jipotter/Script/Server.pm 
  • lang/perl/Jipotter/trunk/META.yml

    r1433 r1513  
    2525  Jifty: 0.70824 
    2626  Jifty::DBI: 0.46 
     27  String::CamelCase: 0 
    2728  Template::Declare: 0.27 
    2829  Time::Piece: 0 
     30  Time::Seconds: 0 
    2931  URI: 0 
    3032  WWW::Shorten::TinyURL: 0 
  • lang/perl/Jipotter/trunk/Makefile.PL

    r1433 r1513  
    1111requires    'DateTime::Format::Strptime'; 
    1212requires    'HTML::Entities'; 
     13requires    'String::CamelCase'; 
    1314requires    'Time::Piece'; 
     15requires    'Time::Seconds'; 
    1416requires    'WWW::Shorten::TinyURL'; 
    1517requires    'URI'; 
  • lang/perl/Jipotter/trunk/etc/site_config.yml.sample

    r1436 r1513  
    22  Plugins: 
    33    - Jipotter::Plugin::Timelines: 
    4         items_per_page: 20 
    5  
    64        Twitter: 
    75          username: your_name 
     
    1614          username: your_name 
    1715          password: your_password 
     16 
     17  Session: 
     18    expire: 3 
    1819 
    1920  Web:  
  • lang/perl/Jipotter/trunk/lib/Jipotter/Script.pm

    r1366 r1513  
    44use warnings; 
    55use base qw( Jifty::Script ); 
     6use String::CamelCase qw( camelize ); 
     7 
     8sub get_cmd { 
     9    my ($class, $cmd, @arg) = @_; 
     10    die $class->error_cmd 
     11        unless $cmd && $cmd =~ m/^[?a-z_]+$/; 
     12    my $pkg = join('::', $class->command_class, $class->_cmd_map ($cmd)); 
     13    my $file = "$pkg.pm"; 
     14    $file =~ s!::!/!g; 
     15 
     16    unless (eval {require $file; 1} and $pkg->can('run')) { 
     17        warn $@ if $@ and exists $INC{$file}; 
     18        die $class->error_cmd; 
     19    } 
     20    $cmd = $pkg->new (@arg); 
     21    $cmd->app ($class); 
     22    return $cmd; 
     23} 
     24 
     25sub _cmd_map { 
     26    my ($pkg, $cmd) = @_; 
     27    my %alias = $pkg->alias; 
     28    return $alias{$cmd} if exists $alias{$cmd}; 
     29    return camelize($cmd); 
     30} 
    631 
    7321;