Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

The following script works, reading from the DATA section:

#! /usr/bin/perl -C255 use strict; use warnings; use LWP::Simple; use Encode 'decode'; use URL::Encode ':all'; use feature 'unicode_strings'; use utf8; use open ':encoding(UTF-8)'; open INFIL, "<:encoding(UTF-8)", "temp.txt" or die; #This line generat +es a warning. #while (<INFIL>) { while (<DATA>) { chomp; my $title = $_; $title =~ s/\/.*//; $title =~ s/\[by.*//; print "Title Searched: $title\n"; $title = url_encode_utf8($title); my $html = getprint("https://clio.columbia.edu/catalog?q=$title&se +arch_field=title_starts_with&f%5B-format%5D%5B%5D=Online&commit=Searc +h") or die; } exit; __DATA__ How to conduct your own survey / Priscilla Salant and Don A. Dillman.

But, if I change it to read from a file, like so:

#! /usr/bin/perl -C255 use strict; use warnings; use LWP::Simple; use Encode 'decode'; use URL::Encode ':all'; use feature 'unicode_strings'; use utf8; use open ':encoding(UTF-8)'; open INFIL, "<:encoding(UTF-8)", "temp.txt" or die; #while (<DATA>) { ###CHANGE HERE### while (<INFIL>) { chomp; my $title = $_; $title =~ s/\/.*//; $title =~ s/\[by.*//; print "Title Searched: $title\n"; $title = url_encode_utf8($title); my $html = getprint("https://clio.columbia.edu/catalog?q=$title&se +arch_field=title_starts_with&f%5B-format%5D%5B%5D=Online&commit=Searc +h") or die; } exit; __DATA__ How to conduct your own survey / Priscilla Salant and Don A. Dillman.

I get the error: 501 Protocol scheme 'https' is not supported (LWP::Protocol::https not installed) <URL:https://clio.columbia.edu/catalog?q=How+to+conduct+your+own+survey+&search_field=title_starts_with&f%5B-format%5D%5B%5D=Online&commit=Search>

The input file contains only a single line, the same as the DATA section.

I've tried this on both Strawberry Perl 5.24.1 and Cygwin Perl 5.22.3

All feedback appreciated.

Thanks, Michael


In reply to Odd LWP Problem by mdkoehn

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2022-01-23 19:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (64 votes). Check out past polls.

    Notices?