-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 At 11:50 AM +0200 5/13/98, Matthias Ulrich Neeracher wrote: } Xah Lee <xah@best.com> writes: } >Can anyone show me how to write the following function in *both* MacPerl }and L } inux? } > } ># &getWebContent('url') returns a string that is the web content (html }text) a } t the specified url. Example: $content getWebContent('http://www.apple.com'); } } use LWP::Simple; } } $content = get('http://www.apple.com'); Yes, folks, it's just that simple. With one caveat: libwww-perl-5 returns Unix text. (There's one exception to that rule, LWP::Simple::getprint().) So if you want the text in $content to be native, you do one more thing: $content =~ s/\012/\n/g; This is, of course, a no-op on Linux, so you might actually want $content =~ s/\012/\n/g if $^O eq "MacOS"; One nice thing about LWP::Simple is that for purely simple requests, it bypasses the rest of LWP entirely. Matthias' script, which I just ran, used only about 2 Mb of MacPerl's partition. My normal LWP scripts take about 6Mb before they start running. } } Matthias } } -- } Matthias Neeracher <neeri@iis.ee.ethz.ch> }http://www.iis.ee.ethz.ch/~neeri } "One fine day in my odd past..." -- Pixies, _Planet of Sound_ - ----- Paul J. Schinder schinder@pobox.com -----BEGIN PGP SIGNATURE----- Version: PGP for Personal Privacy 5.0 Charset: noconv iQA/AwUBNVmOu1ZaVc52j0XhEQJFdACfeJ89tFIDw2BFXUeddODvKaNVQLsAnRol 47l3VT8seFTbAyrrlqLxUgRZ =VTFl -----END PGP SIGNATURE----- ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch