mirror of
https://github.com/NixOS/nix
synced 2025-06-25 02:21:16 +02:00
Fix perl example
The perl example does not work with http://nixos.org because it redirects. Updating the url to https requires additional package.
This commit is contained in:
parent
155411397d
commit
aa96bf2faf
1 changed files with 4 additions and 2 deletions
|
@ -242,16 +242,18 @@ print(t)
|
||||||
```
|
```
|
||||||
|
|
||||||
Similarly, the following is a Perl script that specifies that it
|
Similarly, the following is a Perl script that specifies that it
|
||||||
requires Perl and the `HTML::TokeParser::Simple` and `LWP` packages:
|
requires Perl and the `HTML::TokeParser::Simple`, `LWP` and
|
||||||
|
`LWP::Protocol::Https` packages:
|
||||||
|
|
||||||
```perl
|
```perl
|
||||||
#! /usr/bin/env nix-shell
|
#! /usr/bin/env nix-shell
|
||||||
#! nix-shell -i perl --packages perl perlPackages.HTMLTokeParserSimple perlPackages.LWP
|
#! nix-shell -i perl --packages perl perlPackages.HTMLTokeParserSimple perlPackages.LWP
|
||||||
|
#! nix-shell -i perl --packages perl perlPackages.HTMLTokeParserSimple perlPackages.LWP perlPackages.LWPProtocolHttps
|
||||||
|
|
||||||
use HTML::TokeParser::Simple;
|
use HTML::TokeParser::Simple;
|
||||||
|
|
||||||
# Fetch nixos.org and print all hrefs.
|
# Fetch nixos.org and print all hrefs.
|
||||||
my $p = HTML::TokeParser::Simple->new(url => 'http://nixos.org/');
|
my $p = HTML::TokeParser::Simple->new(url => 'https://nixos.org/');
|
||||||
|
|
||||||
while (my $token = $p->get_tag("a")) {
|
while (my $token = $p->get_tag("a")) {
|
||||||
my $href = $token->get_attr("href");
|
my $href = $token->get_attr("href");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue