"Fossies" - the Fresh Open Source Software Archive

Member "install-tl-20200916/tlpkg/tlperl/site/lib/URI/IRI.pm" (10 Mar 2019, 794 Bytes) of package /windows/misc/install-tl.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 package URI::IRI;
    2 
    3 # Experimental
    4 
    5 use strict;
    6 use warnings;
    7 use URI ();
    8 
    9 use overload '""' => sub { shift->as_string };
   10 
   11 our $VERSION = '1.76';
   12 
   13 sub new {
   14     my($class, $uri, $scheme) = @_;
   15     utf8::upgrade($uri);
   16     return bless {
   17     uri => URI->new($uri, $scheme),
   18     }, $class;
   19 }
   20 
   21 sub clone {
   22     my $self = shift;
   23     return bless {
   24     uri => $self->{uri}->clone,
   25     }, ref($self);
   26 }
   27 
   28 sub as_string {
   29     my $self = shift;
   30     return $self->{uri}->as_iri;
   31 }
   32 
   33 our $AUTOLOAD;
   34 sub AUTOLOAD
   35 {
   36     my $method = substr($AUTOLOAD, rindex($AUTOLOAD, '::')+2);
   37 
   38     # We create the function here so that it will not need to be
   39     # autoloaded the next time.
   40     no strict 'refs';
   41     *$method = sub { shift->{uri}->$method(@_) };
   42     goto &$method;
   43 }
   44 
   45 sub DESTROY {}   # avoid AUTOLOADing it
   46 
   47 1;