[7371] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 996 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 8 15:27:30 1997

Date: Mon, 8 Sep 97 12:10:19 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 8 Sep 1997     Volume: 8 Number: 996

Today's topics:
     1000 free graphics <janveld@caiw.nl>
     Re: [Q] Converting text to image <randyg@slip.net>
     Add a link script - help! <dmedia@vzc.servicom.es>
     Re: cannot open file within while loop dellis@frycomm.com
     Doubling up a character in a string (Salvatore Sferrazza)
     Re: Doubling up a character in a string (Salvatore Sferrazza)
     Re: Doubling up a character in a string <joshb@kadence.kom>
     Re: Enumerates NT workstations? <systemp@sbcm.com>
     Re: Getting rid of \n in textarea input (brian d foy)
     Re: I seem to be missing something obvious with package <usenet-tag@qz.little-neck.ny.us>
     Re: Newcomer to the world of Perl, CGI and HTML ... <seay@absyss.fr>
     Re: Newcomer to the world of Perl, CGI and HTML ... (I R A Aggie)
     Perl and dll:s (Per Mosseby)
     pipe in the mailer (Sascha Kerschhofer)
     Re: Premature end of script header (brian d foy)
     Re: printing in the same place (William Wue(2xP)elma(2xN))
     regex problems (David Siebert)
     Regexp a Yes or No question? <sgermain@nortel.ca>
     Re: Regexp a Yes or No question? (Matthew Cravit)
     Searching updated references to TCL/Win32 status <t-markle@uiuc.edu>
     Re: security of input in reg exp? (M.J.T. Guy)
     Re: Shakespearian insult program <df@ravine.binary.net>
     Statistics for comp.lang.perl.misc <gbacon@cs.uah.edu>
     Re: what has it got in its ssocketses? (brian d foy)
     Re: Win95 Com Port Programming? <frank_a1@sfov1.verifone.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Mon, 08 Sep 1997 18:21:39 +0200
From: janveld <janveld@caiw.nl>
Subject: 1000 free graphics
Message-Id: <34142613.9E2@caiw.nl>


If I interrup something then I'am very sorry. Please ignore this mail.

I just want to tell you about my homepage.
It contains about 1000 Gif files. You can download them for free en use
it in your own homepage or on your desktop as a background.
I specified them in 14 categories. Be welcome on my page and have fun.

Note: I do not make one cent with this page. Just made it for you
people. And if you're happy...I'am to.
 
You'll find my homepage on this url:

http://www.caiw.nl/~janveld
Use to be Dutch, now it's English!


------------------------------

Date: Mon, 08 Sep 1997 09:19:35 -0700
From: Randy Gardner <randyg@slip.net>
To: kristian.elstad@interpost.no
Subject: Re: [Q] Converting text to image
Message-Id: <34142597.956@slip.net>


Kristian Elstad wrote:
> 
> Hi!
> 
> I am looking for a program that takes a text line or possibly several
> text lines and produses an image that displays this/these text lines.
> 
> The text I want convertet to a image is a typical html table. And I
> would like that either the whole table or each line (<tr>) in the
> table be convertet to an image. It is important that the 
> structure/layout of the table will be keept in the image. (In other 
> words; the text in the cols be plased underneath eachother).
> 
> The text will typically look like this:
> 
> <table>
> <tr><td>Kristian Elstad <td>0587 Oslo  <td>12 34 56 78
> <tr><td>Per Olsen       <td>0123 Oslo  <td>09 87 65 43
>  .
>  .
> <tr><td>Tim Hammer      <td>9000 Troms <td>23 34 56 78
> </table>
> 
> Is there anyone that knows of any program/module that can do something
> like this. Possible written in
> Perl or C.
> 
> ThanX.

I would recomend using the gd package:
http://www.boutell.com/gd/
and writing a simple HTML reader.  A full HTML parser is not needed for
just the tables, just read till the <..> tag, and increment a couple
of varibles.  The gd package is a GIF creatition/editing program for C,
and only takes a few lines to do what you describe. gd could also create
lines where lines would be in the HTML table in the gif, with only 
around 10 extra lines.

I belive this would come to less than 50 lines, rating: medium-easy.

I think this meets all of what you said.
-- 


--randyg@slip.net
--Randy Gardner


------------------------------

Date: Mon, 08 Sep 1997 19:44:53 +0200
From: Aitor <dmedia@vzc.servicom.es>
Subject: Add a link script - help!
Message-Id: <34143992.1D6F@vzc.servicom.es>

Hi,

I've got a free for all page at:

http://www.dmedia.net/superlinks

(only spanish links)

The script adds the URL, tittle and description. 
Althought, I'm newbie with perl, now it works fine but I want to limit
the URLs  to 100, so the oldest. one gets deleted. I  don't know how to
do it.

The script  now adds the new URL directly to index.html


How is the best way to limit them?          

Is there any similar script or just some lines of code as freeware to
learn it from?

Thanx.


------------------------------

Date: Mon, 08 Sep 1997 11:39:55 -0600
From: dellis@frycomm.com
Subject: Re: cannot open file within while loop
Message-Id: <873735803.6407@dejanews.com>

In regard to my previous post where I said that I couldn't create an
output file within a while loop:

I figured out what I was doing wrong.  Sorry to have wasted anyone's time.
 The problem was that I wasn't giving the full path of the map file after
the -m switch so I guess since the mapfile didn't exist, the "while
(<MF>)" loop was never even being entered.  I was SURE I was giving the
right map file, but hey I'm only human.  Sorry about that.

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


