summaryrefslogtreecommitdiff
path: root/shared.pl
diff options
context:
space:
mode:
authorlshprung <lshprung@yahoo.com>2021-09-14 14:10:21 -0700
committerlshprung <lshprung@yahoo.com>2021-09-14 14:10:21 -0700
commitf3b787f6970f5a739b91a3de1f425179aae7fddb (patch)
tree2c6ee4fafdd6fbf01590a756376c1c49cee93d47 /shared.pl
parentd654b5c03c576bf8962960df9febf3ad37e29ea2 (diff)
Functional for --sql flag
Diffstat (limited to 'shared.pl')
-rw-r--r--shared.pl42
1 files changed, 21 insertions, 21 deletions
diff --git a/shared.pl b/shared.pl
index 16993ab..4c71855 100644
--- a/shared.pl
+++ b/shared.pl
@@ -1,27 +1,6 @@
# File to hold shared subroutines
-# Handle digging into non-scalar tags and other deep arrays
-# @_[0] -> array tag/deep array
-sub array_handler {
- my @output;
-
- for my $i (@_){
- # If another array, recursively handle
- if (ref($i) eq 'ARRAY'){
- push(@output, array_handler(@$i));
- }
-
- # If scalar, append to output normally
- elsif (!ref($i)){
- push(@output, "$i");
- }
- }
-
- return @output;
-}
-
-
# Wrapper to handle sqlite commands, return an array of returned lines from sqlite output
# @_[0] -> database handle
# @_[1] -> command/statement
@@ -43,3 +22,24 @@ sub db_cmd {
}
1;
+
+# Handle digging into non-scalar tags and other deep arrays
+# @_[0] -> array tag/deep array
+sub flatten_array {
+ my @output;
+
+ for my $i (@_){
+ # If another array, recursively handle
+ if (ref($i) eq 'ARRAY'){
+ push(@output, flatten_array(@$i));
+ }
+
+ # If scalar, append to output normally
+ elsif (!ref($i)){
+ push(@output, "$i");
+ }
+ }
+
+ return @output;
+}
+