circle-be

 view release on metacpan or  search on metacpan

lib/Circle/Command.pm  view on Meta::CPAN

}

sub name
{
   my $self = shift; return $self->{name};
}

sub shortname
{
   my $self = shift;
   ( split m/ /, $self->name )[-1];
}

sub is_default
{
   my $self = shift; return $self->{Command_default};
}

sub desc
{
   my $self = shift; return $self->{Command_description}[0] || "[no description]";

lib/Circle/Loggable.pm  view on Meta::CPAN

   M => 1,
   S => 0,
);

# Returns a LogId and a LogCtx
sub split_logpath
{
   my $self = shift;
   my ( $time ) = @_;

   my @pcs = split m{/}, $self->enumerable_path;
   shift @pcs; # trim leading /
   @pcs or @pcs = ( "Global" );
   my $path_used = 0;
   my %ts_used = map { $_ => 0 } qw( Y m d H M );

   my @timestamp = localtime $time;

   my %formats = (
      # Specific kinds of time format so we can track the granulity being used
      ( map {

lib/Circle/Net/IRC/Target.pm  view on Meta::CPAN


   my $is_action = $event->{is_action};

   my $maxlen = 510 -
      # To work out the maximum message length size we'd need to know our own
      # prefix that the server will send. We can't know the host, but we know
      # everything else. Just pretend it's maximal length, 64
      ( length( $irc->{nick} ) + length( $irc->{user} ) + 64 + PREFIX_OVERHEAD );
   my $target = $self->name;

   foreach my $line ( split m/\n/, $event->{text}->str ) {
      if( $is_action ) {
         _split_text_chunks( $line, $maxlen - length($target) - CTCP_ACTION_OVERHEAD, sub {
            $irc->send_ctcp( undef, $target, "ACTION", $_[0] );
         });
      }
      else {
         _split_text_chunks( $line, $maxlen - length($target) - PRIVMSG_OVERHEAD, sub {
            $irc->send_message( "PRIVMSG", undef, $target, $_[0] );
         });
      }

lib/Circle/RootObj.pm  view on Meta::CPAN

      my $err = $@; chomp $err;
      $cinv->responderr( "Died: $err" );
   }
   else {
      my @lines;

      my $timedout;
      local $SIG{ALRM} = sub { $timedout = 1; die };
      eval {
         alarm(5);
         @lines = split m/\n/, Data::Dump::dump($result);
         alarm(0);
      };

      if( $timedout ) {
         $cinv->responderr( "Failed - took too long to render results. Try something more specific" );
         return;
      }

      if( @lines > 20 ) {
         @lines = ( @lines[0..18], "...", $lines[-1] );

lib/Circle/RootObj.pm  view on Meta::CPAN

   # Since we're only showing config, only fetch it for the invocant
   my $obj = $cinv->invocant;

   unless( $obj->can( "get_configuration" ) ) {
      $cinv->respond( "No configuration" );
      return;
   }

   my $config = YAML::Dump( $obj->get_configuration );

   $cinv->respond( $_ ) for split m/\n/, $config;
   return;
}

sub command_config_save
   : Command_description("Save configuration to disk")
   : Command_subof('config')
{
   my $self = shift;
   my ( $cinv ) = @_;



( run in 0.884 second using v1.01-cache-2.11-cpan-71847e10f99 )