------------------------------

Date: 8 Sep 1997 14:33:19 GMT
From: nysfe@ny.ubs.com (Salvatore Sferrazza)
Subject: Doubling up a character in a string
Message-Id: <5v12bf$dhq$1@ns2.ny.ubs.com>

I am looking for a generic routine to which I can pass a character 
as an argument and have the routine search the string for that 
character, and then double it, i.e I have a string such as:

"Bob's wife is married to Mike's cousin."

When the routine is done I would like it to return:

"Bob''s wife is married to Mike''s cousin."

provided that I pass it a ' as an argument.  I was looking into using
substitution with s//, but I heard that will only give me back:

"Bob's wife is married to Mike''s cousin."

because it performs greedy matching.

Can anyone help me out on this and/or point me in the right direction
to resolving it myself?

Thanks in advance,

Sal Sferrazza





------------------------------

Date: 8 Sep 1997 16:18:07 GMT
From: nysfe@ny.ubs.com (Salvatore Sferrazza)
Subject: Re: Doubling up a character in a string
Message-Id: <5v18fv$dhq$2@ns2.ny.ubs.com>

Solved my own problem:

sub double_up {

    my $string = @_[0];
    my $dbl_char = @_[1];
    my $len = length($string);
    my $new_str;
    
    for (my $i = 0; $i < $len; $i++) {

	my $char = substr($string, $i, 1);

	if ($char eq $dbl_char) {

	    $new_str .= $char . $char;
	    
	} else {
	    
	    $new_str .= $char;
	    
	}

    }

    return $new_str;
}



In article <5v12bf$dhq$1@ns2.ny.ubs.com>, nysfe@ny.ubs.com (Salvatore Sferrazza) says:
>
>I am looking for a generic routine to which I can pass a character 
>as an argument and have the routine search the string for that 
>character, and then double it, i.e I have a string such as:
>
>"Bob's wife is married to Mike's cousin."
>
>When the routine is done I would like it to return:
>
>"Bob''s wife is married to Mike''s cousin."
>
>provided that I pass it a ' as an argument.  I was looking into using
>substitution with s//, but I heard that will only give me back:
>
>"Bob's wife is married to Mike''s cousin."
>
>because it performs greedy matching.
>
>Can anyone help me out on this and/or point me in the right direction
>to resolving it myself?
>
>Thanks in advance,
>
>Sal Sferrazza
>
>
>


------------------------------

Date: Mon, 8 Sep 1997 11:20:53 -0700
From: "Josh Baudhuin" <joshb@kadence.kom>
Subject: Re: Doubling up a character in a string
Message-Id: <5v1fml$6fr$1@news.cadence.com>

Not sure why you can't do something like

sub Double ($$) {
    my ($ch, $str) = @_;
    $ch = quotemeta($ch);
    $str =~ s/$ch/$ch$ch/g;
    return $str;
}

In other words, use the -g- option on s///.

Salvatore Sferrazza wrote in article <5v12bf$dhq$1@ns2.ny.ubs.com>...

>I am looking for a generic routine to which I can pass a character
>as an argument and have the routine search the string for that
>character, and then double it, i.e I have a string such as:
>
>"Bob's wife is married to Mike's cousin."
>
>When the routine is done I would like it to return:
>
>"Bob''s wife is married to Mike''s cousin."
>
>provided that I pass it a ' as an argument.  I was looking into using
>substitution with s//, but I heard that will only give me back:






------------------------------

Date: Mon, 8 Sep 1997 16:24:36 GMT
From: Systemp <systemp@sbcm.com>
Subject: Re: Enumerates NT workstations?
Message-Id: <EG76x6.3ox@nonexistent.com>

Brian, If you're using Perl, here's a Perl subroutine that will do the
trick.

- Andrew Sirulnik



