PipelineFX Forum

Qube! => Developer Customization => Topic started by: Achilles on May 07, 2010, 07:12:06 AM

Title: exmaples/qbjobs.pl - syntax errors
Post by: Achilles on May 07, 2010, 07:12:06 AM
Code: [Select]
#       All jobs which are owned by user "yuna" or "tidus"
#
#       my $filter = {};
#       my $filter->{"user"} = ["yuna","tidus"];
#

the second "my $filter" will reinitialize $filter.


there is a var $fileds initialized. but never used.

Code: [Select]
my $fields = ["subjobs"];

- Thomas
Title: Re: exmaples/qbjobs.pl - syntax errors
Post by: jburk on May 07, 2010, 02:12:30 PM
Actually, you need to define the hash before you can assign a value to a specific key.
Title: Re: exmaples/qbjobs.pl - syntax errors
Post by: Achilles on May 07, 2010, 02:16:18 PM
Code: [Select]
use strict;
my $filter = {};
my $filter->{"user"} = ["yuna","tidus"];

is giving me:

Code: [Select]
# perl test.pl
Can't use an undefined value as a HASH reference at test.pl line 4.

Perl 5.8.8 (Centos 5.4)
Title: Re: exmaples/qbjobs.pl - syntax errors
Post by: jburk on May 10, 2010, 01:52:12 PM
lose the 'my' declaration on the hash assignment line:

Code: [Select]
use strict;
my $filter = {};
$filter->{"user"} = ["yuna","tidus"];
Title: Re: exmaples/qbjobs.pl - syntax errors
Post by: Achilles on May 10, 2010, 05:34:34 PM
my intention was to say:

if you provide examples - provide working examples.

 - Thomas