Browse Source

mass tidy

George Baugh 2 years ago
parent
commit
ffda9456e4

+ 19 - 18
bin/tcms-useradd

@@ -62,24 +62,23 @@ Display this output.
 
 sub main {
     my %options;
-    Getopt::Long::GetOptionsFromArray(\@_,
-        'user=s'            => \$options{user},
-        'display_name=s'    => \$options{display_name},
-        'help|?'            => \$options{help},
-        'password=s'        => \$options{password},
-        'contact_email=s'   => \$options{contact_email},
-        'acl=s@'           => \$options{acl},
+    Getopt::Long::GetOptionsFromArray(
+        \@_,
+        'user=s'          => \$options{user},
+        'display_name=s'  => \$options{display_name},
+        'help|?'          => \$options{help},
+        'password=s'      => \$options{password},
+        'contact_email=s' => \$options{contact_email},
+        'acl=s@'          => \$options{acl},
     );
-    pod2usage(-exitval => 0, -verbose => 1) if $options{help};
+    pod2usage( -exitval => 0, -verbose => 1 ) if $options{help};
 
     $options{acl} //= [];
-    $options{acl} = [$options{acl}] if $options{acl} && ref $options{acl} ne 'ARRAY';
-    $options{acl} = ['admin'] unless @{$options{acl}};
+    $options{acl} = [ $options{acl} ] if $options{acl} && ref $options{acl} ne 'ARRAY';
+    $options{acl} = ['admin'] unless @{ $options{acl} };
 
-    Trog::Auth::killsession($options{user});
-    eval {
-        Trog::Auth::useradd( $options{user}, $options{display_name}, $options{password}, $options{acl}, $options{contact_email} )
-    } or do {
+    Trog::Auth::killsession( $options{user} );
+    eval { Trog::Auth::useradd( $options{user}, $options{display_name}, $options{password}, $options{acl}, $options{contact_email} ) } or do {
         return 1;
     };
 
@@ -87,19 +86,21 @@ sub main {
     my $conf = Trog::Config::get();
     my $data = Trog::Data->new($conf);
 
-    my @userposts = $data->get( tags => ['about'], acls => [qw{admin}]);
-    my $user_obj = first { ($_->{user} || '') eq $options{user} } @userposts;
-    my %merged = (
+    my @userposts = $data->get( tags => ['about'], acls => [qw{admin}] );
+    my $user_obj  = first { ( $_->{user} || '' ) eq $options{user} } @userposts;
+    my %merged    = (
         %$user_obj,
         %options,
         $options{display_name} ? ( local_href => "/users/$options{display_name}" ) : ( local_href => $user_obj->{local_href} ),
     );
+
     # We don't want the password in plain text
     delete $merged{password};
+
     # The ACLs a user posesses is not necessarily what ACLs you need to view a user's profile.
     delete $merged{acl};
 
-    $data->add(\%merged);
+    $data->add( \%merged );
     return 0;
 }
 

+ 4 - 4
bin/totp

@@ -11,10 +11,10 @@ use Trog::Config;
 my $user   = shift @ARGV;
 my $domain = Trog::Config->get()->param('general.hostname');
 
-die "Must provide a user"   unless $user;
+die "Must provide a user"                   unless $user;
 die "Must Set domain in configuration file" unless $domain;
 
-my ( $uri, $qr, $failure, $message, $totp ) = Trog::Auth::totp($user,$domain);
+my ( $uri, $qr, $failure, $message, $totp ) = Trog::Auth::totp( $user, $domain );
 print "TOTP URI: $uri\n";
-print "Secret: ".$totp->base32secret()."\n";
-print "Current Auth code: ".$totp->expected_totp_code( time ) . "\n";
+print "Secret: " . $totp->base32secret() . "\n";
+print "Current Auth code: " . $totp->expected_totp_code(time) . "\n";

+ 1 - 1
lib/TCMS.pm

@@ -372,7 +372,7 @@ sub _toolong ($query) {
 }
 
 sub _error ($query) {
-    $query->{method} //= "UNKNOWN";
+    $query->{method}   //= "UNKNOWN";
     $query->{fullpath} //= $query->{route} // '/?';
     INFO("$query->{method} 500 $query->{fullpath}");
     return _generic( 'error', $query );

+ 9 - 10
lib/Trog/Auth.pm

@@ -79,8 +79,8 @@ Fetch existing settings for a user.
 sub get_existing_user_data ($user) {
     my $dbh  = _dbh();
     my $rows = $dbh->selectall_arrayref( "SELECT hash, salt, totp_secret, display_name, contact_email FROM user WHERE name=?", { Slice => {} }, $user );
-    return (undef,undef, undef) unless ref $rows eq 'ARRAY' && @$rows;
-    return ($rows->[0]{hash}, $rows->[0]{salt}, $rows->[0]{totp_secret}, $rows->[0]{display_name}, $rows->[0]{contact_email});
+    return ( undef, undef, undef ) unless ref $rows eq 'ARRAY' && @$rows;
+    return ( $rows->[0]{hash}, $rows->[0]{salt}, $rows->[0]{totp_secret}, $rows->[0]{display_name}, $rows->[0]{contact_email} );
 }
 
 =head2 email4user(STRING username) = STRING
@@ -184,7 +184,7 @@ sub totp ( $user, $domain ) {
             level         => 'L',
             casesensitive => 1,
             lightcolor    => Imager::Color->new( 255, 255, 255 ),
-            darkcolor     => Imager::Color->new( 0,   0,   0 ),
+            darkcolor     => Imager::Color->new( 0, 0, 0 ),
         );
 
         my $img = $qrcode->plot($uri);
@@ -193,7 +193,6 @@ sub totp ( $user, $domain ) {
     return ( $uri, $qr, $failure, $message, $totp );
 }
 
-
 sub _totp {
     state $totp;
     if ( !$totp ) {
@@ -250,7 +249,7 @@ sub mksession ( $user, $pass, $token ) {
         $totp->{secret} = $secret;
         my $rc = $totp->validate_otp( otp => $token, secret => $secret, tolerance => 3, period => 30, digits => 6 );
         INFO("TOTP Auth failed for user $user") unless $rc;
-        return ''                               unless $rc;
+        return '' unless $rc;
     }
 
     # Issue cookie
@@ -283,23 +282,23 @@ Returns True or False (likely false when user already exists).
 sub useradd ( $user, $displayname, $pass, $acls, $contactemail ) {
 
     # See if the user exists already, keep pw if nothing's passed
-    my ($hash, $salt, $t_secret, $dn, $ce) = get_existing_user_data($user);
+    my ( $hash, $salt, $t_secret, $dn, $ce ) = get_existing_user_data($user);
     $displayname  //= $dn;
     $contactemail //= $ce;
 
     die "No username set!"     unless $user;
     die "No display name set!" unless $displayname;
     die "Username and display name cannot be the same" if $user eq $displayname;
-    die "No password set for user!"      if !$pass && !$hash;
-    die "ACLs must be array"             unless is_arrayref($acls);
+    die "No password set for user!"                    if !$pass && !$hash;
+    die "ACLs must be array" unless is_arrayref($acls);
     die "No contact email set for user!" unless $contactemail;
 
-    my $dbh  = _dbh();
+    my $dbh = _dbh();
     if ($pass) {
         $salt = Trog::Utils::uuid();
         $hash = sha256( $pass . $salt );
     }
-    my $res  = $dbh->do( "INSERT OR REPLACE INTO user (name, display_name, salt, hash, contact_email, totp_secret) VALUES (?,?,?,?,?,?)", undef, $user, $displayname, $salt, $hash, $contactemail, $t_secret );
+    my $res = $dbh->do( "INSERT OR REPLACE INTO user (name, display_name, salt, hash, contact_email, totp_secret) VALUES (?,?,?,?,?,?)", undef, $user, $displayname, $salt, $hash, $contactemail, $t_secret );
     return unless $res && ref $acls eq 'ARRAY';
 
     #XXX this is clearly not normalized with an ACL mapping table, will be an issue with large number of users

+ 2 - 2
lib/Trog/Config.pm

@@ -21,9 +21,9 @@ our $home_cfg = "config/main.cfg";
 
 sub get {
     state $cf;
-    return $cf                           if $cf;
+    return $cf if $cf;
     $cf = Config::Simple->new($home_cfg) if -f $home_cfg;
-    return $cf                           if $cf;
+    return $cf if $cf;
     $cf = Config::Simple->new('config/default.cfg');
     return $cf;
 }

+ 62 - 55
lib/Trog/DataModule.pm

@@ -50,12 +50,12 @@ sub new ( $class, $config ) {
 }
 
 #It is required that subclasses implement this
-sub lang  ($self)                { ... }
-sub help  ($self)                { ... }
-sub read  ( $self, $query = {} ) { ... }
-sub write ($self)                { ... }
-sub count ($self)                { ... }
-sub tags  ($self)                { ... }
+sub lang ($self)                { ... }
+sub help ($self)                { ... }
+sub read ( $self, $query = {} ) { ... }
+sub write ($self)               { ... }
+sub count ($self)               { ... }
+sub tags ($self)                { ... }
 
 =head1 METHODS
 
@@ -109,8 +109,8 @@ sub _fixup ( $self, @filtered ) {
             $subj->{$param} =~ s/ /%20/g;
         }
 
-        $user2display{$subj->{user}} //= Trog::Auth::username2display( $subj->{user} );
-        $subj->{display_name} = $user2display{$subj->{user}};
+        $user2display{ $subj->{user} } //= Trog::Auth::username2display( $subj->{user} );
+        $subj->{display_name} = $user2display{ $subj->{user} };
 
         #XXX Add dynamic routing data for posts which don't have them (/posts/$id) and (/users/$user)
         my $is_user_page = List::Util::any { $_ eq 'about' } @{ $subj->{tags} };
@@ -119,7 +119,7 @@ sub _fixup ( $self, @filtered ) {
 
             #XXX this needs to be correctly populated in the form?
             if ($is_user_page) {
-                my $display_name = $user2display{$subj->{user}};
+                my $display_name = $user2display{ $subj->{user} };
                 die "No display name for user!" unless $display_name;
                 $subj->{local_href} = "/users/$display_name";
             }
@@ -131,8 +131,8 @@ sub _fixup ( $self, @filtered ) {
 
         $subj->{method} = 'GET' unless exists( $subj->{method} );
 
-        $subj->{user_class}   = $user2display{$subj->{user}};
-        $subj->{user_class}   =~ tr/ /_/ if $subj->{user_class};
+        $subj->{user_class} = $user2display{ $subj->{user} };
+        $subj->{user_class} =~ tr/ /_/ if $subj->{user_class};
 
         $subj
     } @filtered;
@@ -178,7 +178,7 @@ sub filter ( $self, $query, @filtered ) {
         grep {
             my $t = $_;
             grep { $t eq $_ } @{ $query->{tags} }
-        } @$tags
+          } @$tags
     } @filtered if @{ $query->{tags} };
 
     # Filter posts *matching* the passed exclude_tag(s), if any
@@ -187,7 +187,7 @@ sub filter ( $self, $query, @filtered ) {
         !grep {
             my $t = $_;
             grep { $t eq $_ } @{ $query->{exclude_tags} }
-        } @$tags
+          } @$tags
     } @filtered if @{ $query->{exclude_tags} };
 
     # Filter posts without the proper ACLs
@@ -196,7 +196,7 @@ sub filter ( $self, $query, @filtered ) {
         grep {
             my $t = $_;
             grep { $t eq $_ } @{ $query->{acls} }
-        } @$tags
+          } @$tags
     } @filtered unless grep { $_ eq 'admin' } @{ $query->{acls} };
 
     @filtered = grep { $_->{title} =~ m/\Q$query->{like}\E/i || $_->{data} =~ m/\Q$query->{like}\E/i } @filtered if $query->{like};
@@ -265,75 +265,82 @@ You probably won't want to override this.
 =cut
 
 my $not_ref = sub {
-	return !Ref::Util::is_ref(shift);
+    return !Ref::Util::is_ref(shift);
 };
 
 my $valid_cb = sub {
-	my $subname = shift;
-	my ($modname) = $subname =~ m/^([\w|:]+)::\w+$/;
-	eval {
-		require $modname;
-	} or do {
-		WARN("Post uses a callback whos module cannot be found!");	
-		return 0;
-	};
-
-	no strict 'refs';
-	my $ref = eval '\&'.$subname;
-	use strict;
-	return is_coderef($ref);
+    my $subname = shift;
+    my ($modname) = $subname =~ m/^([\w|:]+)::\w+$/;
+    eval { require $modname; } or do {
+        WARN("Post uses a callback whos module cannot be found!");
+        return 0;
+    };
+
+    no strict 'refs';
+    my $ref = eval '\&' . $subname;
+    use strict;
+    return is_coderef($ref);
 };
 
 # TODO more strict validation of strings?
 our %schema = (
     ## Parameters which must be in every single post
-	'title' => $not_ref,
-	'callback' => $valid_cb,
-	'tags' => \&Ref::Util::is_arrayref,
-	'version' => $not_ref,
-	'visibility' => $not_ref,
-	'aliases' => \&Ref::Util::is_arrayref,
-    'tiled'   => $not_ref,
+    'title'      => $not_ref,
+    'callback'   => $valid_cb,
+    'tags'       => \&Ref::Util::is_arrayref,
+    'version'    => $not_ref,
+    'visibility' => $not_ref,
+    'aliases'    => \&Ref::Util::is_arrayref,
+    'tiled'      => $not_ref,
+
     # title links here
     'href' => $not_ref,
+
     # Link to post locally
-	'local_href' => $not_ref,
+    'local_href' => $not_ref,
+
     # Post body
-	'data' => $not_ref,
+    'data' => $not_ref,
+
     # How do I edit this post?
-	'form' => $not_ref,
+    'form' => $not_ref,
+
     # Post is restricted to visibility to these ACLs if not public/unlisted
     'acls' => \&Ref::Util::is_arrayref,
-	'id' => $not_ref,
+    'id'   => $not_ref,
+
     # Author of the post
-	'user' => $not_ref,
-	'created' => $not_ref,
+    'user'    => $not_ref,
+    'created' => $not_ref,
     ## Series specific parameters
     'child_form' => $not_ref,
     'aclname'    => $not_ref,
     ## User specific parameters
-	'user_acls' => \&Ref::Util::is_arrayref,
-    'username'  => $not_ref,
-    'display_name' => $not_ref,
-    'contact_email' => $not_ref,
+    'user_acls'      => \&Ref::Util::is_arrayref,
+    'username'       => $not_ref,
+    'display_name'   => $not_ref,
+    'contact_email'  => $not_ref,
     'wallpaper_file' => $not_ref,
+
     # user avatar, but does double duty in content posts as preview images on videos, etc
     'preview_file' => $not_ref,
     ## Content specific parameters
     'audio_href' => $not_ref,
     'video_href' => $not_ref,
-    'file' => $not_ref,
+    'file'       => $not_ref,
 );
 
 sub add ( $self, @posts ) {
     my @to_write;
 
     foreach my $post (@posts) {
-		# Filter all the irrelevant data
-		foreach my $key (keys(%$post)) {
-			# We need to have the key in the schema, and it validate.
-			delete $post->{$key} unless List::Util::any { ($_ eq $key) && ($schema{$key}->($post->{$key})) } keys(%schema);
-		}
+
+        # Filter all the irrelevant data
+        foreach my $key ( keys(%$post) ) {
+
+            # We need to have the key in the schema, and it validate.
+            delete $post->{$key} unless List::Util::any { ( $_ eq $key ) && ( $schema{$key}->( $post->{$key} ) ) } keys(%schema);
+        }
 
         $post->{id}      //= Trog::Utils::uuid();
         $post->{aliases} //= [];
@@ -387,7 +394,7 @@ sub _process ($post) {
     $post->{href}      = _handle_upload( $post->{file},           $post->{id} ) if $post->{file};
     $post->{preview}   = _handle_upload( $post->{preview_file},   $post->{id} ) if $post->{preview_file};
     $post->{wallpaper} = _handle_upload( $post->{wallpaper_file}, $post->{id} ) if $post->{wallpaper_file};
-    $post->{preview}   = $post->{href} if $post->{app} && $post->{app} eq 'image';
+    $post->{preview} = $post->{href} if $post->{app} && $post->{app} eq 'image';
     delete $post->{app};
     delete $post->{file};
     delete $post->{preview_file};
@@ -436,9 +443,9 @@ sub _process ($post) {
     }
     $post->{content_type} ||= 'text/html';
 
-    $post->{is_video}   = 1 if $post->{content_type} =~ m/^video\//;
-    $post->{is_audio}   = 1 if $post->{content_type} =~ m/^audio\//;
-    $post->{is_image}   = 1 if $post->{content_type} =~ m/^image\//;
+    $post->{is_video} = 1 if $post->{content_type} =~ m/^video\//;
+    $post->{is_audio} = 1 if $post->{content_type} =~ m/^audio\//;
+    $post->{is_image} = 1 if $post->{content_type} =~ m/^image\//;
     $post->{is_profile} = 1 if grep { $_ eq 'about' } @{ $post->{tags} };
 
     return $post;

+ 1 - 1
lib/Trog/FileHandler.pm

@@ -33,7 +33,7 @@ sub serve ( $fullpath, $path, $start, $streaming, $ranges, $last_fetch = 0, $def
     my $ft;
     if ($ext) {
         $ft = Plack::MIME->mime_type($ext) if $ext;
-        $ft ||= $extra_types{$ext}         if exists $extra_types{$ext};
+        $ft ||= $extra_types{$ext} if exists $extra_types{$ext};
     }
     $ft ||= $Trog::Vars::content_types{text};
 

+ 2 - 2
lib/Trog/Renderer.pm

@@ -54,8 +54,8 @@ sub render ( $class, %options ) {
     $renderer = $renderers{$rendertype};
     return _yeet( $renderer, "Renderer for $rendertype is not defined!", %options ) unless $renderer;
     return _yeet( $renderer, "Status code not provided",                 %options ) if !$options{code} && !$options{component};
-    return _yeet( $renderer, "Template data not provided",               %options ) unless $options{data};
-    return _yeet( $renderer, "Template not provided",                    %options ) unless $options{template};
+    return _yeet( $renderer, "Template data not provided", %options ) unless $options{data};
+    return _yeet( $renderer, "Template not provided",      %options ) unless $options{template};
 
     #TODO future - save the components too and then compose them?
     my $skip_save = !$options{component} || !$options{data}{route} || $options{data}{has_query} || $options{data}{user} || ( $options{code} // 0 ) != 200 || Trog::Log::is_debug();

+ 1 - 1
lib/Trog/Renderer/Base.pm

@@ -71,7 +71,7 @@ sub render (%options) {
 
 sub headers ( $options, $body ) {
     my $query   = $options->{data};
-    my $uh      = ref $options->{headers} eq 'HASH'      ? $options->{headers}        : {};
+    my $uh      = ref $options->{headers} eq 'HASH' ? $options->{headers} : {};
     my $ct      = $options->{contenttype} eq 'text/html' ? "text/html; charset=UTF-8" : "$options->{contenttype};";
     my %headers = (
         'Content-Type'           => $ct,

+ 24 - 24
lib/Trog/Routes/HTML.pm

@@ -282,11 +282,11 @@ sub index ( $query, $content = '', $i_styles = [] ) {
     my $categorybar = Trog::Renderer->render( template => $categorybar, data => { %$query, categories => \@series }, component => 1, contenttype => 'text/html' );
     return $categorybar if ref $categorybar eq 'ARRAY';
 
-	# Grab the avatar class for the logged in user
-	if ($query->{user}) {
-		$query->{user_class} = Trog::Auth::username2display($query->{user});
-		$query->{user_class} =~ tr/ /_/;
-	}
+    # Grab the avatar class for the logged in user
+    if ( $query->{user} ) {
+        $query->{user_class} = Trog::Auth::username2display( $query->{user} );
+        $query->{user_class} =~ tr/ /_/;
+    }
 
     return finish_render(
         $tmpl,
@@ -308,7 +308,7 @@ sub index ( $query, $content = '', $i_styles = [] ) {
             stylesheets  => \@styles,
             print_styles => \@p_styles,
             show_madeby  => $Theme::show_madeby ? 1 : 0,
-            embed        => $query->{embed}     ? 1 : 0,
+            embed        => $query->{embed} ? 1 : 0,
             embed_video  => $query->{primary_post}{is_video},
             default_tags => $default_tags,
             meta_desc    => $meta_desc,
@@ -368,7 +368,7 @@ sub _build_social_meta ( $query, $title ) {
     my $social = HTML::SocialMeta->new(%sopts);
     $meta_tags = eval { $social->create($card_type) };
     $meta_tags =~ s/content="video"/content="video:other"/mg if $meta_tags;
-    $meta_tags .= $extra_tags                                if $extra_tags;
+    $meta_tags .= $extra_tags if $extra_tags;
 
     print STDERR "WARNING: Theme misconfigured, social media tags will not be included\n$@\n" if $Trog::Themes::theme_dir && !$meta_tags;
     return ( $default_tags, $meta_desc, $meta_tags );
@@ -650,7 +650,7 @@ Renders the configuration page, or redirects you back to the login page.
 =cut
 
 sub config ( $query = {} ) {
-    return see_also('/login')                    unless $query->{user};
+    return see_also('/login') unless $query->{user};
     return Trog::Routes::HTML::forbidden($query) unless grep { $_ eq 'admin' } @{ $query->{user_acls} };
 
     $query->{failure} //= -1;
@@ -658,10 +658,10 @@ sub config ( $query = {} ) {
     #XXX ACHTUNG config::simple has this brain damaged behavior of returning a multiple element array when you access something that does not exist.
     #XXX straight up dying would be preferrable.
     #XXX anyways, this means you can NEVER NEVER NEVER access a param from within a hash directly.  YOU HAVE BEEN WARNED!
-    state $theme  = $conf->param('general.theme')              // '';
-    state $dm     = $conf->param('general.data_model')         // 'DUMMY';
-    state $embeds = $conf->param('security.allow_embeds_from') // '';
-    state $hostname = $conf->param('general.hostname') // '';
+    state $theme    = $conf->param('general.theme')              // '';
+    state $dm       = $conf->param('general.data_model')         // 'DUMMY';
+    state $embeds   = $conf->param('security.allow_embeds_from') // '';
+    state $hostname = $conf->param('general.hostname')           // '';
 
     return Trog::Routes::HTML::index(
         {
@@ -681,7 +681,7 @@ sub config ( $query = {} ) {
             is_admin           => 1,
             template           => 'config.tx',
             %$query,
-            hostname           => $hostname,
+            hostname => $hostname,
         },
         undef,
         [qw{config.css}],
@@ -805,7 +805,7 @@ Implements /config/save route.  Saves what little configuration we actually use
 =cut
 
 sub config_save ($query) {
-    return see_also('/login')                    unless $query->{user};
+    return see_also('/login') unless $query->{user};
     return Trog::Routes::HTML::forbidden($query) unless grep { $_ eq 'admin' } @{ $query->{user_acls} };
 
     $conf->param( 'general.theme',              $query->{theme} )      if defined $query->{theme};
@@ -833,7 +833,7 @@ Clone a theme by copying a directory.
 =cut
 
 sub themeclone ($query) {
-    return see_also('/login')                    unless $query->{user};
+    return see_also('/login') unless $query->{user};
     return Trog::Routes::HTML::forbidden($query) unless grep { $_ eq 'admin' } @{ $query->{user_acls} };
 
     my ( $theme, $newtheme ) = ( $query->{theme}, $query->{newtheme} );
@@ -857,7 +857,7 @@ Saves posts submitted via the /post pages
 =cut
 
 sub post_save ($query) {
-    return see_also('/login')                    unless $query->{user};
+    return see_also('/login') unless $query->{user};
     return Trog::Routes::HTML::forbidden($query) unless grep { $_ eq 'admin' } @{ $query->{user_acls} };
 
     my $to = delete $query->{to};
@@ -890,7 +890,7 @@ Saves / updates new users.
 =cut
 
 sub profile ($query) {
-    return see_also('/login')                    unless $query->{user};
+    return see_also('/login') unless $query->{user};
     return Trog::Routes::HTML::forbidden($query) unless grep { $_ eq 'admin' } @{ $query->{user_acls} };
 
     #TODO allow new users to do something OTHER than be admins
@@ -914,7 +914,7 @@ deletes posts.
 =cut
 
 sub post_delete ($query) {
-    return see_also('/login')                    unless $query->{user};
+    return see_also('/login') unless $query->{user};
     return Trog::Routes::HTML::forbidden($query) unless grep { $_ eq 'admin' } @{ $query->{user_acls} };
 
     $data->delete($query) and die "Could not delete post";
@@ -1042,7 +1042,7 @@ sub posts ( $query, $direct = 0 ) {
     my $is_admin = grep { $_ eq 'admin' } @{ $query->{user_acls} };
     push( @{ $query->{user_acls} }, 'public' );
     push( @{ $query->{user_acls} }, 'unlisted' ) if $query->{id};
-    push( @{ $query->{user_acls} }, 'private' )  if $is_admin;
+    push( @{ $query->{user_acls} }, 'private' ) if $is_admin;
     my @posts;
 
     # Discover this user's visibility, so we can make them post in this category by default
@@ -1244,7 +1244,7 @@ sub _post_helper ( $query, $tags, $acls ) {
     return $data->get(
         older        => $query->{older},
         newer        => $query->{newer},
-        page         => int( $query->{page}  || 1 ),
+        page         => int( $query->{page} || 1 ),
         limit        => int( $query->{limit} || 25 ),
         tags         => $tags,
         exclude_tags => $query->{exclude_tags},
@@ -1398,8 +1398,8 @@ sub sitemap ($query) {
     @to_map = sort @to_map unless $is_index;
     my $styles = ['sitemap.css'];
 
-    $query->{title}    = "$query->{domain} : Sitemap";
-    $query->{template} = 'sitemap.tx',
+    $query->{title}        = "$query->{domain} : Sitemap";
+    $query->{template}     = 'sitemap.tx',
       $query->{to_map}     = \@to_map,
       $query->{is_index}   = $is_index,
       $query->{route_type} = $route_type,
@@ -1479,7 +1479,7 @@ Basically a thin wrapper around Pod::Html.
 =cut
 
 sub manual ($query) {
-    return see_also('/login')                    unless $query->{user};
+    return see_also('/login') unless $query->{user};
     return Trog::Routes::HTML::forbidden($query) unless grep { $_ eq 'admin' } @{ $query->{user_acls} };
 
     require Pod::Html;
@@ -1544,7 +1544,7 @@ sub rss_style ($query) {
 }
 
 sub _build_themed_styles ($styles) {
-    my @styles = map { (Trog::Themes::themed_style("$_")) } @{ Trog::Utils::coerce_array($styles) };
+    my @styles = map { ( Trog::Themes::themed_style("$_") ) } @{ Trog::Utils::coerce_array($styles) };
     return \@styles;
 }
 

+ 1 - 1
lib/Trog/Routes/JSON.pm

@@ -68,7 +68,7 @@ sub catalog ($query) {
 }
 
 sub webmanifest ($query) {
-    state $headers  = { ETag => 'manifest-' . _version() };
+    state $headers = { ETag => 'manifest-' . _version() };
     state %manifest = (
         "icons" => [
             { "src" => "$theme_dir/img/icon/favicon-32.png",  "type" => "image/png", "sizes" => "32x32" },

+ 1 - 1
lib/Trog/SQLite/TagIndex.pm

@@ -56,7 +56,7 @@ sub tags {
 
 sub add_post ( $post, $data_obj ) {
     my $dbh = _dbh();
-    build_index( $data_obj, [$post] );
+    build_index( $data_obj,  [$post] );
     build_routes( $data_obj, [$post] );
     return 1;
 }

+ 1 - 1
lib/Trog/Themes.pm

@@ -48,7 +48,7 @@ sub themed_style ($resource) {
     my @styles = ("/styles/$resource");
     my $styled = _dir_for_resource("styles/$resource");
     $styled =~ s/^www\///;
-    push(@styles, "/$styled/styles/$resource") if $styled;
+    push( @styles, "/$styled/styles/$resource" ) if $styled;
     return @styles;
 }