I'm writing a Mojolicious application that will bulk load transactions into
ERP system. The user will upload an Excel spreadsheet with multiple
worksheets in it.
Each worksheet will contain data needed to execute screen transactions in
the ERP, typically
one transaction per worksheet row. There are a dozen or so different
worksheet types each
of which does different ERP transactions. A workbook can contain several
There is code in the model that translates the spreadsheet contents into an
array. Each entry
in the array represents a worksheet and contains an array for the rows from
that worksheet plus
other attributes like the appropriate template name etc.
There is a Mojolicious template for each worksheet type. The templates
contain code that
loop though the rows in the array entry whose address is passed via the
stash, executing The
ERP screens as needed and writing transaction level status info to an
output Excel workbook.
The controller loops through the data array sequentially calling render on
the template name indicated
in the array for each entry.
The ERP transactions can take a second or more to execute for each row in a
worksheet and there
can be hundreds (occasionally thousands) of rows in a worksheet.
This would lead to long periods of time where the user would see nothing
going on and, unless
the timeout was set to some ridiculous value, timeouts will occur. To get
around that I thought
that I would present an html table for each worksheet, row by row, on the
browser showing the worksheet name, row number
and transaction status as the process works its way through the array. I
added code to do that in each template.
That kinda works, however, the write_chunk('stuff',$cb) being non-blocking
causes the controller to
zip through all of the arrays very quickly and all of the html tables get
munged together instead of
appearing as separate tables presented chronologically as the workbook
content is processed. Using
write_chunk without a callback causes the entire page to be rendered at the
end of the process which
doesn't achieve my goal of keeping the user aware of how her transactions
Is there any way to get Mojolicious to flush chunks of html to the browser
without entering non-blocking
mode so that the output from the various templates can be rendered
sequentially and chronologically in 'real time'?
You received this message because you are subscribed to the Google Groups
To unsubscribe from this group and stop receiving emails from it, send an email
To post to this group, send email to email@example.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.