<p>I'm currently using the module <code>URI::URL</code> to generate a full URL from a relative URL; however, it isn't running as fast as I'd like it to be. Does anyone know another way to do this that may be faster?</p>

[{'answer_id': 26894, 'author': 'Brendan', 'author_id': 199, 'author_profile': 'https://Stackoverflow.com/users/199', 'pm_score': 0, 'selected': False, 'text': "<p>Perhaps I got the wrong end of the stick but wouldn't,</p>\n\n<pre><code>$full_url = $base_url . $relative_url</code></pre>\n\n<p>work? IIRC Perl text processing is pretty quick.</p>\n\n<p><i>@lennysan</i> Ah sure yes of course. Sorry I can't help, my Perl is pretty rusty.</p>\n"}, {'answer_id': 26960, 'author': 'Peter Stuifzand', 'author_id': 1633, 'author_profile': 'https://Stackoverflow.com/users/1633', 'pm_score': 3, 'selected': True, 'text': '<p>The following code should work.</p>\n\n<pre><code>$uri = URI-&gt;new_abs( $str, $base_uri )\n</code></pre>\n\n<p>You should also take a look at <a href="http://search.cpan.org/dist/URI/URI.pm" rel="nofollow noreferrer">the URI page on search.cpan.org</a>.</p>\n'}, {'answer_id': 26974, 'author': 'lennysan', 'author_id': 2901, 'author_profile': 'https://Stackoverflow.com/users/2901', 'pm_score': 1, 'selected': False, 'text': '<p>Brendan, I should have clarified that I can\'t guarantee what the relative path is going to look like. It could be pretty tricky (e.g. has a slash at the front, doesn\'t have a slash, has "../", etc).</p>\n\n<p>Peter, that\'s what I\'m using now. Or is that faster then using the URI::URL->new($path)->abs?</p>\n'}, {'answer_id': 27993, 'author': 'Brendan', 'author_id': 199, 'author_profile': 'https://Stackoverflow.com/users/199', 'pm_score': 2, 'selected': False, 'text': '<p>Just happened across <a href="http://blog.vipul.net/2008/08/24/redhat-perl-what-a-tragedy/" rel="nofollow noreferrer">this article</a> which point out shortcomings in Redhat/Centos/Fedora implementations of Perl which affect <code>URI</code> profoundly.</p>\n<p>If you are running one of these Linux flavours, you might want to recompile Perl from original source (not RPM source).</p>\n<blockquote>\n<p>I realized that anyone running perl code with the distribution perl interpretter on Redhat 5.2, Centos 5.2 or Fedora 9 is likely a victim. Yes, even if your code doesn’t use the fancy bless/overload idiom, many CPAN modules do!  This google search shows 1500+ modules use the bless/overload idiom and they include some really popular ones like URI, JSON. ...</p>\n<p>... At this point, I decided to recompile perl from source.  The bug was gone.  And the difference was appalling.  Everything got seriously fast.  CPUs were chilling at a loadavg below 0.10 and we were processing data 100x to 1000x faster!</p>\n</blockquote>\n'}, {'answer_id': 31655, 'author': 'gmuslera', 'author_id': 3133, 'author_profile': 'https://Stackoverflow.com/users/3133', 'pm_score': 1, 'selected': False, 'text': '<p>Could depend a bit how you obtain those 2 strings. Probably the secure, fireproof way to do that is what is in URI::URL or similar libraries, where all alternatives, including malicious ones, would be considered. Maybe slower, but in some environments faster will be the speed of a bullet going to your own foot.</p>\n\n<p>But if you expect there something plain and not tricky could see if it starts with /, chains of ../, or any other char. The 1st would put the server name + the url, the 2nd chop paths from the base uri till getting in one of the other 2 alternatives, or just add it to the base url.</p>\n'}]
['https://Stackoverflow.com/questions/26855', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2901/']