R
Rainer Weikusat
I've just encountered the first situation where the 'obvious solution'
involves a blessed code references: I have a subsystem returning a
closure which returns the names of PNG-files depicting QR-codes while
creating the files as a side effect. I'd like to use a dedicated process
for actual PNG generation so that this can be done in parallell with
'other activities' of the same program. The ultimate output of this code
is a PDF document containing the QR-code images, hence, it is necessary
to wait until this coprocess has finished its work before generating the
PDF. The simple solution to this seems to be to bless the returned coderef
into a package whose DESTROY method waits for the corprocess.
As soon as this is implemented, I will have used all kinds of 'ordinary
references' available in Perl as objects at one point or another.
involves a blessed code references: I have a subsystem returning a
closure which returns the names of PNG-files depicting QR-codes while
creating the files as a side effect. I'd like to use a dedicated process
for actual PNG generation so that this can be done in parallell with
'other activities' of the same program. The ultimate output of this code
is a PDF document containing the QR-code images, hence, it is necessary
to wait until this coprocess has finished its work before generating the
PDF. The simple solution to this seems to be to bless the returned coderef
into a package whose DESTROY method waits for the corprocess.
As soon as this is implemented, I will have used all kinds of 'ordinary
references' available in Perl as objects at one point or another.