From 0a2a4b5bc608f0c8888e7e9da479ce387b97b9a4 Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 24 Dec 2016 16:44:36 +0000 Subject: [PATCH] Fix syntax and variable naming brainos --- modules/ORB/System.pm | 2 +- modules/ORB/System/Entity.pm | 10 +++++----- modules/ORB/System/Recipe.pm | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/ORB/System.pm b/modules/ORB/System.pm index 97a2247..ff60b7e 100755 --- a/modules/ORB/System.pm +++ b/modules/ORB/System.pm @@ -48,7 +48,7 @@ use ORB::System::Recipe; # @return true on success, false if something failed. If this returns false, # the reason is in $self -> {"errstr"}. sub init { - my $self = shift; + my $self = shift; # Let the superclass copy the references over $self -> SUPER::init(@_) diff --git a/modules/ORB/System/Entity.pm b/modules/ORB/System/Entity.pm index f15963f..1e7e0fb 100644 --- a/modules/ORB/System/Entity.pm +++ b/modules/ORB/System/Entity.pm @@ -165,19 +165,19 @@ sub destroy { } # Check that the entity is safe to delete... - my $refcount = $self -> _fetch_refcount($id); + my $refcount = $self -> _fetch_refcount($args -> {"id"}); - return $self -> self_error("Attempt to delete non-existent entity $id from ".$self -> {"entity_table"}) + return $self -> self_error("Attempt to delete non-existent entity ".$args -> {"id"}." from ".$self -> {"entity_table"}) unless(defined($refcount)); - return $self -> self_error("Attempt to delete entity $id in ".$self -> {"entity_table"}." while still in use ($refcount references)") + return $self -> self_error("Attempt to delete entity ".$args -> {"id"}." in ".$self -> {"entity_table"}." while still in use ($refcount references)") if($refcount); # And now delete the entity itself my $nukeh = $self -> {"dbh"} -> prepare("DELETE FROM `".$self -> {"settings"} -> {"database"} -> {$self -> {"entity_table"}}."` WHERE `id` = ?"); $nukeh -> execute($args -> {"id"}) - or return $self -> self_error("Unable to perform entity $id removal from ".$self -> {"entity_table"}.": ". $self -> {"dbh"} -> errstr); + or return $self -> self_error("Unable to perform entity ".$args -> {"id"}." removal from ".$self -> {"entity_table"}.": ". $self -> {"dbh"} -> errstr); return 1; } @@ -206,7 +206,7 @@ sub get_id { # Multiple results are potentially dangerous. Log it as an error, but return the first hit anyway if(scalar(@{$id}) > 1) { - $self -> self_error("Multiple matches for specified entity name '".$args -> {"name"}."'"); + $self -> self_error("Multiple matches for specified entity name '$name'"); return $id -> [0] } diff --git a/modules/ORB/System/Recipe.pm b/modules/ORB/System/Recipe.pm index 750e50f..e7d4cd7 100644 --- a/modules/ORB/System/Recipe.pm +++ b/modules/ORB/System/Recipe.pm @@ -670,7 +670,7 @@ sub _renumber_recipe { my $newid = $self -> {"dbh"} -> {"mysql_insertid"} or return $self -> self_error("Unable to obtain id for new recipe"); - $self -> _fix_recipe_relations($sourceid, $destid) + $self -> _fix_recipe_relations($sourceid, $newid) or return undef; # Nuke the old recipe @@ -701,9 +701,9 @@ sub _fix_recipe_relations { $self -> clear_error(); # Move ingredient relation IDs - $moveh = $self -> {"dbh"} -> prepare("UPDATE `".$self -> {"settings"} -> {"database"} -> {"recipeing"}."` - SET `recipe_id` = ? - WHERE `recipe_id` = ?"); + my $moveh = $self -> {"dbh"} -> prepare("UPDATE `".$self -> {"settings"} -> {"database"} -> {"recipeing"}."` + SET `recipe_id` = ? + WHERE `recipe_id` = ?"); $moveh -> execute($destid, $sourceid) or return $self -> self_error("Ingredient relation fixup failed: ".$self -> {"dbh"} -> errstr());