[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [GT] change to Templates/{portfolio_historic.mhtml,portfolio_positions.mhtml}



Robert A. Schmied wrote:
gt'ers and Matthew Jurgens

i'm not sure i have the full grasp on templates and the structures
of the *.mpl and *.mhtml file formats, but without the change
noted below i was getting "Use of uninitialized value in string ne ..."
for portfolio_historic.mhtml (line 41) and portfolio_positions.mhtml (line 42)
for each position (either open or closed), when using templates to
format the results.

the portfolio i've been using with this is my actual positions constructed
using either command line transaction input, file input or the db input
methods to populate it. as a result the position and order records may
be incomplete/incorrect.

although i see some use of the methods set_submission_date and submission_date
i don't see any reference to the hash key 'submission_date' anywhere in the
gt source tree.

oops -- hash key 'submission_date' is set in Templates/portfolio_historic.mpl
and Templates/portfolio_positions.mpl. so changing it to something else
is not correct.

maybe it needs to be initialized for every instance? but it always appears
to be set to a valid date.

or maybe the loop statement in portfolio_{historic,positions}.mhtml should
be a foreach construct akin to
  for my $order ( key $row->{'orderlist'} )

humm -- we kinda want them in date order though ...

yep -- methinks that it's the index var $i that is causing the problem ...
removing the conditional (e.g. ne "") is the simplest correct fix.

but it might be less confusing (for maintenance) to change the while statement to
% while ( $row->{'orderlist'}[$i] ) {
since the red-herring of ->{'submission_date'} isn't really necessary
to list each order list hash value.


aloha

ras


any way, the change i made to both files (only to eliminate the warning)
Templates/portfolio_historic.mhtml
Templates/portfolio_positions.mhtml

i don't yet know if this change is ok or not.

- % while ($row->{'orderlist'}[$i]->{'submission_date'} ne "") {;
+ % while ( $row->{'orderlist'}[$i]->{'submission_date'} ) {;

Matthew Jurgens, if you are still interested, since this appears to
be your handiwork, should the hash key {'submission_date'} be {'date'}
or something else or has something not been fully patched?


aloha

ras