Dotfiles, utilities, and other apparatus.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
666 B

  1. #!/usr/bin/env perl
  2. use warnings;
  3. use strict;
  4. use 5.10.0;
  5. use URI;
  6. my @samples = (
  7. 'http://www.perl.com',
  8. 'http://www.perl.com/#somebullshit',
  9. 'file:///home/brennen/p1k3',
  10. 'urn:vimwiki:p1k3',
  11. 'mailto:example@example.com',
  12. 'example@example.com',
  13. );
  14. foreach my $sample (@samples) {
  15. my $u = URI->new($sample);
  16. say "";
  17. say $sample . " :::::: ";
  18. say "scheme\t" . $u->scheme;
  19. # this'll explode if there's no authority
  20. # say "authority\t" . $u->authority;
  21. say "opaque\t" . $u->opaque;
  22. say "path:\t" . $u->path;
  23. say "fragment:\t" . $u->fragment;
  24. say "recognized?\t" . $u->has_recognized_scheme;
  25. say "canonical:\t" . $u->canonical;
  26. }