sub get_domain_members
     {

     # Summary: Takes the name of a PDC as its argument, and returns
     # an array of domain members.

     my $dc = $_[0];
     use Win32::NetAdmin;
     unless ( $#_ == 0 ) {die 'syntax:
get_domain_members($domain_controller)'}
     my (@machines, @accounts);

     Win32::NetAdmin::GroupGetMembers ("\\\\$dc","Domain
Users",\@accounts )
          or die "...error: GroupGetMembers($dc) failed: $!";

     while (@accounts)
          {
          $_ = shift @accounts;
          if ( $_ =~ s/\$$// )
               {
               # test for and skip any inter-domain trust accounts
               my ($pw, $pwa, $priv, $homedir, $comment, $flags,
$script_path) = ();
               Win32::NetAdmin::UserGetAttributes ("\\\\$dc", "$_\$",
$pw, $pwa, $priv, $homedir, $comment, $flags, $script_path);
               unless ( $flags == 2049 )  { push @machines, $_ }; 
               }
          }
      return sort @machines;
     }



Brian Seltzer wrote:
> 
> NET VIEW /DOMAIN:domainname
> 
> Michael Zhu <michael.zhu@employment.gov.au> wrote in article
> <340d027a.0@info-int>...
> >
> > Does anybody know a command line utility which can enumerate all the NT
> > workstations from a domain and put them into a text file?
> >
> > -Thanks
> >
> > Michale Zhu
> >
> >
> >
> >


------------------------------

Date: Mon, 08 Sep 1997 13:02:21 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Getting rid of \n in textarea input
Message-Id: <comdog-ya02408000R0809971302210001@news.panix.com>

In article <341418D4.7C17@edt.ericsson.se>, bjorn.w.nilsson@edt.ericsson.se wrote:

>Javier Figueroa wrote:
>> 
>> Please if anybody can help me I would really appreciate it.
>> 
>> I need to know how to get rid of carriage returns put in by users in
>> textarea so I can put it in one continuous line in my database file.
>> 
>> I tried
>> 
>> $FORM{'information'} =~ s/\n/ /g;
>> 
>> but it does not work, the carriage return is still being displayed in my
>> database file.
>> 
>> Please if you can post an answer or write me email I would greatly
>> appreciate it.
>> 
>> Thank you very much,
>> 
>> Javier Figueroa
>> figue@tld.net

>Try:
>
>chomp($FORM{'information'});

and then find out is only removes trailing $INPUT_SEPARATOR characters
rather than (necessarily) newlines, and certainly not newlines in the
middle of the string, which is the problem :)

the trouble might be that the carriage return is a \r.  take a sample 
of the troubled data and look at the byte in which the problem 
character shoes up and then strip *that* character when you process
your data:

   s/\r|\n/ /g;

good luck.

-- 
brian d foy                                  <comdog@computerdog.com>


------------------------------

Date: 8 Sep 1997 17:30:29 GMT
From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: I seem to be missing something obvious with packages
Message-Id: <eli$9709081323@qz.little-neck.ny.us>

Doug Seay  <seay@absyss.fr> wrote:
> Eli the Bearded wrote:
> >         require MyLists;
> >         ...
> >         foreach $item (@MyLists::list) { ... }
> >         ...
> > This (seems to) work fine, except that '-w' gives me warnings
> > that @MyLists::list, et al, is referenced only once from main.
> I end up adding ugly stuff like
> 	@MyLists::list() = () if ( 0 );
> just to give that important second reference.

Well, my solution was slightly less ugly. I now test that each
of the 18 lists is defined and die if any of them are not. This
way it is least a semi-useful sanity check.

Elijah
------
and is likely to be quite useful if past expirience with this script serves


------------------------------

Date: Mon, 08 Sep 1997 19:29:12 +0200
From: Doug Seay <seay@absyss.fr>
To: James Atkin <James.Atkin@Phase.Com>
Subject: Re: Newcomer to the world of Perl, CGI and HTML ...
Message-Id: <341435E8.16CD79C@absyss.fr>

[posted and mailed]


James Atkin wrote:
> 
> Hi there,
> 
> I've just startted in the world of Perl, CGI and HTML.
> I am trying to do the following :
> 
> I have a Web page with a request for a serial number.
> I need the entered serial number to be passed to the next web, and
> displayed on the screen.

This isn't the best way to jump into c.l.p.misc.  CGI type questions are
valid Perl questions if and only if you need a Perl specific question. 
What you are trying to do isn't Perl specific, it would be the same in
C, assembler, APL, ALGOL-W or whatever.

You have already read the docs for CGI.pm?  I've never used it (I don't
do CGI), but it has an excelent reputation for being fairly complete and
easy to use.  "perldoc CGI" if you have it installed.  If not, go to
CPAN and get it.


> How do I go about doing this ?  I am currently using FrontPage 97.

Is FrontPage 97 written in Perl?  Does it have Perl specific options? 
If not, this is off-topic.  Maybe they talk about it in one of the WWW
groups.  Or perhaps in the microsoft hierarchy.


> Also, I will shortly need to pass another number to a Perl Script.
> Firstly how do I pass it, and secondly, how do I access it in the Perl
> Script.

Do you mean to launch a Perl process while sending it parameters?  You
pass it as an arguement like with any other executable.  You get it the
same way you get any other arguement.


> Thanks for any help. It greatfully appreciated.

The best advice I can give is to read your documentation.  "perldoc
perl" should be a good starter.  Read the "perldata" to "perlsub" block
once or twice to get a basic idea how Perl works.  You are asking us to
give you a summary of the most basic things of Perl.

If you don't like reading on-line documentation, read "perldoc perlbook"
and go buy one of the books listed therein.  Make sure it is the second
edition (both have second releases in the past year).

Before posting to a newsgroup, you should read its FAQ (ours is posted
regularly, it is hard to miss it) and learn the basics of that
newsgroup.  Ours has pointers to more CGI/WWW specific groups that
should have more information for your number passing problem.

Hope this helps.

- doug


------------------------------

Date: Mon, 08 Sep 1997 14:32:20 -0400
From: fl_aggie@hotmail.com (I R A Aggie)
Subject: Re: Newcomer to the world of Perl, CGI and HTML ...
Message-Id: <fl_aggie-ya02408000R0809971432200001@news.fsu.edu>

In article <341435E8.16CD79C@absyss.fr>, Doug Seay <seay@absyss.fr> wrote:

+ You have already read the docs for CGI.pm?  I've never used it (I don't
+ do CGI), but it has an excelent reputation for being fairly complete and
+ easy to use.

<enthusiasim>

Oh, indeed, it is! Where else can you invoke your CGI program on the command
line, and emulate the server-esque environment to test your program? I'm in
the process of converting over some older scripts that use the cgi-lib.pl
library to CGI.pm, and that feature alone makes it worthwhile!

James - I won't close out that tag just yet... ;)

-- 
Consulting Minister for Consultants, DNRC
Support the anti-Spam amendment <url:http://www.cauce.org/>
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>


------------------------------

Date: 8 Sep 1997 16:56:28 GMT
From: d94-pmo@mumrik.nada.kth.se (Per Mosseby)
Subject: Perl and dll:s
Message-Id: <5v1ans$4co$1@news.kth.se>


Hi,

I would be extremely grateful if anyone could give me a hint on the
subject Perl and dll:s. I have a dll that works fine to use with C
programs, but I don't know how to use it in a Perl script I'm planning
to write.

* Is it possible to use the dll in my Perl script?
* Is it easy to do?
* Has anyone done it before me - and is there a source code / hint to
get somewhere?

All help is greatly appriciated - and needed.

	/Moz


------------------------------

Date: Mon, 08 Sep 1997 18:54:46 +0200
From: e9127005@stud1.tuwien.ac.at (Sascha Kerschhofer)
Subject: pipe in the mailer
Message-Id: <e9127005-0809971854460001@sozgr.htu.tuwien.ac.at>

i can mail messages with the mailer by opening a filehandle.
open (MAIL, "|usr/bin/mail asd@akjsd.net");
then i am mailing the text with the print command. i print:

From: myadress
Subject: my sybject
And here i am mailin the message

but: how can i divide the header (subject, from..) from the message
itself? if i do it in the way i showed, alle the message remains in the
Subject when reading the mail in x-mailers like Eudora. is there any
character which divides the header from the message?
any help is appreciated!

Sascha Kerschofer, Vienna


------------------------------

Date: Mon, 08 Sep 1997 13:08:02 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Premature end of script header
Message-Id: <comdog-ya02408000R0809971308020001@news.panix.com>

In article <Pine.A41.3.96a.970908003039.15418A-100000@dante34.u.washington.edu>, Ramon Mariano Jr <rmariano@u.washington.edu> wrote:

>"Premature end of script header"
>
>I get this message in my error_log file on my server whenever I try
>executing my perl script. What does that mean?

it means that you need to read

   <URL:http://language.perl.com/CPAN/doc/FAQs/cgi/idiots-guide.html>

good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>


------------------------------

Date: Mon, 08 Sep 1997 17:31:45 GMT
From: williamw@rooster.igs.deleteTheRooster.net (William Wue(2xP)elma(2xN))
Subject: Re: printing in the same place
Message-Id: <3414343b.15182360@news.igs.net>

On 5 Sep 1997 15:52:36 GMT, intesab@bnr.ca (Intesab N. Siddiqui)
wrote:

>
>
>hello,
>
>i would like to know how to print in the same place...
>
>i mean, with the following code (where my_print can 
>manipulate the line and column)
>
>my_print (1);
>my_print (2);
>my_print (3);
>
>the output should be (at the same line and column):
>1 (after the first call)
>2 (after the second call)
>3 (after the third call)

print("\r" . ++$count);

assuming your count starts at the left margin, that is.


-------------------------
William Wue(2xP)elma(2xN)
Reply-To: williamw (at) igs (dot) net
--------------------------------------------------------------
It is pitch black. You are likely to receive spam from a grue.


------------------------------

Date: 8 Sep 1997 18:30:53 GMT
From: dsiebert@gate.net (David Siebert)
Subject: regex problems
Message-Id: <5v1g8t$lps$1@news.gate.net>


how can a replace any amount of whitespace follwed by a ; with just a ;.



------------------------------

Date: Mon, 08 Sep 1997 12:20:10 -0400
From: "Sylvain St.Germain" <sgermain@nortel.ca>
Subject: Regexp a Yes or No question?
Message-Id: <341425BA.38BB@nortel.ca>

How do you regexp the answer to 
a yes or no question?

I mean Y, y, yes, Yes, YES, YEs, yES, 
OK, ok, Ok, oK, true, TRUE ... 

and

No, no, No, nO....


Sylvain.


------------------------------

Date: 8 Sep 1997 10:25:45 -0700
From: mcravit@best.com (Matthew Cravit)
Subject: Re: Regexp a Yes or No question?
Message-Id: <5v1cep$kmg$1@shell3.ba.best.com>

In article <341425BA.38BB@nortel.ca>,
Sylvain St.Germain <sgermain@nortel.ca> wrote:
>How do you regexp the answer to 
>a yes or no question?
>
>I mean Y, y, yes, Yes, YES, YEs, yES, 
>OK, ok, Ok, oK, true, TRUE ... 
>
>and
>
>No, no, No, nO....

I usually use something like this:

    # Assumes the user's response is in $response
    if ($response =~ /^[YyTtOo]/) {
        &DoWhatever;
    }
    else {
        &DoSomethingElse;
    }

Your mileage may vary, of course.

/MC

-- 
Matthew Cravit, N9VWG               | Experience is what allows you to
E-mail: mcravit@best.com (home)     | recognize a mistake the second
        mcravit@taos.com (work)     | time you make it.


------------------------------

Date: 8 Sep 1997 18:42:48 GMT
From: Todd Markle <t-markle@uiuc.edu>
Subject: Searching updated references to TCL/Win32 status
Message-Id: <5v1gv8$c60$1@vixen.cso.uiuc.edu>


I used to be a perl programmer, and life was good.

A year ago, I left perl to do write a series of applications
for MS Access.  Life is no longer good.  More and more of my 
time is being spent on oddities of Visual Basic.

About once a quarter I poke my head out to see if it will be 
possible to dump Visual Basic forever and do our entire user
interface in perl.  Life would be good again.

According to the FAQ's, perlTCL is not yet available for win95
or WinNT.  But I've seen one or two posts from people who appear
to be using it.  Are the FAQ's out of date?  Are there any new
resources or updates as to the status of the port?

