]> git.proxmox.com Git - pve-common.git/commitdiff
api_clone_schema: use Clone::clone instead of Storable::dclone
authorDietmar Maurer <dietmar@proxmox.com>
Wed, 7 Oct 2015 06:55:42 +0000 (08:55 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 7 Oct 2015 06:55:42 +0000 (08:55 +0200)
This works with CODE refs like 'completion' helpers.

src/PVE/RESTHandler.pm

index 87a2c189460adb25d0dd694c43c35be87f4a7b45..dda58ea1d8430ce7d5ea3a5311b5d80acd81dd8b 100644 (file)
@@ -9,7 +9,7 @@ use PVE::JSONSchema;
 use PVE::PodParser;
 use HTTP::Status qw(:constants :is status_message);
 use Text::Wrap;
 use PVE::PodParser;
 use HTTP::Status qw(:constants :is status_message);
 use Text::Wrap;
-use Storable qw(dclone);
+use Clone qw(clone);
 
 my $method_registry = {};
 my $method_by_name = {};
 
 my $method_registry = {};
 my $method_by_name = {};
@@ -27,7 +27,7 @@ sub api_clone_schema {
     foreach my $k (keys %$schema) {
        my $d = $schema->{$k};
        if ($k ne 'properties') {
     foreach my $k (keys %$schema) {
        my $d = $schema->{$k};
        if ($k ne 'properties') {
-           $res->{$k} = ref($d) ? dclone($d) : $d;
+           $res->{$k} = ref($d) ? clone($d) : $d;
            next;
        }
        # convert indexed parameters like -net\d+ to -net[n]
            next;
        }
        # convert indexed parameters like -net\d+ to -net[n]
@@ -40,7 +40,7 @@ sub api_clone_schema {
                    next;
                }
            }
                    next;
                }
            }
-           $res->{$k}->{$p} = ref($pd) ? dclone($pd) : $pd;
+           $res->{$k}->{$p} = ref($pd) ? clone($pd) : $pd;
        }
     }
 
        }
     }
 
@@ -105,7 +105,7 @@ sub api_dump_full {
                        $data->{$k} = api_clone_schema($d);
                    } else {
 
                        $data->{$k} = api_clone_schema($d);
                    } else {
 
-                       $data->{$k} = ref($d) ? dclone($d) : $d;
+                       $data->{$k} = ref($d) ? clone($d) : $d;
                    }
                } 
                $res->{info}->{$info->{method}} = $data;
                    }
                } 
                $res->{info}->{$info->{method}} = $data;