"Are there other ways to avoid string copies besides using references?"

There are the ugly ones, like storing the string in a global variable and not passing it around at all; just acting upon the global instance of it.

The reference approach is probably a better solution.

"Does it make sense to submit enhancement requests to these standard modules to have the possibility to get the result by reference?"

It makes more sense to submit patches that implement your request in a way that doesn't forcibly export anything additional, and doesn't cause the modules to fail their existing test suite. Additionally, you would want to include a full set of tests for the patch you submitted, along with a POD patch. In other words, you're providing the added functionality, not wrecking code that uses the module (not exporting anything new by default), not wrecking the module itself (it still passes its test suite), and providing your own proof that your patches work, and full documentation.

If that doesn't get anyone's attention, subclass the module in question, or for non-OO modules, write a wrapper module that adds your functionality while passing through all the old functionality too. Upload to CPAN.


Dave


In reply to Re: How to avoid string copies in function calls? by davido
in thread How to avoid string copies in function calls? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.