xml code with Base64
Fairlight
fairlite at fairlite.com
Mon Jun 7 08:47:20 PDT 2004
>From inside the gravity well of a singularity, Enrique Arredondo shouted:
>
> How in the world can I do that within a filepro report ? I believe the
Within a -report- report? Doubtful you can, to my knowledge. Within a
processing-only report, I'd just use open() and write().
> while (read(FILE, $buf, 60 * 57)) {
> print encode_base64($buf);
> }
That's actually pretty inefficient, thanks to the documentation.
while (read(FILE, $buf, 8192, length($buf))) {}
print encode_base64($buf);
ONE call to encode_base64, and -much- larger reads. If you had a several
hundred kilobyte image, this should make operation much faster. Yes, I
know what the POD for MIME::Base64 says--I just re-read it. They also
show alternate operations where they operate on an entire stream without
breaking it down the way the first example shows, where you couldn't
possibly know the entire size. Their rationale for the first tiny-bite
method seems esoteric. I've never had a problem encoding entire files all
at once.
I'd be curious to know if one of the other perl wizards here can give a
-good- reason for doing it the slower way.
mark->
--
Bring the web-enabling power of OneGate to -your- filePro applications today!
Try the live filePro-based, OneGate-enabled demo at the following URL:
http://www2.onnik.com/~fairlite/flfssindex.html
More information about the Filepro-list
mailing list