Re: use sys::virt module to manage VM in kvm

2014-03-29 Thread Dr.Ruud
On 2014-03-28 21:56, Andy Bach wrote: On Fri, Mar 28, 2014 at 3:05 PM, Dr.Ruud mailto:rvtol+use...@isolution.nl>> wrote: if ($@) { die "$@"; } Never test $@, only use the value of $@ after a failed eval. Why not? Because $@ is a global variable, which can

Re: use sys::virt module to manage VM in kvm

2014-03-28 Thread Andy Bach
On Fri, Mar 28, 2014 at 3:05 PM, Dr.Ruud wrote: > if ($@) { >> die "$@"; >> } >> > > Never test $@, only use the value of $@ after a failed eval. > Why not? The perldoc eval shows: If the code to be executed doesn't vary, you may use the eval-BLOCK form to trap run-time erro

Re: use sys::virt module to manage VM in kvm

2014-03-28 Thread Dr.Ruud
On 2014-03-27 20:53, Natxo Asenjo wrote: use strict; use warnings; use utf8; That "use utf8;" is almost always wrong, see 'perldoc utf8', only use it if your source code is utf8 encoded. if ($@) { die "$@"; } Never test $@, only use the value of $@ after a failed eval. -- Ruud

Re: use sys::virt module to manage VM in kvm

2014-03-28 Thread lesleyb
On Thu, Mar 27, 2014 at 01:41:53PM -0400, PJ wrote: > I’m new to perl too…but do they have a concept of abstract classes in perl? > On Mar 27, 2014, at 3:27 AM, lesleyb wrote: > > > On Wed, Mar 26, 2014 at 06:43:47PM -0700, Jim Gibson wrote: > >> > >> On Mar 26, 2014, at 6:30 PM, Benjamin Fernan

Re: use sys::virt module to manage VM in kvm

2014-03-27 Thread Natxo Asenjo
-- Groeten, natxo On Thu, Mar 27, 2014 at 2:30 AM, Benjamin Fernandis wrote: > Hi, > > I am new with perl and we have virtual machines in our infra. i want to > use perl sys::virt module to manage them, means to shutdown / start vm by > script and for that i wrote below small code. > > #!/usr/bi

Re: use sys::virt module to manage VM in kvm

2014-03-27 Thread PJ
I’m new to perl too…but do they have a concept of abstract classes in perl? On Mar 27, 2014, at 3:27 AM, lesleyb wrote: > On Wed, Mar 26, 2014 at 06:43:47PM -0700, Jim Gibson wrote: >> >> On Mar 26, 2014, at 6:30 PM, Benjamin Fernandis wrote: >> >>> Hi, >>> >>> I am new with perl and we have

Re: use sys::virt module to manage VM in kvm

2014-03-27 Thread Steve Kaftanski
Perhaps http://search.cpan.org/~danberr/Sys-Virt-1.2.2/lib/Sys/Virt/Network.pm is where you will get this function: ... $net->destroy() Immediately terminate the machine, and remove it from the virtual machine monitor. The $net handle is invalid after this call completes and should not be used ag

Re: use sys::virt module to manage VM in kvm

2014-03-27 Thread 'lesleyb'
On Wed, Mar 26, 2014 at 06:43:47PM -0700, Jim Gibson wrote: > > On Mar 26, 2014, at 6:30 PM, Benjamin Fernandis wrote: > > > Hi, > > > > I am new with perl and we have virtual machines in our infra. i want to use > > perl sys::virt module to manage them, means to shutdown / start vm by > > sc

Re: use sys::virt module to manage VM in kvm

2014-03-26 Thread Benjamin Fernandis
Hi Jim, Thanks for your kind response. I have installed rpm of perl-sys-virt on fedora 20 and i want to manage shutdown/start of guest VM by perl script. That method comes with sys::vrirt:domain, i trried that, but does not work. same error. Thnaks

Re: use sys::virt module to manage VM in kvm

2014-03-26 Thread Jim Gibson
On Mar 26, 2014, at 6:30 PM, Benjamin Fernandis wrote: > Hi, > > I am new with perl and we have virtual machines in our infra. i want to use > perl sys::virt module to manage them, means to shutdown / start vm by script > and for that i wrote below small code. > > #!/usr/bin/perl > # > use s