HTML::...:Links(3pm)

πŸ’– NAME πŸ’–

HTML::RewriteAttributes::Links β€” link rewriting but make it concise ✨

So this is a User Contributed Perl Documentation page (you know, the 3pm girlies πŸ‘‘) for HTML::RewriteAttributes::Links, and bestie, it does exactly one thing and it eats every time: rewriting links inside your HTML. πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

# up for some HTML::ResolveLink?
$html = HTML::RewriteAttributes::Links->rewrite($html, "http://search.cpan.org");

# or perhaps HTML::LinkExtor?
HTML::RewriteAttributes::Links->rewrite($html, sub {
    my ($tag, $attr, $value) = @_;
    push @links, $value;
    $value;
});

okay so literally just two vibes up there ⭐ β€” pass a base URL string, or pass a callback. that's the whole synopsis. we love a low-effort icon. πŸ¦‹


🌸 DESCRIPTION 🌸

HTML::RewriteAttributes::Links is a special case of HTML::RewriteAttributes, and its whole personality is rewriting links. that's it. that's the job. 😌

If you wanna see what you can actually do with this, go peek at HTML::ResolveLink and HTML::LinkExtor β€” they're the examples, they're the moment, they're giving inspiration. πŸ’–


✨ METHODS ✨

πŸ’« new

You do not need to call new yourself β€” it's already been done inside rewrite. it takes no arguments. zero. nada. it's a no-notes king. πŸ‘‘

🫢 rewrite HTML, (callback|base)[, args] -> HTML

rewrite HTML, (callback|base)[, args] -> HTML

Go read the docs for HTML::RewriteAttributes for the deets, bestie β€” this is the same energy. πŸ“š

But here's the plot twist: instead of a callback, you can pass a string. When you do that, it mimics the behavior of HTML::ResolveLink β€” meaning relative links get rewritten using the given string as a base URL. slay. πŸŽ€


πŸ‘€ SEE ALSO πŸ‘€

  • HTML::RewriteAttributes
  • HTML::Parser
  • HTML::ResolveLink
  • HTML::LinkExtor

go read them fr fr, iykyk 🌈


πŸ’Œ AUTHOR πŸ’Œ

Best Practical Solutions, LLC <modules@bestpractical.com> πŸ’œ


πŸ“œ LICENSE πŸ“œ

Copyright 2008-2024 Best Practical Solutions, LLC.

HTML::RewriteAttributes::Links is distributed under the same terms as Perl itself. πŸ“


and that's the whole page, bestie!! no cap. this one's from perl v5.40.0, dated 2024-11-15 β€” ty for coming to my ted talk, mwah πŸ’‹βœ¨πŸ¦‹πŸ’–

πŸ“¦ where this page comes from