[16313] in Perl-Users-Digest
Perl-Users Digest, Issue: 3725 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 18 10:48:12 2000
Date: Tue, 18 Jul 2000 07:47:59 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <963931679-v9-i3725@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 18 Jul 2000 Volume: 9 Number: 3725
Today's topics:
Re: Please criticise this text extraction script (Stephen Kloder)
Re: Please criticise this text extraction script (Jonathan Stowe)
Re: Please criticise this text extraction script (Jonathan Stowe)
Re: Please criticise this text extraction script (Keith Calvert Ivey)
Re: Please criticise this text extraction script (rhys)
Please help me find script... ()
Re: Please help me find script... (Godzilla!)
Please help me this this ()
Re: Please help me this this (Tim Tompkins)
Posting bug reports = mail spam?? (Richard Lawrence)
Re: Posting bug reports = mail spam?? (Jonathan Stowe)
Re: PPM problems (Greg Griffiths)
Re: Prepared statement SQL (Jonathan Stowe)
Re: PRINTing " "" " (Abigail)
Re: PRINTing " "" " (Abigail)
Re: PRINTing " "" " (Larry Rosler)
Re: Printing web pages ()
problem adding modules with cpan (Brian Bohlmann)
Re: problem adding modules with cpan (NP)
Re: problem adding modules with cpan (Brian Bohlmann)
problem with socket/webmail client ()
Re: Problems running the perl debugger (Joe Brenner)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 16 Jul 2000 14:00:02 GMT
From: stephenk@cc.gatech.edu.bbs@openbazaar.net (Stephen Kloder)
Subject: Re: Please criticise this text extraction script
Message-Id: <3bQOg2$VK3@openbazaar.net>
rhys wrote:
> I would be grateful for suggestions on how I could have done this better
> (although I am pleased that I finally got it working at all).
>
> The objective is to extract email addresses from html pages - I have
> already used it to email British members of parliament!.
>
> I tried to use grep without spliting the HTML string but did not
> succeed. Is it necessary to split the HTML string into smaller discrete
> scalars?
>
> Also I am not pleased that there are so many embedded loops.
>
> Thanks for your suggestions.
>
> rhys
>
> #!/usr/bin/perl -w
>
> # Extracts email addresses embedded in (especially html) text
> # usage - $0 inputfilename outputfilename
>
> $infile = shift;
>
No error checking. What happens if the wrong number of parameters are entered?
>
> open(INFILE,"<$infile") or die "Unable to open \$infile $infile :
> $!\n";
> @lines = <INFILE>;
> close (INFILE);
>
> foreach $line(@lines)
>
Throwing the entire file into memory, then iterating over the array, line by line? Bad idea for large files. use while(<INFILE>) instead.
> {
> @split = split(/(\"|:|\<|\>)/,$line);
>
Although this could be more nicely written as split /[":<>]/, even that is unnecessary (and based on assumptions that aren't necessarily
true). Why not use a global match?
>
> $prev_match = "";
> foreach(@split)
> {
> if (/(\w+\.)*\w+@\w+(\.\w+)*/)
> # if matches email address ~ need to not create duplicate #
> array elements
> {
> if ($_ ne $prev_match)
> {
> push @emails, $_;
> $prev_match = $_;
> }
> }
> }
> }
>
This whole $prevmatch thing is also unnecessary and based on potentially false assumptions. If you don't want duplicate addresses, use a
hash. This also gives you the option of sorting addresses.
Just use /(\w+\.)*\w+@\w+(\.\w+)*/g and place all matching strings into a hash. This will grab multiple addresses on the same line not
separated by those delimeters.
>
> $outfile = shift;
> open(OUTFILE,">$outfile") or die "Unable to open \$outfile $outfile :
> $!\n";
> foreach $email(@emails)
> {
> print OUTFILE "$email\n"; # use join?
> }
> close OUTFILE;
Here you would use (keys %emails) instead of @emails, but you could also set $, to "\n" and print the entire array in one line.
--
Stephen Kloder | "I say what it occurs to me to say.
stephenk@cc.gatech.edu | More I cannot say."
Phone 404-874-6584 | -- The Man in the Shack
ICQ #65153895 | be :- think.
------------------------------
Date: 16 Jul 2000 18:10:08 GMT
From: gellyfish@gellyfish.com.bbs@openbazaar.net (Jonathan Stowe)
Subject: Re: Please criticise this text extraction script
Message-Id: <3bQVIa$ViB@openbazaar.net>
On 15 Jul 2000 18:27:15 GMT Decklin Foster wrote:
> rhys <rhys.tucker@dtn.ntl.com> writes:
>
>> $outfile = shift;
>> open(OUTFILE,">$outfile") or die "Unable to open \$outfile $outfile :
>> $!\n";
>
> Once again, bad; print to stdout. I want to be able to redirect or
> pipe the output and name multiple input files.
>
A general solution to this kind of thing is to check whether STDOUT is
redirected with -t and if it isnt then open STDOUT to the file :
if ( -t STDOUT )
{
open(STDOUT,">$outfile") || die "Cant reopen STDOUT to $outfile - $!\n";
}
Now do all output to STDOUT ...
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: 16 Jul 2000 18:10:07 GMT
From: gellyfish@gellyfish.com.bbs@openbazaar.net (Jonathan Stowe)
Subject: Re: Please criticise this text extraction script
Message-Id: <3bQVIY$VaD@openbazaar.net>
On Sat, 15 Jul 2000 18:07:45 +0000 rhys wrote:
> I would be grateful for suggestions on how I could have done this better
> (although I am pleased that I finally got it working at all).
>
> The objective is to extract email addresses from html pages - I have
> already used it to email British members of parliament!.
>
Spam is evil, even against MPs.
Your enterprise is foolish anyhow, parsing e-mail addresses from plain text
(you are treating the HTML as plain text here) is verging on the impossible,
there is a monstrous regular expression that makes an attempt to do this in
Mastering Regular Expressions and this has its limitations. I would also
recommend you to search Deja News for articles in this group discussing
the issue. Parsing HTML that you dont have any control over is also
something that is not recommended - there are modules for this which make
a better attempt than the regular expressions you are likely to come up
with.
The only reliable e-mail addresses that you are likely to get from HTML are
those that are marked as such by being in the HREF attribute of an A tag
with a mailto: scheme, of course these still might be invalid but they
are being presented as valid ....
The following snippet will get all such e-mail addresses from an HTML
document :
#!/usr/bin/perl -w
use strict;
use HTML::LinkExtor;
use URI;
# File given on command line or standard input
my $file = shift || '-';
my $parser = HTML::LinkExtor->new();
# We'll handle any problems in parse_file ourself
eval
{
$parser->parse_file($file);
};
if ($@)
{
die "Parsing of $file failed = $@\n";
}
foreach my $link ( $parser->links )
{
my ( $tag, %links ) = @{$link};
next unless $tag eq 'a';
if( exists $links{'href'} )
{
my $uri = URI->new($links{'href'});
next unless $uri->scheme eq 'mailto';
print $uri->to,"\n";
}
}
If I find that you have been spamming with this I will come round and
stuff Sanford Wallace's pony up your nose.
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: 16 Jul 2000 21:50:04 GMT
From: kcivey@cpcug.org.bbs@openbazaar.net (Keith Calvert Ivey)
Subject: Re: Please criticise this text extraction script
Message-Id: <3bQb5T$VLd@openbazaar.net>
Stephen Kloder <stephenk@cc.gatech.edu> wrote:
>Just use /(\w+\.)*\w+@\w+(\.\w+)*/g and place all matching strings into a hash.
That will only get some proportion of addresses and will
sometimes get pieces of addresses. And I'm not talking about
the bizarre geekish or comment-containing addresses people
usually post in these threads. Consider perfectly normal
addresses like jsmith@ohio-state.edu, which you turn into
jsmith@ohio. And you can have all sorts of characters other
than \w and . before the @ -- + is popular, for example.
If the original poster wants to use a regex to extract
addresses, he should read the FAQ and then consider carefully
whether a regex will meet his needs. If he decides to use one,
he'd better put some thought into the design (and read the
relevant RFCs) and be aware of its limitations.
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
(Free at last from the forced spamsig of
Newsfeeds.com, cursed be their name)
------------------------------
Date: 16 Jul 2000 22:30:03 GMT
From: rhys.tucker@dtn.ntl.com.bbs@openbazaar.net (rhys)
Subject: Re: Please criticise this text extraction script
Message-Id: <3bQc7S$W5p@openbazaar.net>
Jonathan Stowe wrote:
>
> On Sat, 15 Jul 2000 18:07:45 +0000 rhys wrote:
> > I would be grateful for suggestions on how I could have done this better
> > (although I am pleased that I finally got it working at all).
> >
> > The objective is to extract email addresses from html pages - I have
> > already used it to email British members of parliament!.
> >
>
> Spam is evil, even against MPs.
>
<snip>
I'm very grateful for all responses - my Perl skills are improving.
I don't agree that emailing MPs is spam. The point about spam is that
it's unrequested. MPs accept that they will be contacted by
constituents, lobbyists and special interest groups. It's part of the
job and seems to be the foundation of that abstract concept called
representative democracy.
regards,
rhys
------------------------------
Date: 17 Jul 2000 23:10:02 GMT
From: crfr_master@usa.net.bbs@openbazaar.net ()
Subject: Please help me find script...
Message-Id: <3bRSXQ$UaP@openbazaar.net>
Hello.
I am searching for a cgi script which can 'hide' or 'cloak' affiliate
links.
There are many websites using this, and the link usually looks like
that or
similiar:
http://www.domain.com/cgi-bin/redirect.cgi?ID=43
Please give me the script name, or place where I can find or buy such
script!
Thank you very much!
Mark R.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 17 Jul 2000 23:20:02 GMT
From: godzilla@stomp.stomp.tokyo.bbs@openbazaar.net (Godzilla!)
Subject: Re: Please help me find script...
Message-Id: <3bRSk3$SWM@openbazaar.net>
crfr_master@usa.net wrote:
> I am searching for a cgi script which can 'hide' or
> 'cloak' affiliate links. There are many websites
> using this, and the link usually looks like
> that or similiar:
> http://www.domain.com/cgi-bin/redirect.cgi?ID=43
> Please give me the script name, or place where I can
> find or buy such script!
Stuff ten crisp c-notes in an envelope
and snail mail them to me. Upon receipt,
I will tell you where you can find this
redirect.cgi script. It's name is kept
a secret for very clear reasons.
Godzilla!
--
$godzilla = "godzilla rocks!";
srand(time() ^ ($$ + ($$ << 15)));
sub randcase
{ rand(40) < 20 ? "\u$1" : "\l$1" ; }
$godzilla =~ s/([a-z])/randcase($1)/gie;
print $godzilla; exit;
------------------------------
Date: 17 Jul 2000 13:20:02 GMT
From: suzbik@btinternet.com.bbs@openbazaar.net ()
Subject: Please help me this this
Message-Id: <3bRDG2$RuK@openbazaar.net>
Hello,
I have been working on this script but i cannot get it to work properly.
The idea is that the customer enters their reference number and password
and the script looks it up from a flat file database.
The problem is that when i type in a reference number it will only find
the details if the reference number is 10233 (which is the first row)
if i try others then it doesnt work.
can someone tell me why?
The script is at: http://www.neighbourscan.co.uk/cgi-bin/check.pl
To see what it should look like enter 10233 as the ref number and the
passwod doesnt matter as i have not made it check that yet.
The code is at: http://www.neighbourscan.co.uk/check.txt
and the database is at: http://www.neighbourscan.co.uk/check-db.txt
Thankyou
Ben Periton
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 18 Jul 2000 05:30:02 GMT
From: ttompkins@uswest.net.bbs@openbazaar.net (Tim Tompkins)
Subject: Re: Please help me this this
Message-Id: <3bRcSQ$Xvq@openbazaar.net>
You may want to consider moving the close(LOGIN) statement outside of the
while loop.
You're closing the file after reading the first line :o)
Thanks,
Tim Tompkins
----------------------------------------------
Programmer / Staff Engineer
http://www.arttoday.com/
----------------------------------------------
<suzbik@btinternet.com> wrote in message news:8kv0cf$l9h$1@nnrp1.deja.com...
> Hello,
>
> I have been working on this script but i cannot get it to work properly.
>
> The idea is that the customer enters their reference number and password
> and the script looks it up from a flat file database.
>
> The problem is that when i type in a reference number it will only find
> the details if the reference number is 10233 (which is the first row)
> if i try others then it doesnt work.
>
> can someone tell me why?
>
> The script is at: http://www.neighbourscan.co.uk/cgi-bin/check.pl
> To see what it should look like enter 10233 as the ref number and the
> passwod doesnt matter as i have not made it check that yet.
>
> The code is at: http://www.neighbourscan.co.uk/check.txt
> and the database is at: http://www.neighbourscan.co.uk/check-db.txt
>
> Thankyou
>
> Ben Periton
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: 17 Jul 2000 08:50:02 GMT
From: ralawrence@my-deja.com.bbs@openbazaar.net (Richard Lawrence)
Subject: Posting bug reports = mail spam??
Message-Id: <3bR6EQ$VWA@openbazaar.net>
Hi,
After submitting a bug report to perl5-porters my work email address
was inundated with spam. After some searching I've come to the
conclusion that someone has been harvesting the email addresses of all
posts to the perl5-porters newsgroup.
Except that no-one has thought about munging any email addresses in the
messages. (A simple s/@/Z@Z/g probably would have sufficed)
Concequently as a result of my bug report I get on average 2 postings a
day which offer me instant money, pornography or viagra.
If I had known I was to be "rewarded" this way, I probably wouldn't
have bothered reporting the bug in the first place.
Before I start complaining to the perl5-porters, I'd like to know if
anyone else has had similar experiences? Or am I in the minority here?
Rich
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 18 Jul 2000 08:00:12 GMT
From: gellyfish@gellyfish.com.bbs@openbazaar.net (Jonathan Stowe)
Subject: Re: Posting bug reports = mail spam??
Message-Id: <3bRgOF$V0K@openbazaar.net>
On Mon, 17 Jul 2000 08:44:29 GMT Richard Lawrence wrote:
>
> After submitting a bug report to perl5-porters my work email address
> was inundated with spam. After some searching I've come to the
> conclusion that someone has been harvesting the email addresses of all
> posts to the perl5-porters newsgroup.
>
<snip>
>
> Before I start complaining to the perl5-porters, I'd like to know if
> anyone else has had similar experiences? Or am I in the minority here?
>
I dont think that complaining to p5p is really appropriate, after all it
is not they who do the spamming and not harvesting the addresses either.
Complain to the ISP from whence the spam originated or their upstream
provider. I guess it might be possible for the maintainers of the p5p
archive could devise a mechanism to prevent address harvesting, but they
might be more inclined to do so if assistance to do so were offered to them.
Quite honestly I know I do get spam but even relatively simple filters
prevent me from actually seeing the vast majority of it. I wouldnt
care to take a guess from where my address has been harvested though
- and I have sent bug-reports to p5p.
Your address could be harvested from anywhere just the same - it is an
unfortunate fact of internet life that there are these scumbags ( they
would describe themselves as legitimate business people) out there doing
this stuff. You might want to look at MJDs articles on spam-filtering on
<http://www.perl.com>.
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: 11 Jul 2000 19:40:09 GMT
From: greg2@surfaid.org.bbs@openbazaar.net (Greg Griffiths)
Subject: Re: PPM problems
Message-Id: <3bMcB8$XHs@openbazaar.net>
> READ THIS FIRST!
> *By the way*, (also pointed out by 'Rob'), did you read importent info about
> programs etc you had to
> install prior and patches after installation of ASPerl build 613? It's
> necessary to
> follow the receipt! I see you have done the ppmfix.
>
As far as I could tell on a clean win98 build you just needed to instlal the MS
Installer and then AP 613 and then the PPM hotfix.
>
> Strange that you have none ppm.log, but you have maybe never got the ppm
> running on that machine?!.
The error seems to occur during the PPM module, so I guess it dies before it
writes the log ?
>
> I use ActiveState perl 5.6.0 on my win98. Every time I run ppm (well, not
> often), ppm makes a PPM.LOG (Capital letters) in current directory. I run
> ppm using MSDOS command shell window.
>
> -Contents looks like this:
> -snip-
> ppm.bat: starting up... at Tue Jul 4 19:00:57 2000
> ppm.bat: starting up... at Tue Jul 4 19:01:18 2000
> ppm.bat: Wrote config file at Tue Jul 4 19:08:47 2000
> ppm.bat: starting up... at Tue Jul 4 19:08:53 2000
> ppm.bat: valid_URL_or_file: local/parallell-port.pdd.ppd is not valid at Tue
> Jul 4 19:12:31 2000
> ppm.bat: Could not locate a PPD file for package parallell-port.pdd at Tue
> Jul 4 19:12:31 2000
> ppm.bat: valid_URL_or_file: local/win32-serialport.ppd.ppd is not valid at
> Tue Jul 4 19:13:35 2000
> ppm.bat: Could not locate a PPD file for package win32-serialport.ppd at Tue
> Jul 4 19:13:35 2000
> ppm.bat: Removed repository HASH(0x93a157c) at Tue Jul 4 19:15:07 2000
> -cut-
>
> By the way, when I once set the repository using embracing one parameter
> with ", ppm also gave up and died. I had to go directly into config-file:
> '<perl-dir>\site\lib\ppm.xml' and correct it using an editor.
>
> There is an configPPM.pl, which most likely is run on installation, maybe
> that have failed. I dare not test it on my machine, since ppm works. Maybe
> others have something to add here. I feel ppm is not very well documented,
> foolproofed nor tested, although it's an importent program for win-users.
> Well, it's possible to do the work yourself, putting all the files in right
> dirs......
>
> Also, look into PPMConfig.html. There you might compare your ppm.xml against
> a sample. (If you are familiar to html/xml syntax)
>
> I *think* your problem lies in your "ppm.xml" -file, if you have clean
> conscience about the patches etc.
>
Have rebuild this using ppm genconfig and it still failed.
>
> Maybe it's easiest to remove ASPerl using
> Start->Setup->Controlpanel->Add/remove programs (Hope I'm correct, I use
> an norwegian version of win98), and reinstall it all together. Since your
> ppm isn't working, you probably havent installed much libs anyway.
have reinstalled twice with 519 and failed, each time using a clean Win98 build
(no extras, just Win and Office), reverted back to AP 509 and have no problems -
except the data and time I've lost to get back to where I was before I started.
>
>
> Regards
>
> --
> mvh
> Kåre Olai Lindbach
> (LLP - 955626397 MVA)
> + 47 61282501(home/job)
> + 47 61282502(fax)
> barbr-en@online.no
> # a perl programming man (ppm), it was?!.......;-)
------------------------------
Date: 17 Jul 2000 08:30:04 GMT
From: gellyfish@gellyfish.com.bbs@openbazaar.net (Jonathan Stowe)
Subject: Re: Prepared statement SQL
Message-Id: <3bR5bW$UWO@openbazaar.net>
In comp.lang.perl.misc brainmuffin@excite.com wrote:
> I am using mySQL as the database server. I have a Perl script that
> uses a prepared statement with variable substitution...that is, it
> has ? is it. Is there anyway to see the SQL statement it executes WITH
> the variables substituted??
>
There is no way that you can retrieve this in your program, but if you
have the appropriate degree of logging you will be able to record the
executed statements.
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: 17 Jul 2000 19:40:04 GMT
From: abigail@delanet.com.bbs@openbazaar.net (Abigail)
Subject: Re: PRINTing " "" "
Message-Id: <3bRNB6$VuU@openbazaar.net>
Jürgen Exner (juex@deja.com) wrote on MMDIX September MCMXCIII in
<URL:news:396f5258@news.microsoft.com>:
}}
}} - Do you also object to \n, \t, and their cousins? They are exactly the
}} same. Explicit newlines are not allowed in strings. Therefore you need a
}} different way to denote them. Explicit double quotes are not allowed in
}} strings. Therefore you need a different way to denote them. Why would you
}} want to tread a double quote differently then a newline?
Only language designers who can't parse their way out of a paper bag,
or who are truely evil and like to torment the programmer forbid
newlines in a string.
Perl, of course, allows newlines in strings.
Abigail
--
print v74.117.115.116.32;
print v97.110.111.116.104.101.114.32;
print v80.101.114.108.32;
print v72.97.99.107.101.114.10;
------------------------------
Date: 17 Jul 2000 19:40:05 GMT
From: abigail@delanet.com.bbs@openbazaar.net (Abigail)
Subject: Re: PRINTing " "" "
Message-Id: <3bRNBC$WG0@openbazaar.net>
Logan Shaw (logan@cs.utexas.edu) wrote on MMDX September MCMXCIII in
<URL:news:8kob8t$fo3$1@provolone.cs.utexas.edu>:
^^
^^ Um, how about this?
^^
^^ '"'
^^
^^ That's the shortest possible way to write a string that contains
^^ exactly one quote. (Well, o.k., it's not -- it's the shortest
^^ way to write such a string as a literal.)
This will do too:
v34
(in 5.6)
^^ Of course,
^^
^^ '"\n'
^^
^^ doesn't work out too well if you want to do that...
Nope. But this will:
'"
'
Abigail
--
tie $" => A; $, = " "; $\ = "\n"; @a = ("") x 2; print map {"@a"} 1 .. 4;
sub A::TIESCALAR {bless \my $A => A} # Yet Another silly JAPH by Abigail
sub A::FETCH {@q = qw /Just Another Perl Hacker/ unless @q; shift @q}
------------------------------
Date: 17 Jul 2000 21:30:03 GMT
From: lr@hpl.hp.com.bbs@openbazaar.net (Larry Rosler)
Subject: Re: PRINTing " "" "
Message-Id: <3bRQ4R$Xvk@openbazaar.net>
In article <slrn8mv16r.dun.abigail@alexandra.delanet.com> on 14 Jul 2000
17:05:52 EDT, Abigail <abigail@delanet.com> says...
> Jürgen Exner (juex@deja.com) wrote on MMDIX September MCMXCIII in
> <URL:news:396f5258@news.microsoft.com>:
> }}
> }} - Do you also object to \n, \t, and their cousins? They are exactly the
> }} same. Explicit newlines are not allowed in strings. Therefore you need a
> }} different way to denote them. Explicit double quotes are not allowed in
> }} strings. Therefore you need a different way to denote them. Why would you
> }} want to tread a double quote differently then a newline?
>
>
> Only language designers who can't parse their way out of a paper bag,
> or who are truely evil and like to torment the programmer forbid
> newlines in a string.
I'll trust Dennis Ritchie's ability to parse his way out of a paper bag,
and he is far too benign a person to torment programmers willy-nilly.
I believe that the design intent in C was to aid programmers by
obviating bugs caused by 'runaway' (unterminated) string constants.
Neither the limitation nor its rationale are mentioned in K&R.
The manual for B says: "[R]eal newlines (as opposed to escaped
newlines) are treated specially. ... If the newline is not preceded by a
'*', it is kept, but a warning message is issued, on the grounds that
you probably forgot the closing string quote." So the B 'warning'
quietly turned into a C 'fatal'. Not for lack of parsing ability or of
thought.
> Perl, of course, allows newlines in strings.
Larry Wall is clearly more libertarian than Dennis.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 11 Jul 2000 21:10:02 GMT
From: aaronp243@my-deja.com.bbs@openbazaar.net ()
Subject: Re: Printing web pages
Message-Id: <3bMeRR$UyN@openbazaar.net>
In article <8kg0bt$5s4$1@nnrp1.deja.com>,
u0107@cheerful.com wrote:
>
>
> This is how I accomplished printing a page.
>
> I use Perl to create the HTML code which is displayed using the
browser.
>
> In the browser, the following javascript code is used
>
> function print_a_page ()
> {
> window.print()
> }
>
> I use
> print 'function print_a_page()';
> print "\n";
> print '{';
> etc.....
>
> and a button in the html code has
>
> onClick="return print_a_page()"
>
> All of the javascript code can be in a common file which is included.
>
> hope this helps
>
> Uttam
>
> ----------------
>
> In article <8kfsig$2s1$1@nnrp1.deja.com>,
> aaronp243@my-deja.com wrote:
> > Hi! I am trying to print a web page using perl as if the web page
> were
> > being printed from netscape. I want to do this with perl because I
> have
> > to print out many of the web pages! Any ideas would be appreciated!
> > Thanks in advance.
> >
> > -Aaron
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
> >
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
That is not exactly what I had in mind. I am trying to print the pages
without having to do anything. I have sooo many pages to print that
clicking on stuff would make it take too long. Thanks anyway though!
--Aaron
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 17 Jul 2000 19:10:04 GMT
From: bohlmann@uiuc.edu.bbs@openbazaar.net (Brian Bohlmann)
Subject: problem adding modules with cpan
Message-Id: <3bRMLS$W5j@openbazaar.net>
I apologize if this has been answered somewhere already. I am trying to
add
a module using cpan and get the following error. I'm currently running
Solaris8
with their bundled perl and gcc installed. Is there a way to get cpan to
use gcc
instead of cc or do I have some other problem?
cc -c -xO3 -xdepend -DVERSION=\"2.14\" -DXS_VERSION=\"2.14\" -KPIC -I/usr/perl5/5.00503/sun4-solaris/CORE ReadKey.c
/usr/ucb/cc: language optional software package not installed
*** Error code 1
make: Fatal error: Command failed for target `ReadKey.o'
/usr/ccs/bin/make -- NOT OK
Any help is appreciated.
-Brian
--
___________________________________________________
Brian Bohlmann, University of Illinois-Urbana
email: bohlmann@uiuc.edu phone: 217-244-5409
www: http://www.uiuc.edu/ph/www/bohlmann
------------------------------
Date: 17 Jul 2000 19:30:06 GMT
From: nvp@spamnothanks.speakeasy.org.bbs@openbazaar.net (NP)
Subject: Re: problem adding modules with cpan
Message-Id: <3bRMkc$ViH@openbazaar.net>
On Mon, 17 Jul 2000 14:14:14 -0500, Brian Bohlmann <bohlmann@uiuc.edu> wrote:
:
: cc -c -xO3 -xdepend -DVERSION=\"2.14\" -DXS_VERSION=\"2.14\" -KPIC -I/usr/perl5/5.00503/sun4-solaris/CORE ReadKey.c
: /usr/ucb/cc: language optional software package not installed
: *** Error code 1
: make: Fatal error: Command failed for target `ReadKey.o'
: /usr/ccs/bin/make -- NOT OK
Looks like you don't have a working 'cc' installed.
Try this instead:
prompt$ perl Makefile.PL CC=gcc
-OR-
prompt$ CC=gcc ; export CC
prompt$ perl Makefile.PL
--
Nate II
------------------------------
Date: 17 Jul 2000 21:40:02 GMT
From: bohlmann@uiuc.edu.bbs@openbazaar.net (Brian Bohlmann)
Subject: Re: problem adding modules with cpan
Message-Id: <3bRQH2$W82@openbazaar.net>
I tried your suggestions but it seems that the "cpan" modules want to use cc
and not gcc as I got compiler errors. Does anyone know if cpan modules
can use gcc?
gcc -c -xO3 -xdepend -DVERSION=\"2.14\" -DXS_VERSION=\"2.14\" -KPIC -I/usr/perl5/5.00503/sun4-solaris/CORE ReadKey.c
gcc: unrecognized option `-KPIC'
gcc: language depend not recognized
gcc: ReadKey.c: linker input file unused since linking not done
Running Mkbootstrap for Term::ReadKey ()
chmod 644 ReadKey.bs
LD_RUN_PATH="" cc -o blib/arch/auto/Term/ReadKey/ReadKey.so -G ReadKey.o
/usr/ucb/cc: language optional software package not installed
*** Error code 1
make: Fatal error: Command failed for target `blib/arch/auto/Term/ReadKey/ReadKey.so'
thanks again
-Brian
NP wrote:
> On Mon, 17 Jul 2000 14:14:14 -0500, Brian Bohlmann <bohlmann@uiuc.edu> wrote:
> :
> : cc -c -xO3 -xdepend -DVERSION=\"2.14\" -DXS_VERSION=\"2.14\" -KPIC -I/usr/perl5/5.00503/sun4-solaris/CORE ReadKey.c
> : /usr/ucb/cc: language optional software package not installed
> : *** Error code 1
> : make: Fatal error: Command failed for target `ReadKey.o'
> : /usr/ccs/bin/make -- NOT OK
>
> Looks like you don't have a working 'cc' installed.
>
> Try this instead:
>
> prompt$ perl Makefile.PL CC=gcc
>
> -OR-
>
> prompt$ CC=gcc ; export CC
> prompt$ perl Makefile.PL
>
> --
> Nate II
------------------------------
Date: 18 Jul 2000 00:00:01 GMT
From: fgont@my-deja.com.bbs@openbazaar.net ()
Subject: problem with socket/webmail client
Message-Id: <3bRU03$Tnc@openbazaar.net>
Hi!
I've made a cgi-script to be able to read a POP3 account.
I've this problem: When I try to get the "From" line of an e-mail
header, I get only the first content of the "From:" field.
For example, suppose that the header of a message has the following
line:
From: "Fernando Ariel Gont" <fernandogont@softhome.net>
Well, my script will only get "Fernando Ariel Gont" (i.e., it will
not get the string "<fernandogont@softhome.net>").
I thought that the problem was in how I splitted the "From:" line.
But I've found that my cgi-script NEVER GETs the complete line.
That means, when it does a:
$_ = <SOCKFD>;
It gets 'From: "Fernando Ariel Gont"' and not the complete line.
Can any of you help me?
(At the bottom of this message you'll find the source code)
Kind Regards,
Fernando Ariel Gont
e-mail: fgont@SPAMSUCKS.softhome.net
#!/usr/bin/perl
use Socket;
$port = 110;
$ip = ""; # You must set it to the POP3 server IP address
$usr= ""; # You must set it to the POP3 username
$pwd= ""; # You must set it to the POP3 password for username
undef @size;
undef @date;
undef @mid;
undef @from;
undef @to;
undef @subject;
print "Content-type: text/html\n\n";
if(&login() == 0){
print "Successfully logged in!<BR>";
}
if(&listmsgs() == 0){
print "Messages successfully LISTed!<BR>";
}
$nsize = scalar(@size);
&getfields();
if(&logout() == 0){
print "Successfully QUIT from server!<BR>";
}
print "<TABLE>";
for($temp=1; $temp<$nsize; $temp++){
print "<TR><TD>$temp<TD>@from[$temp]<TD>@size[$temp]<TD>@subject
[$temp]</TR>";
}
print "</TABLE></BODY></HTML>";
exit(0);
sub logout(){
print SOCKFD "QUIT\n";
$_= <SOCKFD>;
close (SOCKFD);
if(/\+OK/){
return(0);
}
else{
return(1);
}
}
sub listmsgs(){
print SOCKFD "LIST\n";
$_=<SOCKFD>;
if(/\+OK/){
for($temp=1; ;$temp=$temp+1){
$_= <SOCKFD>;
if(/\.\s+/){
last;
}
else {
($trash, $tam) = split /\s/, $_, 2;
chop($tam);
@size[$temp] = $tam;
}
}
return(0);
}
else{
return(1);
}
}
sub getfields(){
for($temp = 1; $temp<($nsize+1); $temp=$temp+1){
print SOCKFD "TOP $temp 0\n";
$_=<SOCKFD>;
if(/\+OK/){ # TOP command successfully
executed
for($tp=0; ;$tp=$tp+1){
$_= <SOCKFD>;
if(/\A\.\s+/){ # End of header
last;
}
else {
($field, $fvalue) = split /
\s+/, $_, 2;
chop($fvalue);
if($field eq "Date:"){
@date[$temp] = $fvalue;
}
if($field eq "Message-ID:"){
@mid[$temp] = $fvalue;
}
if($field eq "From:"){
@from[$temp] = $fvalue;
}
if($field eq "To:"){
@to[$temp] = $fvalue;
}
if($field eq "Subject:"){
@subject[$temp] = $fvalue;
}
}
}
}
else{
return(1);
}
}
}
sub login(){
unless ($ip_p_address=inet_aton($ip)){
return(1);
}
$packed_address=pack_sockaddr_in ($port, $ip_p_address);
($name, $aliases, $protocol) = getprotobyname('tcp');
unless(socket(SOCKFD, AF_INET, SOCK_STREAM, $protocol)){
return(1);
}
unless(connect(SOCKFD, $packed_address)){
close(SOCKFD);
return(1);
}
select(SOCKFD);
$|=1;
select(STDOUT);
$data= <SOCKFD>;
print SOCKFD "USER $usr\n";
$_= <SOCKFD>;
unless(/\+OK/){
return(1);
}
print SOCKFD "PASS $pwd\n";
$_= <SOCKFD>;
if(/\+OK/){
return(0);
}
else{
return(1);
}
}
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 15 Jul 2000 07:20:03 GMT
From: doom@kzsu.stanford.edu.bbs@openbazaar.net (Joe Brenner)
Subject: Re: Problems running the perl debugger
Message-Id: <3bPOk3$S0G@openbazaar.net>
mjtg@cus.cam.ac.uk (M.J.T. Guy) writes:
>Joe Brenner <doom@kzsu.stanford.edu> wrote:
>>
>>Thanks, though maybe I didn't make it clear that I can run
>>run the script under the debugger with a
>>
>> perl -d script.pl
>>
>>without any trouble, the (main) problem is that the debugger won't
>>run at all if the first line of the script tries to turn on
>>taint mode (with the -T flag). I was also having some odd
>>problems running the debugger from under emacs, but that
>>seems to come and go.
>Whenever you get an error from Perl which you don't understand
>(or even if you think you do understand), look it up in perldiag.
>In this case, you'd have found
> Too late for "-T" option
> (X) The #! line (or local equivalent) in a Perl script
> contains the -T option, but Perl was not invoked with -T
> in its command line. This is an error because, by the
> time Perl discovers a -T in a script, it's too late to
> properly taint everything from the environment. So Perl
> gives up.
> If the Perl script is being executed as a command using
> the #! mechanism (or its local equivalent), this error
> can usually be fixed by editing the #! line so that the
> -T option is a part of Perl's first argument: e.g.
> change `perl -n -T' to `perl -T -n'.
> If the Perl script is being executed as `perl
> scriptname', then the -T option must appear on the
> command line: `perl -T scriptname'.
>
>
>which explains what is going on, and what to do about it.
I'm pretty sure that I read this, I just didn't catch the
hint that
perl -dT scriptname
might work... and it does indeed work, I'll give you that
much.
However, it doesn't do me any good when I try it inside of
emacs. If I do a:
M-x perldb
It responds something like this:
Run perldb (like this): perl -X scriptname
And no matter what values of -X I edit into place
(-dT, -Td, -dTw, -dwT, -Tdw, etc.) it still dies.
Evidentally it gets confused and starts running the
debugger on itself (e.g. I see errors like this:
DB<1> Insecure dependency in eval while running with -T
switch at /usr/lib/perl5/5.00503/perl5db.pl
So I'm back to editing the pound bang line before running
perldb...
(There's really no comparison to running the debugger on the
command line and inside of emacs. Inside emacs the display
splits into two tiled subwindows: as you step through the
code in the debugger window, a superimposed pointer moves
through the code buffer in the other emacs window. You
never lose the context, and there's no need to mess with
things like the "w" command. This is the stuff of which
emacs fanatics are made... )
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 3725
**************************************