[pve-devel] VZDump/QemuServer: set bless clas correctly

Stefan Priebe - Profihost AG s.priebe at profihost.ag
Thu Nov 17 08:16:33 CET 2016


Am 17.11.2016 um 07:20 schrieb Dietmar Maurer:
>> While blessing it is good practise to provide the class. This makes it also
>> possible to use
>> QemuServer as a base / parent class.
> 
> Why do you want another class (QemuServer) as base?

We've a custom class PHQemuServer which has VZDump/QemuServer as a base
class as we're doing backups in some different way. That's a private use
case but it's common to use it this way and add the class to the bless.

See also:
http://modernperlbooks.com/books/modern_perl/chapter_07.html#Ymxlc3NlZF9yZWZlcmVuY2Vz

> Isn't it better to remove that whole $class parameter?
> 
> sub new {
>     my ($vzdump) = @_;

This would result in the need to call
VZDUmp::QemuServer::new(..);

never saw that before for creating objects ;-)

Stefan



More information about the pve-devel mailing list