Thread: [Arsperl-users] Performance problems
Brought to you by:
jeffmurphy
|
From: Paizo <pai...@gm...> - 2007-08-02 10:50:52
|
Hi Listeners,
I have some performance problem executing a perl script working like below:
$var1 =3D "something1";
($x1 =3D ars_GetFieldByName($ctrl, $ARSschema, $var1)) || die "bla bla
bla.\n";
...
$varn =3D "somethingn";
($xn =3D ars_GetFieldByName($ctrl, $ARSschema, $var1)) || die "bla bla
bla.\n";
#####i used ars_GetFieldByName because ars_GetFieldTable didn't work always
( i don't know why )
#######then i load the qualifier:
($qual =3D ars_LoadQualifier($ctrl, $ARSschema, $str_qual)) ||
die "ars_LoadQualifier: $ars_errstr";
...
####i retrieve the results ( don't take too much time ):
(%entries =3D ars_GetListEntry($ctrl, $ARSschema, $qual, 0, 0)) || die
"ars_GetListEntry: $ars_errstr";
#### then i cicle for save the data in a file ( that is the bottle neck ):
foreach $entry_id (sort keys %entries) {
$something1 =3D ars_GetEntry($ctrl, $ARSschema, $entry_id,$x1);
...
$somethingn =3D ars_GetEntry($ctrl, $ARSschema, $entry_id,$xn);
print datafile "$something1|$something2|...|$somethingn\n";
}
That's take up too 1 hour for finish while using the same qualification wit=
h
AR System User take less than 2 minuts....
How can i speed up that code?
Thanks,
Paizo
--=20
--------------------
A me cugin na volta xe nd=E0 dal geataro e el ga domand=E0 na coppetta trig=
usto
co i gusti seegheta, sarexe e schie co na fettina de poenta.
El geataro pena sentio che=E0 goduriosa scelta, el se ga messo subito el
pigiama de banane e el ghe ga messo in testa a corona de poegge medie e lo
ga fatto diventare Re dei Gelati Biricchini.
-----------------------
Confezione trigusto seegheta/sarexe/chie co pratico contenitore par e fete
de poenta, stile estat=E8 o quea dea ciocoeata
Altri gusti poe essere bigadini/kiwi/lasonil co socoi de vacca da tociare o
erbagatta/straciatella/calsina co coe de sorxe da tociare
------------
Rileggendo a firma diria che se poe puntare al mercato dei ghiaccioli col e=
l
gusto crema al diserbo e parafl=F9 ricoperta da una soffice crosta de pus c=
o
al posto del bacheto un termometro anale pratico pa misurarse a freve dopo
aver magn=E0 el geato (chi xe che no lo fa al giorno d'oggi?!?!). Garantite
scorese bitonali e solfeggi anali.
|
|
From: Thilo S. <thi...@ap...> - 2007-08-02 11:13:12
|
In the "foreach" loop, you are executing a separate API call for every
field. It should be much faster to fetch the whole entry with one call:
%entry = ars_GetEntry( $ctrl, $ARSschema, $entry_id, $x1,..,$xn );
die "ars_GetEntry($ARSschema,$entry_id): $ars_errstr" if $ars_errstr;
print datafile join("|", map {$entry{$_}} ($x1,..,$x)), "\n";
Using ars_GetListEntryWithFields (if you aren't fetching large char
(over 255 character) or diary fields) or ars_GetMultipleEntries might
improve the performance even a bit further.
By the way, instead of having n variables $x1,...,$xn for the field ids,
a better solution would be to store them in an array:
my @names = ($var1,...,$varN);
my @fieldIds;
foreach my $name ( @names ){
push @fieldIds, ars_GetFieldByName( $ctrl, $schema, $name );
}
and then call
%entry = ars_GetEntry( $ctrl, $ARSschema, $entry_id, @fieldIds );
I'd also like to know some more details about what's going wrong with
ars_GetFieldTable. Maybe this is a bug in ARSperl and your informations
could help me to fix it.
Best regards,
Thilo
Paizo wrote:
>
> Hi Listeners,
>
> I have some performance problem executing a perl script working like below:
>
>
>
> $var1 = "something1";
> ($x1 = ars_GetFieldByName($ctrl, $ARSschema, $var1)) || die "bla bla
> bla.\n";
>
> ...
>
> $varn = "somethingn";
> ($xn = ars_GetFieldByName($ctrl, $ARSschema, $var1)) || die "bla bla
> bla.\n";
>
> #####i used ars_GetFieldByName because ars_GetFieldTable didn't work
> always ( i don't know why )
>
> #######then i load the qualifier:
>
> ($qual = ars_LoadQualifier($ctrl, $ARSschema, $str_qual)) ||
> die "ars_LoadQualifier: $ars_errstr";
>
> ...
>
> ####i retrieve the results ( don't take too much time ):
>
> (%entries = ars_GetListEntry($ctrl, $ARSschema, $qual, 0, 0)) || die
> "ars_GetListEntry: $ars_errstr";
>
> #### then i cicle for save the data in a file ( that is the bottle neck ):
>
> foreach $entry_id (sort keys %entries) {
>
> $something1 = ars_GetEntry($ctrl, $ARSschema, $entry_id,$x1);
> ...
> $somethingn = ars_GetEntry($ctrl, $ARSschema, $entry_id,$xn);
>
> print datafile "$something1|$something2|...|$somethingn\n";
>
> }
>
>
> That's take up too 1 hour for finish while using the same qualification
> with AR System User take less than 2 minuts....
>
> How can i speed up that code?
>
> Thanks,
>
> Paizo
>
>
> --
> --------------------
> A me cugin na volta xe ndà dal geataro e el ga domandà na coppetta
> trigusto co i gusti seegheta, sarexe e schie co na fettina de poenta.
> El geataro pena sentio cheà goduriosa scelta, el se ga messo subito el
> pigiama de banane e el ghe ga messo in testa a corona de poegge medie e
> lo ga fatto diventare Re dei Gelati Biricchini.
> -----------------------
> Confezione trigusto seegheta/sarexe/chie co pratico contenitore par e
> fete de poenta, stile estatè o quea dea ciocoeata
> Altri gusti poe essere bigadini/kiwi/lasonil co socoi de vacca da
> tociare o erbagatta/straciatella/calsina co coe de sorxe da tociare
> ------------
> Rileggendo a firma diria che se poe puntare al mercato dei ghiaccioli
> col el gusto crema al diserbo e paraflù ricoperta da una soffice crosta
> de pus co al posto del bacheto un termometro anale pratico pa misurarse
> a freve dopo aver magnà el geato (chi xe che no lo fa al giorno
> d'oggi?!?!). Garantite scorese bitonali e solfeggi anali.
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Arsperl-users mailing list
> Ars...@ar...
> https://lists.sourceforge.net/lists/listinfo/arsperl-users
|
|
From: Clayton S. <cla...@gm...> - 2007-08-02 11:44:10
|
Paizo wrote:
> Hi Listeners,
>
> I have some performance problem executing a perl script working like below:
>
> [ code snipped ]
> That's take up too 1 hour for finish while using the same qualification with
> AR System User take less than 2 minuts....
>
> How can i speed up that code?
>
> Thanks,
One way to get an excellent increase in speed is to fetch all of the
fields for each entry at once instead of individually.
You should work hard to reduce the number of ars_ calls required
because they involve the slowest part of this set up: the network.
I'll show you a modified version of your final loop that does this.
But first put your field id fetching into a loop and your field ids
into an array so that they are easier to add/remove fields and pass
the field ids on to the ars_GetEntry call.
# Getting Field Ids
my @field_names = ('something1', ... ,'somthingn');
my @field_ids;
foreach my $field_name ( @field_names ){
my $field_id;
($field_id = ars_GetFieldByName($ctrl, $ARSschema, $field_name) ||
die "bla bla bla.\n";
push @field_ids, $field_id;
}
# Getting Entries
foreach my $entry_id (sort keys %entries) {
my %entry = ars_GetEntry($ctrl, $ARSschema, $entry_id, @field_ids);
print datafile join("|", @entry{@field_ids} ) . "\n";
}
I hope this helps,
--
Clayton Scott
cla...@gm...
|
|
From: Paizo <pai...@gm...> - 2007-08-02 14:35:14
|
Thanks guys, that helps a lot :)
>I'd also like to know some more details about what's going wrong with
>ars_GetFieldTable. Maybe this is a bug in ARSperl and your informations
>could help me to fix it.
Don't remeber exaclty, sometimes ( rare )
(%fids =3D ars_GetFieldTable($ctrl, $schema)) ||
die "ars_GetFieldTable: $ars_errstr";
fail and print out the classic ARERR code...i remember it was like "you
don't have permissions..." but i forgot the error code number :/
i have another ( stupid question, still new to perl :| ) , if inside the th=
e
loop:
# Getting Entries
foreach my $entry_id (sort keys %entries) {
my %entry =3D ars_GetEntry($ctrl, $ARSschema, $entry_id, @field_ids);
print datafile join("|", @entry{@field_ids} ) . "\n";
}
i want to convert some dates that are in seconds since 1970 to something
like dd/mm/yyyy hh.mm.ss
if i try to read $field_ids[3] and always get "3" instead of the real
content :/
what i miss?
2007/8/2, Clayton Scott <cla...@gm...>:
>
> Paizo wrote:
> > Hi Listeners,
> >
> > I have some performance problem executing a perl script working like
> below:
> >
> > [ code snipped ]
> > That's take up too 1 hour for finish while using the same qualification
> with
> > AR System User take less than 2 minuts....
> >
> > How can i speed up that code?
> >
> > Thanks,
>
>
> One way to get an excellent increase in speed is to fetch all of the
> fields for each entry at once instead of individually.
>
> You should work hard to reduce the number of ars_ calls required
> because they involve the slowest part of this set up: the network.
>
> I'll show you a modified version of your final loop that does this.
> But first put your field id fetching into a loop and your field ids
> into an array so that they are easier to add/remove fields and pass
> the field ids on to the ars_GetEntry call.
>
> # Getting Field Ids
> my @field_names =3D ('something1', ... ,'somthingn');
> my @field_ids;
>
> foreach my $field_name ( @field_names ){
> my $field_id;
> ($field_id =3D ars_GetFieldByName($ctrl, $ARSschema, $field_name) ||
> die "bla bla bla.\n";
> push @field_ids, $field_id;
> }
>
> # Getting Entries
> foreach my $entry_id (sort keys %entries) {
> my %entry =3D ars_GetEntry($ctrl, $ARSschema, $entry_id, @field_ids);
> print datafile join("|", @entry{@field_ids} ) . "\n";
> }
>
> I hope this helps,
>
> --
>
> Clayton Scott
> cla...@gm...
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Arsperl-users mailing list
> Ars...@ar...
> https://lists.sourceforge.net/lists/listinfo/arsperl-users
>
--=20
--------------------
A me cugin na volta xe nd=E0 dal geataro e el ga domand=E0 na coppetta trig=
usto
co i gusti seegheta, sarexe e schie co na fettina de poenta.
El geataro pena sentio che=E0 goduriosa scelta, el se ga messo subito el
pigiama de banane e el ghe ga messo in testa a corona de poegge medie e lo
ga fatto diventare Re dei Gelati Biricchini.
-----------------------
Confezione trigusto seegheta/sarexe/chie co pratico contenitore par e fete
de poenta, stile estat=E8 o quea dea ciocoeata
Altri gusti poe essere bigadini/kiwi/lasonil co socoi de vacca da tociare o
erbagatta/straciatella/calsina co coe de sorxe da tociare
------------
Rileggendo a firma diria che se poe puntare al mercato dei ghiaccioli col e=
l
gusto crema al diserbo e parafl=F9 ricoperta da una soffice crosta de pus c=
o
al posto del bacheto un termometro anale pratico pa misurarse a freve dopo
aver magn=E0 el geato (chi xe che no lo fa al giorno d'oggi?!?!). Garantite
scorese bitonali e solfeggi anali.
|
|
From: Clayton S. <cla...@gm...> - 2007-08-02 14:48:50
|
On 8/2/07, Paizo <pai...@gm...> wrote:
> i have another ( stupid question, still new to perl :| ) , if inside the the
> loop:
> [ loop snipped ]
> i want to convert some dates that are in seconds since 1970 to something
> like dd/mm/yyyy hh.mm.ss
> if i try to read $field_ids[3] and always get "3" instead of the real
> content :/
> what i miss?
Without more code, and data I really can't tell.
If you want the value for a field in the form you more likely want to
use the entry hash:
$entry{'field_id'}
If you want to inspect these data structures you can use the
Data::Dumper module.
use Data::Dumper;
....
print Dumper \@field_ids;
foreach my $entry_id (sort keys %entries) {
my %entry = ars_GetEntry($ctrl, $ARSschema, $entry_id, @field_ids);
print Dumper \%entry;
print datafile join("|", @entry{@field_ids} ) . "\n";
}
--
Clayton Scott
cla...@gm...
|
|
From: Paizo <pai...@gm...> - 2007-08-02 15:20:40
|
i tried the following:
foreach my $entry_id (sort keys %entries) {
my %entry =3D ars_GetEntry($ctrl, $ARSschema, $entry_id, @field_ids);
print "$field_ids[3]\n";# test: print number 3 the first clicle then
nothing
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =3D
gmtime($field_ids[3]);
$year +=3D 1900;
$mon +=3D 1;
if ($mday < 10) {
$timestamp_a =3D "0".$mday.q{/};
} else {
$timestamp_a =3D $mday.q{/};
}
if ($mon < 10) {
$timestamp_a .=3D "0".$mon.q{/}.$year." ";
} else {
$timestamp_a .=3D $mon.q{/}.$year." ";
}
if ($hour < 10) {
$timestamp_a .=3D "0".$hour.".";
} else {
$timestamp_a .=3D $hour.".";
}
if ($min < 10) {
$timestamp_a .=3D "0".$min.".";
} else {
$timestamp_a .=3D $min.".";
}
if ($sec < 10) {
$timestamp_a .=3D "0".$sec;
} else {
$timestamp_a .=3D $sec;
}
print "$timestamp_a\n\n"; #test: print 01/01/1970 00.00.03 in the firs=
t
cile then always 01/01/1970 00.00.00
$field_ids[3] =3D $timestamp_a;
print datafile join("|", @entry{@field_ids} ) . "\n";
}
hope its more clear.
2007/8/2, Clayton Scott <cla...@gm...>:
>
> On 8/2/07, Paizo <pai...@gm...> wrote:
> > i have another ( stupid question, still new to perl :| ) , if inside th=
e
> the
> > loop:
> > [ loop snipped ]
> > i want to convert some dates that are in seconds since 1970 to somethin=
g
> > like dd/mm/yyyy hh.mm.ss
> > if i try to read $field_ids[3] and always get "3" instead of the real
> > content :/
> > what i miss?
>
> Without more code, and data I really can't tell.
>
> If you want the value for a field in the form you more likely want to
> use the entry hash:
>
> $entry{'field_id'}
>
> If you want to inspect these data structures you can use the
> Data::Dumper module.
>
> use Data::Dumper;
> ....
>
> print Dumper \@field_ids;
>
> foreach my $entry_id (sort keys %entries) {
> my %entry =3D ars_GetEntry($ctrl, $ARSschema, $entry_id, @field_ids);
> print Dumper \%entry;
> print datafile join("|", @entry{@field_ids} ) . "\n";
> }
>
> --
>
> Clayton Scott
> cla...@gm...
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Arsperl-users mailing list
> Ars...@ar...
> https://lists.sourceforge.net/lists/listinfo/arsperl-users
>
--=20
--------------------
A me cugin na volta xe nd=E0 dal geataro e el ga domand=E0 na coppetta trig=
usto
co i gusti seegheta, sarexe e schie co na fettina de poenta.
El geataro pena sentio che=E0 goduriosa scelta, el se ga messo subito el
pigiama de banane e el ghe ga messo in testa a corona de poegge medie e lo
ga fatto diventare Re dei Gelati Biricchini.
-----------------------
Confezione trigusto seegheta/sarexe/chie co pratico contenitore par e fete
de poenta, stile estat=E8 o quea dea ciocoeata
Altri gusti poe essere bigadini/kiwi/lasonil co socoi de vacca da tociare o
erbagatta/straciatella/calsina co coe de sorxe da tociare
------------
Rileggendo a firma diria che se poe puntare al mercato dei ghiaccioli col e=
l
gusto crema al diserbo e parafl=F9 ricoperta da una soffice crosta de pus c=
o
al posto del bacheto un termometro anale pratico pa misurarse a freve dopo
aver magn=E0 el geato (chi xe che no lo fa al giorno d'oggi?!?!). Garantite
scorese bitonali e solfeggi anali.
|
|
From: Thilo S. <thi...@ap...> - 2007-08-02 15:50:22
|
$field_ids[3] contains just the field id itself.
The value of the field is in $entry{$field_id[3]}}.
You should also note that gmtime returns the month as numbers 0..11
instead of 1..12.
Anyway, an easier (and problably more reliable) method for date
formatting would be to use a module from CPAN (e.g. Date::Format).
Regards,
Thilo
Paizo wrote:
> i tried the following:
>
>
> foreach my $entry_id (sort keys %entries) {
> my %entry = ars_GetEntry($ctrl, $ARSschema, $entry_id, @field_ids);
>
> print "$field_ids[3]\n";# test: print number 3 the first clicle then
> nothing
>
> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
> gmtime($field_ids[3]);
>
> $year += 1900;
> $mon += 1;
>
> if ($mday < 10) {
> $timestamp_a = "0".$mday.q{/};
> } else {
> $timestamp_a = $mday.q{/};
> }
>
> if ($mon < 10) {
> $timestamp_a .= "0".$mon.q{/}.$year." ";
> } else {
> $timestamp_a .= $mon.q{/}.$year." ";
> }
>
> if ($hour < 10) {
> $timestamp_a .= "0".$hour.".";
> } else {
> $timestamp_a .= $hour.".";
> }
>
> if ($min < 10) {
> $timestamp_a .= "0".$min.".";
> } else {
> $timestamp_a .= $min.".";
> }
>
> if ($sec < 10) {
> $timestamp_a .= "0".$sec;
> } else {
> $timestamp_a .= $sec;
> }
>
> print "$timestamp_a\n\n"; #test: print 01/01/1970 00.00.03 in the
> first cile then always 01/01/1970 00.00.00
>
> $field_ids[3] = $timestamp_a;
> print datafile join("|", @entry{@field_ids} ) . "\n";
>
> }
>
>
> hope its more clear.
>
>
>
> 2007/8/2, Clayton Scott <cla...@gm...
> <mailto:cla...@gm...>>:
>
> On 8/2/07, Paizo <pai...@gm...
> <mailto:pai...@gm...>> wrote:
> > i have another ( stupid question, still new to perl :| ) , if
> inside the the
> > loop:
> > [ loop snipped ]
> > i want to convert some dates that are in seconds since 1970 to
> something
> > like dd/mm/yyyy hh.mm.ss
> > if i try to read $field_ids[3] and always get "3" instead of the real
> > content :/
> > what i miss?
>
> Without more code, and data I really can't tell.
>
> If you want the value for a field in the form you more likely want to
> use the entry hash:
>
> $entry{'field_id'}
>
> If you want to inspect these data structures you can use the
> Data::Dumper module.
>
> use Data::Dumper;
> ....
>
> print Dumper \@field_ids;
>
> foreach my $entry_id (sort keys %entries) {
> my %entry = ars_GetEntry($ctrl, $ARSschema, $entry_id, @field_ids);
> print Dumper \%entry;
> print datafile join("|", @entry{@field_ids} ) . "\n";
> }
>
> --
>
> Clayton Scott
> cla...@gm... <mailto:cla...@gm...>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Arsperl-users mailing list
> Ars...@ar... <mailto:Ars...@ar...>
> https://lists.sourceforge.net/lists/listinfo/arsperl-users
>
>
>
>
> --
> --------------------
> A me cugin na volta xe ndà dal geataro e el ga domandà na coppetta
> trigusto co i gusti seegheta, sarexe e schie co na fettina de poenta.
> El geataro pena sentio cheà goduriosa scelta, el se ga messo subito el
> pigiama de banane e el ghe ga messo in testa a corona de poegge medie e
> lo ga fatto diventare Re dei Gelati Biricchini.
> -----------------------
> Confezione trigusto seegheta/sarexe/chie co pratico contenitore par e
> fete de poenta, stile estatè o quea dea ciocoeata
> Altri gusti poe essere bigadini/kiwi/lasonil co socoi de vacca da
> tociare o erbagatta/straciatella/calsina co coe de sorxe da tociare
> ------------
> Rileggendo a firma diria che se poe puntare al mercato dei ghiaccioli
> col el gusto crema al diserbo e paraflù ricoperta da una soffice crosta
> de pus co al posto del bacheto un termometro anale pratico pa misurarse
> a freve dopo aver magnà el geato (chi xe che no lo fa al giorno
> d'oggi?!?!). Garantite scorese bitonali e solfeggi anali.
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Arsperl-users mailing list
> Ars...@ar...
> https://lists.sourceforge.net/lists/listinfo/arsperl-users
|
|
From: Priddy, T. <tim...@in...> - 2007-08-02 21:30:31
|
my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) =3D =
localtime ( $entry{$field_id[3]} ); =
=20
my $timestamp_a =3D sprintf "%02d/%02d/%04d %02d.%02d.%02d", $mday, $mon =
+ 1, $year + 1900, $hour, $min, $sec;
=20
I'd recommend that you also start using:
=20
use warnings;
use strict;
=20
-----Original Message-----
From: ars...@ar... =
[mailto:ars...@ar...] On Behalf Of Thilo Stapff
Sent: Thursday, August 02, 2007 8:50 AM
To: ARSperl User Discussion
Subject: Re: [Arsperl-users] Performance problems
=20
$field_ids[3] contains just the field id itself.
=20
The value of the field is in $entry{$field_id[3]}}.
=20
You should also note that gmtime returns the month as numbers 0..11=20
instead of 1..12.
Anyway, an easier (and problably more reliable) method for date=20
formatting would be to use a module from CPAN (e.g. Date::Format).
=20
=20
Regards,
Thilo
=20
=20
Paizo wrote:
> i tried the following:
>=20
>=20
> foreach my $entry_id (sort keys %entries) {
> my %entry =3D ars_GetEntry($ctrl, $ARSschema, $entry_id, =
@field_ids);
>=20
> print "$field_ids[3]\n";# test: print number 3 the first clicle =
then=20
> nothing
>=20
> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =3D=20
> gmtime($field_ids[3]); =20
> =20
> $year +=3D 1900;
> $mon +=3D 1;
> =20
> if ($mday < 10) {
> $timestamp_a =3D "0".$mday.q{/};
> } else {
> $timestamp_a =3D $mday.q{/};
> }
> =20
> if ($mon < 10) {
> $timestamp_a .=3D "0".$mon.q{/}.$year." ";
> } else {
> $timestamp_a .=3D $mon.q{/}.$year." ";
> }
> =20
> if ($hour < 10) {
> $timestamp_a .=3D "0".$hour.".";
> } else {
> $timestamp_a .=3D $hour.".";
> } =20
>=20
> if ($min < 10) {
> $timestamp_a .=3D "0".$min.".";
> } else {
> $timestamp_a .=3D $min.".";
> } =20
>=20
> if ($sec < 10) {
> $timestamp_a .=3D "0".$sec;
> } else {
> $timestamp_a .=3D $sec;
> }
>=20
> print "$timestamp_a\n\n"; #test: print 01/01/1970 00.00.03 in the =
> first cile then always 01/01/1970 00.00.00
>=20
> $field_ids[3] =3D $timestamp_a;
> print datafile join("|", @entry{@field_ids} ) . "\n";
>=20
> }
>=20
>=20
> hope its more clear.
>=20
>=20
>=20
> 2007/8/2, Clayton Scott <cla...@gm...=20
> <mailto:cla...@gm...>>:
>=20
> On 8/2/07, Paizo <pai...@gm...
> <mailto:pai...@gm...>> wrote:
> > i have another ( stupid question, still new to perl :| ) , if
> inside the the
> > loop:
> > [ loop snipped ]
> > i want to convert some dates that are in seconds since 1970 to
> something
> > like dd/mm/yyyy hh.mm.ss
> > if i try to read $field_ids[3] and always get "3" instead of =
the real
> > content :/
> > what i miss?
>=20
> Without more code, and data I really can't tell.
>=20
> If you want the value for a field in the form you more likely want =
to
> use the entry hash:
>=20
> $entry{'field_id'}
>=20
> If you want to inspect these data structures you can use the
> Data::Dumper module.
>=20
> use Data::Dumper;
> ....
>=20
> print Dumper \@field_ids;
>=20
> foreach my $entry_id (sort keys %entries) {
> my %entry =3D ars_GetEntry($ctrl, $ARSschema, $entry_id, =
@field_ids);
> print Dumper \%entry;
> print datafile join("|", @entry{@field_ids} ) . "\n";
> }
>=20
> --
>=20
> Clayton Scott
> cla...@gm... <mailto:cla...@gm...>
>=20
> =
-------------------------------------------------------------------------=
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a =
browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Arsperl-users mailing list
> Ars...@ar... <mailto:Ars...@ar...>
> https://lists.sourceforge.net/lists/listinfo/arsperl-users
>=20
>=20
>=20
>=20
> --=20
> --------------------
> A me cugin na volta xe nd=E0 dal geataro e el ga domand=E0 na coppetta =
> trigusto co i gusti seegheta, sarexe e schie co na fettina de poenta.
> El geataro pena sentio che=E0 goduriosa scelta, el se ga messo subito =
el=20
> pigiama de banane e el ghe ga messo in testa a corona de poegge medie =
e=20
> lo ga fatto diventare Re dei Gelati Biricchini.
> -----------------------
> Confezione trigusto seegheta/sarexe/chie co pratico contenitore par e=20
> fete de poenta, stile estat=E8 o quea dea ciocoeata
> Altri gusti poe essere bigadini/kiwi/lasonil co socoi de vacca da=20
> tociare o erbagatta/straciatella/calsina co coe de sorxe da tociare
> ------------
> Rileggendo a firma diria che se poe puntare al mercato dei ghiaccioli=20
> col el gusto crema al diserbo e parafl=F9 ricoperta da una soffice =
crosta=20
> de pus co al posto del bacheto un termometro anale pratico pa =
misurarse=20
> a freve dopo aver magn=E0 el geato (chi xe che no lo fa al giorno=20
> d'oggi?!?!). Garantite scorese bitonali e solfeggi anali.
>=20
>=20
> =
------------------------------------------------------------------------
>=20
> =
-------------------------------------------------------------------------=
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a =
browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
>=20
>=20
> =
------------------------------------------------------------------------
>=20
> _______________________________________________
> Arsperl-users mailing list
> Ars...@ar...
> https://lists.sourceforge.net/lists/listinfo/arsperl-users
=20
=20
-------------------------------------------------------------------------=
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Arsperl-users mailing list
Ars...@ar...
https://lists.sourceforge.net/lists/listinfo/arsperl-users
|
|
From: Paizo <pai...@gm...> - 2007-08-03 07:31:38
|
Thank you all, very helpfull :)
by now it take 5 minuts instead of 60, an impressive improvement!
2007/8/2, Priddy, Tim <tim...@in...>:
>
> my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) =3D
> localtime ( $entry{$field_id[3]} );
>
> my $timestamp_a =3D sprintf "%02d/%02d/%04d %02d.%02d.%02d", $mday, $mon =
+
> 1, $year + 1900, $hour, $min, $sec;
>
>
>
> I'd recommend that you also start using:
>
>
>
> use warnings;
>
> use strict;
>
>
>
> -----Original Message-----
> From: ars...@ar... [mailto:
> ars...@ar...] On Behalf Of Thilo Stapff
> Sent: Thursday, August 02, 2007 8:50 AM
> To: ARSperl User Discussion
> Subject: Re: [Arsperl-users] Performance problems
>
>
>
> $field_ids[3] contains just the field id itself.
>
>
>
> The value of the field is in $entry{$field_id[3]}}.
>
>
>
> You should also note that gmtime returns the month as numbers 0..11
>
> instead of 1..12.
>
> Anyway, an easier (and problably more reliable) method for date
>
> formatting would be to use a module from CPAN (e.g. Date::Format).
>
>
>
>
>
> Regards,
>
> Thilo
>
>
>
>
>
> Paizo wrote:
>
> > i tried the following:
>
> >
>
> >
>
> > foreach my $entry_id (sort keys %entries) {
>
> > my %entry =3D ars_GetEntry($ctrl, $ARSschema, $entry_id, @field_ids)=
;
>
> >
>
> > print "$field_ids[3]\n";# test: print number 3 the first clicle the=
n
>
>
> > nothing
>
> >
>
> > ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =3D
>
> > gmtime($field_ids[3]);
>
> >
>
> > $year +=3D 1900;
>
> > $mon +=3D 1;
>
> >
>
> > if ($mday < 10) {
>
> > $timestamp_a =3D "0".$mday.q{/};
>
> > } else {
>
> > $timestamp_a =3D $mday.q{/};
>
> > }
>
> >
>
> > if ($mon < 10) {
>
> > $timestamp_a .=3D "0".$mon.q{/}.$year." ";
>
> > } else {
>
> > $timestamp_a .=3D $mon.q{/}.$year." ";
>
> > }
>
> >
>
> > if ($hour < 10) {
>
> > $timestamp_a .=3D "0".$hour.".";
>
> > } else {
>
> > $timestamp_a .=3D $hour.".";
>
> > }
>
> >
>
> > if ($min < 10) {
>
> > $timestamp_a .=3D "0".$min.".";
>
> > } else {
>
> > $timestamp_a .=3D $min.".";
>
> > }
>
> >
>
> > if ($sec < 10) {
>
> > $timestamp_a .=3D "0".$sec;
>
> > } else {
>
> > $timestamp_a .=3D $sec;
>
> > }
>
> >
>
> > print "$timestamp_a\n\n"; #test: print 01/01/1970 00.00.03 in the
>
> > first cile then always 01/01/1970 00.00.00
>
> >
>
> > $field_ids[3] =3D $timestamp_a;
>
> > print datafile join("|", @entry{@field_ids} ) . "\n";
>
> >
>
> > }
>
> >
>
> >
>
> > hope its more clear.
>
> >
>
> >
>
> >
>
> > 2007/8/2, Clayton Scott <cla...@gm...
>
> > <mailto:cla...@gm...>>:
>
> >
>
> > On 8/2/07, Paizo <pai...@gm...
>
> > <mailto:pai...@gm...>> wrote:
>
> > > i have another ( stupid question, still new to perl :| ) , if
>
> > inside the the
>
> > > loop:
>
> > > [ loop snipped ]
>
> > > i want to convert some dates that are in seconds since 1970 to
>
> > something
>
> > > like dd/mm/yyyy hh.mm.ss
>
> > > if i try to read $field_ids[3] and always get "3" instead of the
> real
>
> > > content :/
>
> > > what i miss?
>
> >
>
> > Without more code, and data I really can't tell.
>
> >
>
> > If you want the value for a field in the form you more likely want
> to
>
> > use the entry hash:
>
> >
>
> > $entry{'field_id'}
>
> >
>
> > If you want to inspect these data structures you can use the
>
> > Data::Dumper module.
>
> >
>
> > use Data::Dumper;
>
> > ....
>
> >
>
> > print Dumper \@field_ids;
>
> >
>
> > foreach my $entry_id (sort keys %entries) {
>
> > my %entry =3D ars_GetEntry($ctrl, $ARSschema, $entry_id,
> @field_ids);
>
> > print Dumper \%entry;
>
> > print datafile join("|", @entry{@field_ids} ) . "\n";
>
> > }
>
> >
>
> > --
>
> >
>
> > Clayton Scott
>
> > cla...@gm... <mailto:cla...@gm...>
>
> >
>
> >
> -------------------------------------------------------------------------
>
> > This SF.net email is sponsored by: Splunk Inc.
>
> > Still grepping through log files to find problems? Stop.
>
> > Now Search log events and configuration files using AJAX and a
> browser.
>
> > Download your FREE copy of Splunk now >> http://get.splunk.com/
>
> > _______________________________________________
>
> > Arsperl-users mailing list
>
> > Ars...@ar... <mailto:Ars...@ar...>
>
> > https://lists.sourceforge.net/lists/listinfo/arsperl-users
>
> >
>
> >
>
> >
>
> >
>
> > --
>
> > --------------------
>
> > A me cugin na volta xe nd=E0 dal geataro e el ga domand=E0 na coppetta
>
> > trigusto co i gusti seegheta, sarexe e schie co na fettina de poenta.
>
> > El geataro pena sentio che=E0 goduriosa scelta, el se ga messo subito e=
l
>
> > pigiama de banane e el ghe ga messo in testa a corona de poegge medie e
>
> > lo ga fatto diventare Re dei Gelati Biricchini.
>
> > -----------------------
>
> > Confezione trigusto seegheta/sarexe/chie co pratico contenitore par e
>
> > fete de poenta, stile estat=E8 o quea dea ciocoeata
>
> > Altri gusti poe essere bigadini/kiwi/lasonil co socoi de vacca da
>
> > tociare o erbagatta/straciatella/calsina co coe de sorxe da tociare
>
> > ------------
>
> > Rileggendo a firma diria che se poe puntare al mercato dei ghiaccioli
>
> > col el gusto crema al diserbo e parafl=F9 ricoperta da una soffice cros=
ta
>
> > de pus co al posto del bacheto un termometro anale pratico pa misurarse
>
> > a freve dopo aver magn=E0 el geato (chi xe che no lo fa al giorno
>
> > d'oggi?!?!). Garantite scorese bitonali e solfeggi anali.
>
> >
>
> >
>
> > -----------------------------------------------------------------------=
-
>
> >
>
> >
> -------------------------------------------------------------------------
>
> > This SF.net email is sponsored by: Splunk Inc.
>
> > Still grepping through log files to find problems? Stop.
>
> > Now Search log events and configuration files using AJAX and a browser.
>
> > Download your FREE copy of Splunk now >> http://get.splunk.com/
>
> >
>
> >
>
> > -----------------------------------------------------------------------=
-
>
> >
>
> > _______________________________________________
>
> > Arsperl-users mailing list
>
> > Ars...@ar...
>
> > https://lists.sourceforge.net/lists/listinfo/arsperl-users
>
>
>
>
>
> -------------------------------------------------------------------------
>
> This SF.net email is sponsored by: Splunk Inc.
>
> Still grepping through log files to find problems? Stop.
>
> Now Search log events and configuration files using AJAX and a browser.
>
> Download your FREE copy of Splunk now >> http://get.splunk.com/
>
> _______________________________________________
>
> Arsperl-users mailing list
>
> Ars...@ar...
>
> https://lists.sourceforge.net/lists/listinfo/arsperl-users
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Arsperl-users mailing list
> Ars...@ar...
> https://lists.sourceforge.net/lists/listinfo/arsperl-users
>
>
--=20
--------------------
A me cugin na volta xe nd=E0 dal geataro e el ga domand=E0 na coppetta trig=
usto
co i gusti seegheta, sarexe e schie co na fettina de poenta.
El geataro pena sentio che=E0 goduriosa scelta, el se ga messo subito el
pigiama de banane e el ghe ga messo in testa a corona de poegge medie e lo
ga fatto diventare Re dei Gelati Biricchini.
-----------------------
Confezione trigusto seegheta/sarexe/chie co pratico contenitore par e fete
de poenta, stile estat=E8 o quea dea ciocoeata
Altri gusti poe essere bigadini/kiwi/lasonil co socoi de vacca da tociare o
erbagatta/straciatella/calsina co coe de sorxe da tociare
------------
Rileggendo a firma diria che se poe puntare al mercato dei ghiaccioli col e=
l
gusto crema al diserbo e parafl=F9 ricoperta da una soffice crosta de pus c=
o
al posto del bacheto un termometro anale pratico pa misurarse a freve dopo
aver magn=E0 el geato (chi xe che no lo fa al giorno d'oggi?!?!). Garantite
scorese bitonali e solfeggi anali.
|
|
From: Ravi <ra...@co...> - 2007-08-09 05:31:32
|
Hi:I am trying query a schema and print a fieldname and values for all
records with a qualifying filter. I can't seem to figure out which
function to use and how. This is what I have now and I get 0 records. Is
asr_GetListEntry the right function? Does someone have a sample script
or point me to the right one in the example dir?
$schema = "My:Alarm Base";
$qs = qq/'Category' = "Voice"/;
($qual = ars_LoadQualifier($ctrl,$schema,$qs)) ||
die "error in ars_LoadQualifier";
%entries = ars_GetListEntry($ctrl, $schema, $qual, 0);
foreach $entry_id (sort keys %entries) {
printf("%s %s\n", $entry_id, $entries{$entry_id});
}
Thanks
Ravi
|
|
From: <jar...@gm...> - 2007-08-09 17:24:59
|
I does not like the die parameter if you got an error. You may miss
the clean-up part.
-
Jarl
On 8/9/07, Thilo Stapff <thi...@ap...> wrote:
> ars_GetListEntry needs at least one more parameter (firstRetrieve,
> usually = 0):
>
> %entries = ars_GetListEntry($ctrl, $schema, $qual, 0 , 0);
>
> instead of
>
> %entries = ars_GetListEntry($ctrl, $schema, $qual, 0);
>
>
> Moreover, you should always check for errors after calling an API
> function, e.g.
>
> die "ars_GetListEntry( $schema, $qs ): $ars_errstr\n" if $ars_errstr;
>
>
> You might also try using the field ID of "Category" instead of the field
> name in the qualifier string.
>
>
> Regards,
> Thilo Stapff
>
>
> Ravi wrote:
> > Hi:I am trying query a schema and print a fieldname and values for all
> > records with a qualifying filter. I can't seem to figure out which
> > function to use and how. This is what I have now and I get 0 records. Is
> > asr_GetListEntry the right function? Does someone have a sample script
> > or point me to the right one in the example dir?
> >
> > $schema = "My:Alarm Base";
> > $qs = qq/'Category' = "Voice"/;
> > ($qual = ars_LoadQualifier($ctrl,$schema,$qs)) ||
> > die "error in ars_LoadQualifier";
> >
> > %entries = ars_GetListEntry($ctrl, $schema, $qual, 0);
> >
> > foreach $entry_id (sort keys %entries) {
> > printf("%s %s\n", $entry_id, $entries{$entry_id});
> > }
> >
> >
> > Thanks
> > Ravi
> >
> >
> > -------------------------------------------------------------------------
> > This SF.net email is sponsored by: Splunk Inc.
> > Still grepping through log files to find problems? Stop.
> > Now Search log events and configuration files using AJAX and a browser.
> > Download your FREE copy of Splunk now >> http://get.splunk.com/
> > _______________________________________________
> > Arsperl-users mailing list
> > Ars...@ar...
> > https://lists.sourceforge.net/lists/listinfo/arsperl-users
> >
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Arsperl-users mailing list
> Ars...@ar...
> https://lists.sourceforge.net/lists/listinfo/arsperl-users
>
|
|
From: Thilo S. <thi...@ap...> - 2007-08-09 09:01:57
|
ars_GetListEntry needs at least one more parameter (firstRetrieve,
usually = 0):
%entries = ars_GetListEntry($ctrl, $schema, $qual, 0 , 0);
instead of
%entries = ars_GetListEntry($ctrl, $schema, $qual, 0);
Moreover, you should always check for errors after calling an API
function, e.g.
die "ars_GetListEntry( $schema, $qs ): $ars_errstr\n" if $ars_errstr;
You might also try using the field ID of "Category" instead of the field
name in the qualifier string.
Regards,
Thilo Stapff
Ravi wrote:
> Hi:I am trying query a schema and print a fieldname and values for all
> records with a qualifying filter. I can't seem to figure out which
> function to use and how. This is what I have now and I get 0 records. Is
> asr_GetListEntry the right function? Does someone have a sample script
> or point me to the right one in the example dir?
>
> $schema = "My:Alarm Base";
> $qs = qq/'Category' = "Voice"/;
> ($qual = ars_LoadQualifier($ctrl,$schema,$qs)) ||
> die "error in ars_LoadQualifier";
>
> %entries = ars_GetListEntry($ctrl, $schema, $qual, 0);
>
> foreach $entry_id (sort keys %entries) {
> printf("%s %s\n", $entry_id, $entries{$entry_id});
> }
>
>
> Thanks
> Ravi
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Arsperl-users mailing list
> Ars...@ar...
> https://lists.sourceforge.net/lists/listinfo/arsperl-users
>
|
|
From: Clayton S. <cla...@gm...> - 2007-08-09 18:28:23
|
Using "die" is just an example.
You could also "warn" and continue, or whatever you want.
Just check the value of $ars_errstr.
if ($ars_errstr){
# do what you need to do if there is an error
}
On 8/9/07, Jarl Gr=F8neng <jar...@gm...> wrote:
> I does not like the die parameter if you got an error. You may miss
> the clean-up part.
>
> -
> Jarl
>
> On 8/9/07, Thilo Stapff <thi...@ap...> wrote:
> > ars_GetListEntry needs at least one more parameter (firstRetrieve,
> > usually =3D 0):
> >
> > %entries =3D ars_GetListEntry($ctrl, $schema, $qual, 0 , 0);
> >
> > instead of
> >
> > %entries =3D ars_GetListEntry($ctrl, $schema, $qual, 0);
> >
> >
> > Moreover, you should always check for errors after calling an API
> > function, e.g.
> >
> > die "ars_GetListEntry( $schema, $qs ): $ars_errstr\n" if $ars_errstr=
;
> >
> >
> > You might also try using the field ID of "Category" instead of the fiel=
d
> > name in the qualifier string.
> >
> >
> > Regards,
> > Thilo Stapff
> >
> >
> > Ravi wrote:
> > > Hi:I am trying query a schema and print a fieldname and values for al=
l
> > > records with a qualifying filter. I can't seem to figure out which
> > > function to use and how. This is what I have now and I get 0 records.=
Is
> > > asr_GetListEntry the right function? Does someone have a sample scrip=
t
> > > or point me to the right one in the example dir?
> > >
> > > $schema =3D "My:Alarm Base";
> > > $qs =3D qq/'Category' =3D "Voice"/;
> > > ($qual =3D ars_LoadQualifier($ctrl,$schema,$qs)) ||
> > > die "error in ars_LoadQualifier";
> > >
> > > %entries =3D ars_GetListEntry($ctrl, $schema, $qual, 0);
> > >
> > > foreach $entry_id (sort keys %entries) {
> > > printf("%s %s\n", $entry_id, $entries{$entry_id});
> > > }
> > >
> > >
> > > Thanks
> > > Ravi
> > >
> > >
> > > ---------------------------------------------------------------------=
----
> > > This SF.net email is sponsored by: Splunk Inc.
> > > Still grepping through log files to find problems? Stop.
> > > Now Search log events and configuration files using AJAX and a browse=
r.
> > > Download your FREE copy of Splunk now >> http://get.splunk.com/
> > > _______________________________________________
> > > Arsperl-users mailing list
> > > Ars...@ar...
> > > https://lists.sourceforge.net/lists/listinfo/arsperl-users
> > >
> >
> >
> > -----------------------------------------------------------------------=
--
> > This SF.net email is sponsored by: Splunk Inc.
> > Still grepping through log files to find problems? Stop.
> > Now Search log events and configuration files using AJAX and a browser.
> > Download your FREE copy of Splunk now >> http://get.splunk.com/
> > _______________________________________________
> > Arsperl-users mailing list
> > Ars...@ar...
> > https://lists.sourceforge.net/lists/listinfo/arsperl-users
> >
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Arsperl-users mailing list
> Ars...@ar...
> https://lists.sourceforge.net/lists/listinfo/arsperl-users
>
--=20
Clayton Scott
cla...@gm...
|
|
From: <jar...@gm...> - 2007-08-09 18:44:49
|
How can I understand that this die is an example?
--
Jar=F8
On 8/9/07, Clayton Scott <cla...@gm...> wrote:
> Using "die" is just an example.
>
> You could also "warn" and continue, or whatever you want.
> Just check the value of $ars_errstr.
>
> if ($ars_errstr){
> # do what you need to do if there is an error
> }
>
> On 8/9/07, Jarl Gr=F8neng <jar...@gm...> wrote:
> > I does not like the die parameter if you got an error. You may miss
> > the clean-up part.
> >
> > -
> > Jarl
> >
> > On 8/9/07, Thilo Stapff <thi...@ap...> wrote:
> > > ars_GetListEntry needs at least one more parameter (firstRetrieve,
> > > usually =3D 0):
> > >
> > > %entries =3D ars_GetListEntry($ctrl, $schema, $qual, 0 , 0);
> > >
> > > instead of
> > >
> > > %entries =3D ars_GetListEntry($ctrl, $schema, $qual, 0);
> > >
> > >
> > > Moreover, you should always check for errors after calling an API
> > > function, e.g.
> > >
> > > die "ars_GetListEntry( $schema, $qs ): $ars_errstr\n" if $ars_errs=
tr;
> > >
> > >
> > > You might also try using the field ID of "Category" instead of the fi=
eld
> > > name in the qualifier string.
> > >
> > >
> > > Regards,
> > > Thilo Stapff
> > >
> > >
> > > Ravi wrote:
> > > > Hi:I am trying query a schema and print a fieldname and values for =
all
> > > > records with a qualifying filter. I can't seem to figure out which
> > > > function to use and how. This is what I have now and I get 0 record=
s. Is
> > > > asr_GetListEntry the right function? Does someone have a sample scr=
ipt
> > > > or point me to the right one in the example dir?
> > > >
> > > > $schema =3D "My:Alarm Base";
> > > > $qs =3D qq/'Category' =3D "Voice"/;
> > > > ($qual =3D ars_LoadQualifier($ctrl,$schema,$qs)) ||
> > > > die "error in ars_LoadQualifier";
> > > >
> > > > %entries =3D ars_GetListEntry($ctrl, $schema, $qual, 0);
> > > >
> > > > foreach $entry_id (sort keys %entries) {
> > > > printf("%s %s\n", $entry_id, $entries{$entry_id});
> > > > }
> > > >
> > > >
> > > > Thanks
> > > > Ravi
> > > >
> > > >
> > > > -------------------------------------------------------------------=
------
> > > > This SF.net email is sponsored by: Splunk Inc.
> > > > Still grepping through log files to find problems? Stop.
> > > > Now Search log events and configuration files using AJAX and a brow=
ser.
> > > > Download your FREE copy of Splunk now >> http://get.splunk.com/
> > > > _______________________________________________
> > > > Arsperl-users mailing list
> > > > Ars...@ar...
> > > > https://lists.sourceforge.net/lists/listinfo/arsperl-users
> > > >
> > >
> > >
> > > ---------------------------------------------------------------------=
----
> > > This SF.net email is sponsored by: Splunk Inc.
> > > Still grepping through log files to find problems? Stop.
> > > Now Search log events and configuration files using AJAX and a browse=
r.
> > > Download your FREE copy of Splunk now >> http://get.splunk.com/
> > > _______________________________________________
> > > Arsperl-users mailing list
> > > Ars...@ar...
> > > https://lists.sourceforge.net/lists/listinfo/arsperl-users
> > >
> >
> > -----------------------------------------------------------------------=
--
> > This SF.net email is sponsored by: Splunk Inc.
> > Still grepping through log files to find problems? Stop.
> > Now Search log events and configuration files using AJAX and a browser.
> > Download your FREE copy of Splunk now >> http://get.splunk.com/
> > _______________________________________________
> > Arsperl-users mailing list
> > Ars...@ar...
> > https://lists.sourceforge.net/lists/listinfo/arsperl-users
> >
>
>
> --
>
> Clayton Scott
> cla...@gm...
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Arsperl-users mailing list
> Ars...@ar...
> https://lists.sourceforge.net/lists/listinfo/arsperl-users
>
|
|
From: Thilo S. <thi...@ap...> - 2007-08-09 18:29:49
|
I'm not sure what you are talking about.
ARTermination() is always called on exit because ARS.xs implements a
destructor function for ARControlStructPtr objects.
Perl also closes filehandles automatically.
If you have other resources which need cleanup, you can wrap your code
into an "eval" block:
eval {
...
ars_GetListEntry( .... );
die "Error message\n" if $ars_errstr;
...
}
warn $@ if $@;
# do cleanup here
So, in my opinion, in most cases the use of "die" should be just fine.
Best regards,
Thilo
Jarl Grøneng wrote:
> I does not like the die parameter if you got an error. You may miss
> the clean-up part.
>
> -
> Jarl
>
> On 8/9/07, Thilo Stapff <thi...@ap...> wrote:
>> ars_GetListEntry needs at least one more parameter (firstRetrieve,
>> usually = 0):
>>
>> %entries = ars_GetListEntry($ctrl, $schema, $qual, 0 , 0);
>>
>> instead of
>>
>> %entries = ars_GetListEntry($ctrl, $schema, $qual, 0);
>>
>>
>> Moreover, you should always check for errors after calling an API
>> function, e.g.
>>
>> die "ars_GetListEntry( $schema, $qs ): $ars_errstr\n" if $ars_errstr;
>>
>>
>> You might also try using the field ID of "Category" instead of the field
>> name in the qualifier string.
>>
>>
>> Regards,
>> Thilo Stapff
>>
>>
>> Ravi wrote:
>>> Hi:I am trying query a schema and print a fieldname and values for all
>>> records with a qualifying filter. I can't seem to figure out which
>>> function to use and how. This is what I have now and I get 0 records. Is
>>> asr_GetListEntry the right function? Does someone have a sample script
>>> or point me to the right one in the example dir?
>>>
>>> $schema = "My:Alarm Base";
>>> $qs = qq/'Category' = "Voice"/;
>>> ($qual = ars_LoadQualifier($ctrl,$schema,$qs)) ||
>>> die "error in ars_LoadQualifier";
>>>
>>> %entries = ars_GetListEntry($ctrl, $schema, $qual, 0);
>>>
>>> foreach $entry_id (sort keys %entries) {
>>> printf("%s %s\n", $entry_id, $entries{$entry_id});
>>> }
>>>
>>>
>>> Thanks
>>> Ravi
>>>
>>>
>>> -------------------------------------------------------------------------
>>> This SF.net email is sponsored by: Splunk Inc.
>>> Still grepping through log files to find problems? Stop.
>>> Now Search log events and configuration files using AJAX and a browser.
>>> Download your FREE copy of Splunk now >> http://get.splunk.com/
>>> _______________________________________________
>>> Arsperl-users mailing list
>>> Ars...@ar...
>>> https://lists.sourceforge.net/lists/listinfo/arsperl-users
>>>
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by: Splunk Inc.
>> Still grepping through log files to find problems? Stop.
>> Now Search log events and configuration files using AJAX and a browser.
>> Download your FREE copy of Splunk now >> http://get.splunk.com/
>> _______________________________________________
>> Arsperl-users mailing list
>> Ars...@ar...
>> https://lists.sourceforge.net/lists/listinfo/arsperl-users
>>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Arsperl-users mailing list
> Ars...@ar...
> https://lists.sourceforge.net/lists/listinfo/arsperl-users
>
|
|
From: <jar...@gm...> - 2007-08-09 18:43:20
|
You can not be sure if an external module does the correct cleanup on
die. Therefore, a controlled shutdown is always good practice.
--
Jarl
On 8/9/07, Thilo Stapff <thi...@ap...> wrote:
> I'm not sure what you are talking about.
>
> ARTermination() is always called on exit because ARS.xs implements a
> destructor function for ARControlStructPtr objects.
>
> Perl also closes filehandles automatically.
>
> If you have other resources which need cleanup, you can wrap your code
> into an "eval" block:
>
>
> eval {
> ...
>
> ars_GetListEntry( .... );
> die "Error message\n" if $ars_errstr;
>
> ...
> }
>
> warn $@ if $@;
>
> # do cleanup here
>
>
> So, in my opinion, in most cases the use of "die" should be just fine.
>
>
> Best regards,
> Thilo
>
>
> Jarl Gr=F8neng wrote:
> > I does not like the die parameter if you got an error. You may miss
> > the clean-up part.
> >
> > -
> > Jarl
> >
> > On 8/9/07, Thilo Stapff <thi...@ap...> wrote:
> >> ars_GetListEntry needs at least one more parameter (firstRetrieve,
> >> usually =3D 0):
> >>
> >> %entries =3D ars_GetListEntry($ctrl, $schema, $qual, 0 , 0);
> >>
> >> instead of
> >>
> >> %entries =3D ars_GetListEntry($ctrl, $schema, $qual, 0);
> >>
> >>
> >> Moreover, you should always check for errors after calling an API
> >> function, e.g.
> >>
> >> die "ars_GetListEntry( $schema, $qs ): $ars_errstr\n" if $ars_errst=
r;
> >>
> >>
> >> You might also try using the field ID of "Category" instead of the fie=
ld
> >> name in the qualifier string.
> >>
> >>
> >> Regards,
> >> Thilo Stapff
> >>
> >>
> >> Ravi wrote:
> >>> Hi:I am trying query a schema and print a fieldname and values for al=
l
> >>> records with a qualifying filter. I can't seem to figure out which
> >>> function to use and how. This is what I have now and I get 0 records.=
Is
> >>> asr_GetListEntry the right function? Does someone have a sample scrip=
t
> >>> or point me to the right one in the example dir?
> >>>
> >>> $schema =3D "My:Alarm Base";
> >>> $qs =3D qq/'Category' =3D "Voice"/;
> >>> ($qual =3D ars_LoadQualifier($ctrl,$schema,$qs)) ||
> >>> die "error in ars_LoadQualifier";
> >>>
> >>> %entries =3D ars_GetListEntry($ctrl, $schema, $qual, 0);
> >>>
> >>> foreach $entry_id (sort keys %entries) {
> >>> printf("%s %s\n", $entry_id, $entries{$entry_id});
> >>> }
> >>>
> >>>
> >>> Thanks
> >>> Ravi
> >>>
> >>>
> >>> ---------------------------------------------------------------------=
----
> >>> This SF.net email is sponsored by: Splunk Inc.
> >>> Still grepping through log files to find problems? Stop.
> >>> Now Search log events and configuration files using AJAX and a browse=
r.
> >>> Download your FREE copy of Splunk now >> http://get.splunk.com/
> >>> _______________________________________________
> >>> Arsperl-users mailing list
> >>> Ars...@ar...
> >>> https://lists.sourceforge.net/lists/listinfo/arsperl-users
> >>>
> >>
> >> ----------------------------------------------------------------------=
---
> >> This SF.net email is sponsored by: Splunk Inc.
> >> Still grepping through log files to find problems? Stop.
> >> Now Search log events and configuration files using AJAX and a browser=
.
> >> Download your FREE copy of Splunk now >> http://get.splunk.com/
> >> _______________________________________________
> >> Arsperl-users mailing list
> >> Ars...@ar...
> >> https://lists.sourceforge.net/lists/listinfo/arsperl-users
> >>
> >
> > -----------------------------------------------------------------------=
--
> > This SF.net email is sponsored by: Splunk Inc.
> > Still grepping through log files to find problems? Stop.
> > Now Search log events and configuration files using AJAX and a browser.
> > Download your FREE copy of Splunk now >> http://get.splunk.com/
> > _______________________________________________
> > Arsperl-users mailing list
> > Ars...@ar...
> > https://lists.sourceforge.net/lists/listinfo/arsperl-users
> >
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Arsperl-users mailing list
> Ars...@ar...
> https://lists.sourceforge.net/lists/listinfo/arsperl-users
>
|