The actual URI subclass that gets loaded depends on the scheme (for a string) or the type of object being passed to the constructor. Can you give an example of the type of url you're trying to load?
Are you sure $a will only be that? For example, 'ftp://blah.com' and 'https://somewhere.com' are valid strings for a URI which would blow up in your example since they use different schemes other than 'http'.
Perhaps a better strategy would be to let the URI module do that work for you since that's what it does best:
my $str = shift @_;
my $uri = URI->new($str);
$uri->scheme('http') unless $uri->scheme;
...