Thanks.




------------------------------

Date: 8 Sep 1997 17:21:23 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: security of input in reg exp?
Message-Id: <5v1c6j$q80$1@lyra.csx.cam.ac.uk>

M.J.T. Guy <mjtg@cus.cam.ac.uk> wrote:
>Tom Phoenix  <rootbeer@teleport.com> wrote:
>>On Thu, 4 Sep 1997, Alex Krohn wrote:
>>
>>> I want to be able to allow people to put input into a reg expression
>>> and was wondering about any security problems.
>>
>>That's good to worry about security holes. Are you saying you want a user
>>of your program to specify the regexp to use?
>>
>>> if ($item =~ /$userinput/) { blah(); }
>>> 
>>> I don't want to quote $userinput as I want it to be treated as a reg
>>> exp. My question is, can users input ` or | or something similiar
>>> (perhaps even close the reg exp with a /) and execute a command?
>>
>>No; Perl will not treat the contents of $userinput as executable code. 
>>Even if it has a slash, that won't end the regexp. (But keep reading.) 
>
>That is correct as far as it goes, but of course a regexp can contain
>arbitrary executable code, such as
>
>           /@{[system qw|rm -rf /|]}/
>
>So you should do at least _some_ checking or processing of the user input.
>I think that escaping @ and $ would suffice.

Oops.   That's all nonsense.   Perl won't act on $ or @ contained in
a substituted string like $userinput (except to mean "end of string").
So Tom's approach should be perfectly safe.

Sorry about that.


Mike Guy


------------------------------

Date: 8 Sep 1997 18:07:40 GMT
From: Dave Furstenau <df@ravine.binary.net>
Subject: Re: Shakespearian insult program
Message-Id: <5v1etd$cd3$1@oksennus.binary.net>

Dave Cross <Dave.Cross@gb.swissbank.com> wrote:
> In article <5umuqa$i16$0@207.17.114.19> Eric Anderson <eric@semaphore.com> writes:

> > A friend emailed me a shakespearian insult kit. With it, you choose one
>           [most of code snipped]
> > print "\nThou $word_1 $word_2 $word_3!\n\n";

> Eric,
>
> <PEDANT>
> One of the things about Shakespeare is that he generally wrote
> grammatically correct English, which your script is guaranteed not
> to do.
> </PEDANT>

    Umm, not to pick nits myself -- have you actually seen reprints of
the originals?  Punctuation at that time was more decorative than
functional (that's why there's so much dispute over interpretation.
"The multitudinous seas incarnadine, / making the green one red."  or
is it, "making the green, one red"?)  And Bill *loved* to mix tenses.
"... the flat unraised spirits that hath ...", etc ...
    Nonetheless, point well taken, Good Sir Eric -- and I'll move on to
perlish matters ...

    That simple snippet of code that Eric et alii honed for the shakesperl
program was so handy, I thought I'd do up an old Country Song construction
kit that's been on my drive for quite some time.
    I call it ElvisPerlsley.pl (hey, minnieperl was taken, okay?).  All I
did was swap elements and add a simple cgi tweak.  I'm only posting it cuz
it turned out pretty funny, and I thought you guys might wanna roll yer
own lyrics for it. (Mone me si erro.)

    It's running at:

<A HREF="http://www.binary.net/df/Hah/ElvisPerlsley.cgi">ElvisPerlsley</A>

     Dave Furstenau
               df@binary.net

----- CUT -----
#!/usr/bin/perl
#
#        ElvisPerlsley.pl  -- a CGI to generate random lyrics for a
#                             customized Country song.  Based on an
#                             anonymous (AFAIK) parody posted widely
#                             for years.
#
   
@word01=("on the highway","in Sheboygan","outside Fresno",
         "at a truck stop","on probation","in a jail cell",
         "in a nightmare","on a camel","down in Georgia",
         "in a treehouse","in a gay bar","in a churchyard");

@word02=("in September","at McDonald's","ridin' shotgun",
         "wrestlin' gators","all hunched over","poppin' uppers",
         "sort of pregnant","with her father","stoned on oatmeal",
         "with Merv Griffin","singing opera","doin' sailors",
         "playin' banjo");

@word03=("that purple dress","that little hat","that burlap bra",
         "those training pants","the stolen goods","French perfume",
         "the Mondale pin","the neon sign","that creepy smile",
         "the hearing aid","the boxer shorts","viking suit");

@word04=("sobbin' by a toll booth","slurpin' Dr. Pepper",
         "wolfin' down some Twinkies","breakin' out with acne",
         "crawlin' through the prairie","smellin' kind of funky",
         "crashin' through the guardrail","chewin' on a hangnail",
         "talkin' in Swahili","drownin' in the quicksand",
         "screamin' like a banshee","biting Richard Simmons");

@word05=("in the twilight","but I loved her","in the mens room",
         "near Poughkeepsie","with her cobra","when she shot me",
         "on her elbows","with Led-Zeppelin","with Miss Piggy",
         "near the off-ramp","in her muu-muu","when our eyes met");

@word06=("no guy would ever love her more",
         "that she would be an easy score",
         "she'd bought her dentures in a store",
         "that she would be a crashing bore",
         "I'd never rate her more than '4'",
         "they'd hate her guts in Baltimore",
         "it was a raven, nothing more",
         "I'd hafta reinforce the floor",
         "we really lost the last World War",
         "I'd have to scrape her off the floor",
         "what strong deodorants were for",
         "that she was rotten to the core",
         "that I would upchuck on the floor");

@word07=("I promised her","I knew deep down","She asked me if",
         "I told her shrink","The judge declared","My Pooh Bear said",
         "I shrieked in pain","The painters knew","A Klingon said",
         "My hamster thought","The blood test showed","Her rabbi said",
         "Her psychic warned");

@word08=("stay with her","warp her mind","swear off booze","change my sex",
         "punch her out","live off her","have my rash","stay a dwarf",
         "hate her dog","pick my nose","guzzle gin","salivate",
         "dance a jig");

@word09=("our love would never die","there was no other guy",
         "man wasn't meant to fly","that Nixon didn't lie",
         "her basset hound was shy","that Rolaids made her high",
         "she'd have a swiss on rye","she loved my one blue eye",
         "her mother was a guy","she'd leave the FBI",
         "that disco made her cry","she couldn't stand my tie",
         "'Let's order up some pie");

@word10=("run off","wind up","boogie","yodel","sky dive","turn green",
         "freak out","blast off","make it","blackout","bobsled","grovel",
         "get drunk");

@word11=("with my best friend","in my Edsel","on a surfboard",
         "with Marv Albert","with her dentist","with Ed Asner",
         "with a robot","with no clothes on","at her health club",
         "in her Maytag","with her guru","while in labor",
         "at the hoedown");

@word12=("You'd think at least that she'd have said",
         "I never had the chance to say",
         "She told her fat friend Grace to say",
         "I now can kiss my credit cards",
         "I guess I was too smashed to say",
         "I watched her melt away and sobbed",
         "She fell beneath the wheels and cried",
         "She sent a hired thug to say",
         "She spray my truck with paint, it said:",
         "She freaked out on the lawn and screamed",
         "I pushed her off the bridge and waved",
         "But that's the way that pygmies say",
         "She sealed me in the vault and smirked");

srand( time() ^ ($$ + ($$ << 15)) );
$One = $word01[int(rand(@word01))];
$Two = $word02[int(rand(@word02))];
$Thr = $word03[int(rand(@word03))];
$Fou = $word04[int(rand(@word04))];
$Fiv = $word05[int(rand(@word05))];
$Six = $word06[int(rand(@word06))];
$Sev = $word07[int(rand(@word07))];
$Eig = $word08[int(rand(@word08))];
$Nin = $word09[int(rand(@word09))];
$Ten = $word10[int(rand(@word10))];
$Ele = $word11[int(rand(@word11))];
$Twe = $word12[int(rand(@word12))];

# NOTE: This is set up to be called from (and return
#       to) my humor page.  Change accordingly.

print "Content-type: text/html\n";
print "Pragma: no-cache\n\n";
print "<HTML><HEAD><TITLE>Country Song Generator</TITLE></HEAD><BODY>";
print "<CENTER><STRONG><U>When I Met Her ... </U></STRONG><BR>";
print "by Elvis Perlsly<BR><HR><BR>";
print "(Sung to the tune of pretty much any country song you've ever heard.)";
print "</CENTER><BR>";
print "<P>Ooooh ... <BR>";
print "&#160 &#160 I met her $One $Two.<BR>";
print "&#160 &#160 &#160 &#160 I can still recall $Thr she wore.<BR>";
print "&#160 &#160 She was $Fou $Fiv,<BR>";
print "&#160 &#160 &#160 &#160 And I knew $Six.<BR><BR>";
print "Well ... <BR>";
print "&#160 &#160 $Sev I'd $Eig forever.<BR>";
print "&#160 &#160 &#160 &#160 She said to me $Nin.<BR>";
print "&#160 &#160 But who'd have thought she'd $Ten $Ele.<BR>";
print "&#160 &#160 &#160 &#160 $Twe goodbye.<BR>";
print "<BR><HR><BR></CENTER>";
print "<CENTER><A HREF=\"ElvisPerlsley.cgi\">Another verse</A>? or ";
print "<A HREF=\"humor.shtml\">Enough</A>!!</CENTER>";
print "</BODY></HTML>";
exit;



------------------------------

Date: 8 Sep 1997 16:07:11 GMT
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: Statistics for comp.lang.perl.misc
Message-Id: <5v17rf$dgs$2@info.uah.edu>

Following is a summary of articles spanning a 7 day period,
beginning at 30 Aug 1997 11:16:25 GMT and ending at
06 Sep 1997 06:47:08 GMT.

Notes
=====

    - A line in the body of a post is considered to be original if it
      does *not* match the regular expression /^\s{0,3}(?:>|:|\S+>|\+\+)/.
    - All text after the last cut line (/^-- $/) in the body is
      considered to be the author's signature.
    - The scanner prefers the Reply-To: header over the From: header
      in determining the "real" e-mail address and name.
    - Original Content Rating is the ratio of the original content volume
      to the total body volume.
    - Please send all comments to Greg Bacon <gbacon@cs.uah.edu>.
    - Find the NewsScan junkyard at http://www.cs.uah.edu/~gbacon/clpm/

Excluded Posters
================

perlfaq-suggestions@mox.perl.com

Totals
======

Total number of posters:  413
Total number of articles: 901 (341 with cutlined signatures)
Total number of threads:  355
Total volume generated:   1555.3 kb
    - headers:    639.8 kb (12,641 lines)
    - bodies:     847.6 kb (26,702 lines)
    - original:   591.1 kb (19,461 lines)
    - signatures: 65.7 kb (1,494 lines)
Original Content Rating: 0.6973

Averages
========

Number of posts per poster: 2.2
Number of posts per thread: 2.5
Message size: 1767.7 bytes
    - header:     727.1 bytes (14.0 lines)
    - body:       963.3 bytes (29.6 lines)
    - original:   671.8 bytes (21.6 lines)
    - signature:  74.7 bytes (1.7 lines)

Top 10 Posters by Number of Posts
=================================

         (kb)   (kb)  (kb)  (kb)
Posts  Volume (  hdr/ body/ orig)  Address
-----  --------------------------  -------

  103   188.1 ( 89.2/ 79.6/ 51.2)  Tom Phoenix <rootbeer@teleport.com>
   24    42.4 ( 16.9/ 25.5/ 15.3)  Doug Seay <seay@absyss.fr>
   15    25.0 (  7.8/ 16.8/ 12.8)  Andrew M. Langmead <aml@world.std.com>
   14    20.4 (  9.7/ 10.0/  5.5)  Tom Grydeland <tom@mitra.phys.uit.no>
   11    23.4 (  6.9/ 16.5/  9.0)  Tad McClellan <tadmc@flash.net>
   11    23.3 (  7.9/ 15.3/  9.9)  Jeremy D. Zawodny <jzawodn@wcnet.org>
   11    13.1 (  6.2/  6.9/  3.3)  M.J.T. Guy <mjtg@cus.cam.ac.uk>
   10    17.6 (  7.0/ 10.6/  6.7)  Ronald L. Parker <ron@farmworks.com>
    9    14.1 (  5.2/  8.9/  4.5)  klander@primenet
    8     9.6 (  5.7/  4.0/  1.5)  Scott Houck <scott@radix.net>

Top 10 Posters by Volume
========================

  (kb)   (kb)  (kb)  (kb)
Volume (  hdr/ body/ orig)  Posts  Address
--------------------------  -----  -------

 188.1 ( 89.2/ 79.6/ 51.2)    103  Tom Phoenix <rootbeer@teleport.com>
  42.4 ( 16.9/ 25.5/ 15.3)     24  Doug Seay <seay@absyss.fr>
  25.0 (  7.8/ 16.8/ 12.8)     15  Andrew M. Langmead <aml@world.std.com>
  23.4 (  6.9/ 16.5/  9.0)     11  Tad McClellan <tadmc@flash.net>
  23.3 (  7.9/ 15.3/  9.9)     11  Jeremy D. Zawodny <jzawodn@wcnet.org>
  22.1 (  6.6/ 14.2/  9.4)      7  Peter de Vroomen <peterv@valkieser.nl>
  20.4 (  9.7/ 10.0/  5.5)     14  Tom Grydeland <tom@mitra.phys.uit.no>
  17.6 (  7.0/ 10.6/  6.7)     10  Ronald L. Parker <ron@farmworks.com>
  16.2 (  0.7/ 15.5/ 15.3)      1  Philip Kohn <pkohn@alw.nih.gov>
  14.1 (  5.2/  8.9/  4.5)      9  klander@primenet

Top 10 Posters by OCR (minimum of five posts)
==============================================

          (kb)    (kb)
OCR       orig /  body  Posts  Address
------  --------------  -----  -------

0.9924     5.0 /   5.0      6  I R A Aggie <fl_aggie@hotmail.com>
0.9864     6.7 /   6.8      7  Chris Nandor <pudge@pobox.com>
0.7626    12.8 /  16.8     15  Andrew M. Langmead <aml@world.std.com>
0.7281     4.9 /   6.7      6  "Chris Waddell" <chris@wzone.com>
0.7212     5.9 /   8.1      6  Terry Michael Fletcher - PCD ~ <tfletche@pcocd2.intel.com>
0.6951     4.2 /   6.1      5  Jeffrey Bolden <jbolden@math.ucla.edu>
0.6944     4.7 /   6.7      5  Pat Trainor <ptrainor@aura.title14.com>
0.6885     4.7 /   6.9      5  Russ Allbery <rra@stanford.edu>
0.6834     3.8 /   5.5      5  Ilya Zakharevich <ilya@math.ohio-state.edu>
0.6727     3.8 /   5.6      7  brian d foy <comdog@computerdog.com>

Bottom 10 Posters by OCR (minimum of five posts)
=================================================

          (kb)    (kb)
OCR       orig /  body  Posts  Address
------  --------------  -----  -------

0.5145     1.8 /   3.5      5  Martin Fischer <mf@fishbone.ruhr.de>
0.5136     1.7 /   3.2      6  Gary Colman <SPAMFREEcolmang@ms.com>
0.5090     4.5 /   8.9      9  klander@primenet
0.5016     2.7 /   5.4      7  petri.backstrom@icl.fi
0.4794     1.1 /   2.2      5  Eike Grote <eike.grote@theo.phy.uni-bayreuth.de>
0.4717     3.3 /   6.9     11  M.J.T. Guy <mjtg@cus.cam.ac.uk>
0.4541     1.9 /   4.2      6  Jeremy D. Zawodny <zawodny@hou.moc.com>
0.3695     1.5 /   4.0      8  Scott Houck <scott@radix.net>
0.3677     1.6 /   4.3      5  Mike Turk <mturk@globalserve.net>
0.3247     1.4 /   4.2      6  Tom Fawcett <fawcett@nynexst.com.spam-me-not>

Top 10 Threads by Number of Posts
=================================

Posts  Subject
-----  -------

   19  perl and XEmacs
   18  complex pattern?!? it shouldn't be, i think :)
   14  Is Perl for Win32 really as brain damaged as it seems?
   11  "Odd number of elements in hash list": So?
   10  Simple Perl for  Win 32 Question (not in FAQ)
   10  Perl (kind of) math question.
    9  changing dir of parent shell
    8  Shakespearian insult program
    8  Questions about passing by reference.
    8  pattern matching HELP!

Top 10 Threads by Volume
========================

  (kb)   (kb)  (kb)  (kb)
Volume (  hdr/ body/ orig)  Posts  Subject
--------------------------  -----  -------

  55.6 ( 25.3/ 28.8/ 20.7)     19  perl and XEmacs
  32.3 ( 15.9/ 14.6/  8.7)     18  complex pattern?!? it shouldn't be, i think :)
  24.5 (  7.3/ 15.9/ 10.1)      8  Questions about passing by reference.
  23.3 ( 10.2/ 12.9/  6.1)     14  Is Perl for Win32 really as brain damaged as it seems?
  19.4 (  6.2/ 12.2/  9.5)      9  changing dir of parent shell
  18.9 (  8.0/ 10.2/  5.7)     10  Perl (kind of) math question.
  18.7 (  2.4/ 16.2/  8.4)      3  New to the business!
  17.7 (  5.8/ 10.7/  6.9)      8  Shakespearian insult program
  17.4 (  7.6/  8.8/  5.6)     11  "Odd number of elements in hash list": So?
  16.2 (  0.7/ 15.5/ 15.3)      1  spath: a command to do file path substitutions

Top 10 Targets for Crossposts
=============================

Articles  Newsgroup
--------  ---------

      26  comp.lang.perl.modules
      20  comp.emacs.xemacs
      15  comp.lang.perl
      10  comp.lang.perl.tk
       9  alt.fan.e-t-b
       5  comp.unix.bsd.freebsd.misc
       4  news.software.nntp
       4  comp.security.unix
       4  comp.security.ssh
       4  de.comp.lang.perl

Top 10 Crossposters
===================

Articles  Address
--------  -------

      12  Alastair Todd <alastair@net7.co.uk>
       5  Burt Lewis <burt@ici.net>
       5  wolverin@is.usmo.com
       5  hymie! <hymie@lactose.smart.net>
       4  Tom Phoenix <rootbeer@teleport.com>
       4  Helmut Llamas Stuhne <llamashe@microtec.de>
       4  Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
       3  Stuart Robinson <Stuart.Robinson@anu.edu.au>
       3  Tom Grydeland <tom@mitra.phys.uit.no>
       3  Anthony Mak <s2155678@cse.unsw.EDU.AU>


------------------------------

Date: Mon, 08 Sep 1997 13:17:06 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: what has it got in its ssocketses?
Message-Id: <comdog-ya02408000R0809971317060001@news.panix.com>

In article <01bcbc6f$b7255480$10791fc4@finley>, "Lloyd " <_lloyd_@vwv.com> wrote:

>--
>  ($dummy1, $dummy2, $prototype) = getprotobyname("TCP");
>  #$prototype contains 6 now if this means anything to you
>  socket(SOCKET, 2, 1, $prototype) || do {&error("Socket not
>Initialised\n$!");};
>--
>Anyway - I ran my script on a Solaris box (running perl 5.004) and then on
>another Solaris box (running perl 5.004_02) and keep running into the same
>error. [I ran the script as root and as me.]
>$! contains the text: 'Protocol not supported'. The script terminates at
>the &error routine.

>So please, if anyone has any bright ideas , gimme a buzz :)

are you using the Socket module?  it's part of the standard distribution
and should solve your problems.

good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>


------------------------------

Date: Mon, 08 Sep 1997 08:51:37 -0700
From: "Frank R. Anderson" <frank_a1@sfov1.verifone.com>
To: Charlie <charlie@flychina.com>
Subject: Re: Win95 Com Port Programming?
Message-Id: <34141F09.9F8@sfov1.verifone.com>

Charlie wrote:
> 
> Frank R. Anderson <frank_a1@sfov1.verifone.com> wrote
> > #! /perl/bin/per -w
> > # com2tst.pl - a simple string echo program
> >
> > system( "mode COM2: 96,n,8,1,n" );
> > open( COM, "+>COM2" ) || die "could not open COM2 $!\n";
> >
> > while( <COM> ) {
> >     print COM $_;
> >     print STDOUT $_;
> > }
> > close( COM );
> > exit;
> 
> I have been trying to access Modem port with similiar code,
> 
> open( COM, "+>COM2" ) || die "could not open COM2 $!\n";
> print COM "AT\n";
> $received=<COM>;
> print "$received\n";
> close( COM );
> 
> It hangs at the read command <COM>.  It does not even send "AT" to modem.
> It sends "AT" when close (COM) is executed.
> 
> Can anyone tell me what is wrong with above code?  It suppose to work
> according to the WIN32 Perl FAQ.
> 
> Thanks.
> 
> Charlie Li

Charlie:

I think I know part of the answer to your question.  You have to
flush the characters out the port.  Use the library flush.pl and
use &flush( COM ) or &printflush( COM, "AT" ).  You can also use
select( COM ); $|=1; to enable the flush.  I'm still not convinced
that programming comp ports with Perl for Win95 is robust.

Thanks, Frank


------------------------------

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 996
*************************************

home help back first fref pref prev next nref lref last post