[8019] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1644 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 15 03:27:16 1998

Date: Thu, 15 Jan 98 00:00:53 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 15 Jan 1998     Volume: 8 Number: 1644

Today's topics:
     $$$ Start The Year off Right! $$$ <Commodore64Man@yahoo.com>
     Business::CreditCard.pm <rets@meta3.com>
     Re: C-style assert()ions (Martin Vorlaender)
     Re: Can I create a Linked List in Perl <rjk@coos.dartmouth.edu>
     Can one Use Image Maps? <melton@pitnet.net>
     Re: Can Perl talk smtp protocol under NT4? (Martin Vorlaender)
     Re: Displaying GIFs - oops <patrick@mediacity.com.sg>
     Re: Displaying GIFs - oops (brian d foy)
     Re: Displaying GIFs - oops (Iain Chalmers)
     Re: Displaying GIFs - oops (Martien Verbruggen)
     Re: Displaying GIFs - THX <patrick@mediacity.com.sg>
     Help ! language@gol.com
     Re: Help ! <melton@pitnet.net>
     Re: help a beginner with search string <rjk@coos.dartmouth.edu>
     Re: Help with my code please <rjk@coos.dartmouth.edu>
     Re: Newbie: how to get file permissions? (Awrobinson)
     Re: perl -- a language for LEARNING programming? <joseph@5sigma.com>
     Re: Perl running under Linus - #!/bin/usr grsshpper@feedME
     perl script for deleting text between two markers? <adolf@tio.com>
     Re: perl under windows95 (Simulated Snow)
     Re: Problem calling a cgi from cgi <webmaster@fccj.cc.fl.us>
     Re: reg exp question <rjk@coos.dartmouth.edu>
     Re: responding to prompting programs (brian d foy)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 15 Jan 1998 02:55:35 GMT
From: CMan <Commodore64Man@yahoo.com>
Subject: $$$ Start The Year off Right! $$$
Message-Id: <34bda10d.0@news.worldnow.com>

Hey this really works, I made $200 in the first week.  So now I am posting more.

DO YOU WANT TO MAKE MONEY???
Of course you do, we all do !!! Here's how to do so with little effort, and, yes 
IT'S LEGAL. A little while back, I was browsing these newsgroups, just like you 
are now, and came across an article similar to this that said you could make 
thousands of dollars within weeks with only an initial investment of $6.00! So I 
thought, "Yeah, right, this must be a scam!", but like most of us, I was 
curious. Like most of us, I kept reading. Anyway, it said that if you send $1.00 
to each of the 6 names and addresses stated in the article, you could make 
thousands in a very short period of time. You then place your own name and 
address at the bottom of the list at #6, and post the article to at least 200 
newsgroups.(There are about 22,000.) No catch, that was it. Even though the 
investment was a measely $6, I had three questions that needed to be answered 
before I could get involved in this sort of thing.

1. IS THIS REALLY LEGAL??
I called a lawyer first. The lawyer was a little skeptical that I would
actually make any money but he said it WAS LEGAL if I wanted to try it.
I told him it sounded a lot like a chain letter but the details of the
system (SEE BELOW) actually made it a legitimate legal business.
2. Would the Post Office be ok with this....I called them: 1-800-725-2161 and 
they confirmed THIS IS ABSOLUTELY LEGAL! (See Title 18,h sections 1302 NS 1341 
of Postal Lottery Laws). This clarifies the program of collecting names and 
addresses for a mailing list.
3. Is this moral? Well, everyone who sends me a buck has a good chance
of getting A LOT of money ... a much better chance than buying a lottery
ticket!!!

So, having these questions answered, I invested EXACTLY $7.92 ... six
$1.00 bills and six 32 cent postage stamps ... and boy am I glad I did
!!!

Within 7 days, I started getting money in the mail! I was shocked! I still 
figured it would end soon, and didn't give it another thought. But the money 
just continued coming in. In my first week, I made about $20.00 to $30.00 
dollars. By the end of the second week I had a mad total of $1,000.00 !!!!!  In 
the third week I had over $10,000.00 and it was still growing. This is now my 
fourth week and I have made a total of just over $42,000.00 and it's still 
coming in ..... It's certainly worth $6.00 and 6 stamps !!! The *ONLY* thing 
stopping *ANYONE* from enrichening their own bank account is pure laziness ! It 
took me all of 5 MINUTES to print this out, follow the directions, and begin 
posting to newsgroups. It took me a mere 45 minutes to post to over 200 
newsgroups. And for this GRAND TOTAL investment of $ 7.92 (US) and under ONE 
HOUR of my time, I have reaped an incredible amount of money -- like nothing 
I've ever even heard of anywhere before ! 'Nuff said !

Let me tell you how this works, and most importantly, why it works.
Also, make sure you print a copy of this article now, so you can get the
information off of it when you need it. The process is very simple and
consists of THREE easy steps.

============
HOW IT WORKS
============
Mail the 6 envelopes to the following addresses:
STEP 1:
------
Get 6 separate pieces of paper and write the following on each
piece of paper:
 PLEASE ADD ME TO YOUR MAILING LIST.
 $1 US DOLLAR PROCESSING FEE IN ENCLOSED.
(THIS IS KEY AS THIS IS WHAT MAKES IT LEGAL SINCE YOU ARE PAYING FOR
 AND LATER OFFERING A SERVICE).
Now get 6 $1.00 bills and place ONE inside EACH of the 6 pieces of
paper so the bill will not be seen through the envelope to prevent
theft/robbery. Then, place one paper in each of the 6 envelopes and
seal them. You should now have 6 sealed envelopes, each with a piece
of paper stating the above phrase and a U.S. $1.00 bill.


#1 
J.M.
118 Madison Ave.
Watertown, MA 02172
USA

#2 
G.G.
512 NE 2nd
Blue Springs, MO 64014
USA

#3 
K.S.
877 Lot4 Perryman Rd
Lexington, NC 27292
USA

#4 
J.L.
2513 Holly Dr.
Pittsburgh, PA 15235
USA

#5 
S.F.
5823 W. Huron
Chicago, IL 60644
USA

#6 E.F.
77 East 1400 North #240
Logan, UT 84341
USA



STEP 2: Now take the #1 name off the list that you see above, move the
other names up (6 becomes 5, 5 becomes 4, etc...) and add YOUR Name as
number 6 on the list. (If you want to remain anonymous, put a nickname,
but the address MUST be correct. It, of course, MUST contain your
country, state/district/area, zip code, etc!!! You wouldn't want your
money to fly away, would you?!?!).

STEP 3: Now post your amended article to at least 200 newsgroups.
Remember, 200 postings is just a guideline. The more you post, the
more money you make!

Don't know HOW to post in the news groups? Well do exactly the
following:
------------------------------------------------------------------------

 HOW TO POST TO NEWSGROUPS FAST WITH YOUR WEB BROWSER:

 The fastest way to post a newsletter:
Highlight and COPY(Ctrl-C) the text of this posted message and
PASTE(Ctrl-V) it into a plain text editor(as Wordpad) and save it.
After you have made the necessary changes that are stated above,
simply COPY(Ctrl-C) and PASTE(Ctrl-V) the text into the message
composition window, after selecting a newsgroup, and post it! (Or
you can attach the file, without writing nothing to the message window.)

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

 If you have Netscape Navigator 3.0 do the following:
1. Click on any newsgroup like normal, then click on 'TO NEWS'. This
will bring up a box to type a message in.
2. Leave the newsgroup box like it is, change the subject box to
something flashy, something to catch the eye, as "$$$ NEED CASH $$$?!!
READ HERE!$!$!$" or "$$$!!!MAKE FAST CASH, YOU CAN'T LOSE!!!$$$". Or
you can use my subject title.
3. Now click on 'ATTACHMENTS'. Then click on 'ATTACH FILE'. Find your
file on your Hard Disk(the one you saved from the text editor). Once
you find it, click on it and then click 'OPEN' and 'OK'. You sould now
see
your file name in the attachments box.
4. Now click on 'SEND'/'POST'. You see? Now you just have 199 to
go!!!(Don't worry, it's easy and quick once you get used to it.)
NOTE: All the versions of Netscape Navigator's are similar to each
other, so you'll have no problem to do this if you don't have Netscape
Navigator 3.0.
------------------------------------------------------------------------

 !QUICK TIP!
 (For Netscape Navigator 3.x and above)
You can post this message to many newsgroups at a time, by simply
selecting a newsgroup near the top of the screen, hold down the SHIFT,
and then select a newsgroup near the bottom of the screen. All of the
newsgroups in/between will be selected. After that, you follow/do the
basic steps, stated below at this letter, except of step #1. You can
go to the page stated below in this letter and click on a newsgroup to
open up the newsgroups window. Once you've done this, in the same window

go to 'OPTIONS', and then mark 'SHOW ALL NEWSGROUPS' and 'SHOW ALL
MESSAGES'. Now you can see all the newsgroups and you can apply easier
the above tip.
------------------------------------------------------------------------

 If you have MS Internet Explorer do the following:
1. Go to the newsgroups and press 'POST AN ARTICLE'. To the new window
type your headline in the subject area and then click in the large
window below. There either PASTE your letter(which it's been copied
from the text editor), or attach the file which contains it.
2. Then click on 'SEND' or 'OK'.
NOTE: All versions of MS Internet Explorer are similar to each other,
so you won't have any problem doing this.

GENERAL NOTES ON POSTING: A nice page where you'll find all the
newsgroups if you want help is http://www.liszt.com/ (When you go to
the home page, click on the link 'Newsgroup Directory'). But I don't
think
you'll have any problem posting because it's very easy once you've
found the newsgroups. All these web browsers are similar. It doesn't
matter
which one you have.(But it makes it very easy if you have Netscape
Navigator 3.0 or later. You may download it from the Internet if you
don't have it.) You just have to remember the basic steps, stated
below.
BASIC STEPS FOR POSTING:
1. Find a newsgroup and you click on it.
2. You click on 'POST AN/NEW ARTICLE' or 'TO NEWS' or anything else
similar to these.
3. You type your flashy headline in the subject box.
4. Now, either you attach the file containing your amended letter, or
you PASTE the letter.(You have to COPY it from the text editor, of
course, from before.)
5. Finaly, you click on 'SEND' or 'POST' or 'OK', whatever is there.
------------------------------------------------------------------------

**REMEMBER, THE MORE NEWSGROUPS YOU POST IN, THE MORE MONEY YOU ILL
MAKE!! BUT YOU HAVE TO POST A MINIMUM OF 200**
That's it! You will begin receiving money from around the world within
day's! You may eventually want to rent a P.O.Box due to the lare
amount of mail you receive. If you wish to stay anonymous, youcan
invent a name to use, as long as the postman will deliver it.
**JUST MAKE SURE ALL THE ADDRESSES ARE CORECT.**
=================
Now the WHY part:
=================
Out of 200 postings, say I receive only 5 replies (a very low
example). So then I made $5.00 with my name at #6 on the letter. Now,
each of the 5 persons who just sent me $1.00 make the MINIMUM 200
postings, each with my name at #5 and only 5 persons respond to each of
the original 5, that is another $25.00 for me, now those 25 each make
200 MINIMUM posts with my name at #4 and only 5 replies each, I will
bring in an additional $125.00! Now, those 125 persons turn around and
post the MINIMUM 200 with my name at #3 and only receive 5 replies each,

I will make an additional $626.00! OK, now here is the fun part, each of

those 625 persons post a MINIMUM 200 letters with my name at #2 and they

each only receive 5 replies, that just made me $3,125.00!!! Those 3,125
persons will all deliver this message to 200 newsgroups with my name at
#1 and if still 5 persons per 200 newsgroups react I will receive
$15,625,00! With a original investment of only $6.00! AMAZING! And as
I said 5 responses is actually VERY LOW! Average is probable 20 to 30!
So lets put those figures at just 15 responses per person. Here is what
you will make:
at #6 $15.00
at #5 $225.00
at #4 $3,375.00
at #3 $50,625.00
at #2 $759,375.00
at #1 $11,390,625.00
When your name is no longer on the list, you just take the latest
posting in the newsgroups, and send out another $6.00 to names on the
list, putting your name at number 6 again. And start posting again.
The thing to remember is, do you realize that thousands of people all
over the world are joining the internet and reading these articles
everyday, JUST LIKE YOU are now!! So can you afford $6.00 and see if
it really works?? I think so... People have said, "what if the plan is
played out and no one sends you the money? So what! What are the chances

of that happening when there are tons of new honest users and new honest

people who are joining the internet and newsgroups everyday and are
willing to give it a try? Estimates are at 20,000 to 50,000 new users,
every day, with thousands of those joining the actual internet.
Remember,
play FAIRLY and HONESTLY and this will work. You just have to be honest.

** By the way, if you try to deceive people by posting the messages with
your name in the list and not sending the money to the rest of the
people already on the list, you will NOT get as much. Someone I talked
to knew someone who did that and he only made about $150.00, and
that's after seven or eight weeks! Then he sent the 6 $1.00 bills,
people added him to their lists, and in 4-5 weeks he had over $10k. This
is the fairest and most honest way I have ever seen to share the wealth
of the world without costing anything but our time!!! You also may want
to buy mailing and e-mail lists for future dollars.
Make sure you print this article out RIGHT NOW, also. Try to keep a
list of everyone that sends you money and always keep an eye on the
newsgroups to make sure everyone is playing fairly. Remember, HONESTY
IS THE BEST POLICY. You don't need to cheat the basic idea to make the
money!!
GOOD LUCK to all and please play fairly and reap the huge rewards from
this, which is tons of extra CASH.
Please remember to declare your extra income. Thanks once again...
=====================================================================
LEGAL ? ? ? (Comments from Bob Novak who started this new version.)
"People have asked me if this is really legal. Well, it is! You are
using the Internet to advertise you business. What is that business?
You are assembling a mailing list of people who are interested in
home based computer and online business and methods of generating
income at home. Remember, people send you a small fee to be added
to your mailing list.It is legal. what will you do with your list of
thousands of names? That's up to you."
So, build your mailing list, keep good accounts, declare the income
and pay your taxes. By doing this you prove your business intentions.
Keep an eye on the newsgroups and when the cash has stopped coming
(that means your name is no longer on the list), you just take the
latest posting at the newsgroups, send another $6.00 to the names
stated on the list, make your corrections (put your name at #6)
and start posting again.
=====================================================================
NOTES:
*1. In some countries, the export of the country's exchange is
illegal. But you can get the license to do this from the post office,
explaining the above statements (that you have an online business,
etc. You may have to pay an extra tax, but that's OK, the amount of
the incoming money is HUGE! And as I said, a few countries have that
restriction.
*2. You may want to buy mailing and e-mail lists for future
dollars. (Or Database or Spreadsheet software.)
*3. If you're really not sure or still think this can't be for real,
please print a copy of this article and pass it along to someone who
really needs the money, and see what happens.
*4. You will start getting responses within 1-2 weeks, it depends.



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

Date: Wed, 14 Jan 1998 10:09:55 -0600
From: Ken Holm <rets@meta3.com>
Subject: Business::CreditCard.pm
Message-Id: <34BCE353.6F59@meta3.com>

Let me first thank you guys for the work you've done particularly with
Perl.  Accolades to you both.

When trying to use Business::CreditCard.pm, I am getting an error.  I am
using the same version of CreditCard, different versions of CGI.pm on
separate boxes.

SYSTEM A:                    SYSTEM B:
=========                    =========
  OS            : Irix 6.2   OS            : BSDI BSD/OS 3.1 Kernel #2
  CGI.pm        : 2.36       CGI.pm        : 2.27
  CreditCard.pm : 0.21       CreditCard.pm : 0.21
  Perl          : 5.004      Perl          : 5.003_02

More extensive system/package information below.

I am successfully using CreditCard.pm on SYSTEM A (henceforth Irix).  I
can get CreditCard.pm to work ok from a script which does not use CGI.pm
but not with CGI.pm.

 ** CODE  STARTS **
    my $Flag = 0;
    
    ...

    $Flag++ if (cardtype($in{'Card Number'}) ne $in{'Card Type'});
    $Flag++ unless validate($in{'Card Number'});

 ** CODE ENDS **

When running from the command line (with -w):

ns6: {231} % ./drool.cgi
Content-type: text/html

(offline mode: enter name=value pairs on standard input)
Card+Number=1234123412341234
^D
Use of uninitialized value at
/usr/libdata/perl5/site_perl/Business/CreditCard.pm line 126, <> chunk
1.

CreditCard.pm reads:

  ** CODE STARTS **

(125)   $weight = substr($number, -1 * ($i + 2), 1) * (2 - ($i % 2));
(126)   $sum += (($weight < 10) ? $weight : ($weight - 9));

  ** CODE ENDS **

I have taken apart line 125.  I _think_ the problem lies with $i % 2. 
However, I have not been able to solve the problem.

I am going to get CGI.pm v2.36 for SYSTEM B to see if that clears things
up.  Any clues?  Should I just run outside of -w? <shiver>

Thanks again.

-K

 ***** SYSTEM INFORMATION *****

'use'ing the same Business::CreditCard.pm module on both systems.
Version 0.21.  Module list status is "Rdpf."

Also 'use'ing CGI.pm
SYSTEM A
========
$CGI::revision = '$Id: CGI.pm,v 2.36 1997/5/10 8:22 lstein Exp $';
$CGI::VERSION='2.36';

SYSTEM B
========
$CGI::revision = '$Id: CGI.pm,v 2.27 1996/10/22 12:08 lstein Exp $';
$CGI::VERSION='2.27';




SYSTEM A
========
IRIX Release 6.2 IP22
* plenty of RAM/disk space
* This is perl, version 5.004
Summary of my perl5 (5.0 patchlevel 4 subversion 0) configuration:
  Platform:
    osname=irix, osvers=6.2, archname=IP22-irix
    uname='irix daffy 6.2 03131015 ip22 '
    hint=recommended, useposix=true, d_sigaction=define
    bincompat3=y useperlio= d_sfio=
  Compiler:
    cc='cc -n32', optimize=' ', gccversion=
    cppflags='-D_BSD_TYPES -D_BSD_TIME -woff -DLANGUAGE_C'
    ccflags ='-D_BSD_TYPES -D_BSD_TIME -woff 1009,1110,1184
-DLANGUAGE_C'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    voidflags=15, castflags=0, d_casti32=define, d_castneg=define
    intsize=4, alignbytes=8, usemymalloc=y, randbits=15
  Linker and Libraries:
    ld='ld', ldflags =' -L/usr/local/lib -L/usr/lib32 -L/lib32'
    libpth=/usr/local/lib /usr/lib32 /lib32 /lib /usr/lib
    libs=-lm -lc
    libc=/usr/lib32/libc.so, so=so
    useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=, ccdlflags=' '
    cccdlflags=' ', lddlflags='-n32 -shared -L/usr/local/lib
-L/usr/lib32 -L/lib32'


Characteristics of this binary (from libperl): 
  Built under irix
  Compiled at Oct 28 1997 09:22:59
  @INC:
    /usr/local/lib/perl5/IP22-irix/5.004
    /usr/local/lib/perl5
    /usr/local/lib/perl5/site_perl/IP22-irix
    /usr/local/lib/perl5/site_perl
    .


SYSTEM B
========
BSDI BSD/OS 3.1 Kernel #2
* plenty of RAM/disk space
* This is perl, version 5.003_02

Summary of my perl5 (5.0 patchlevel 3 subversion 2) configuration:
  Platform:
    osname=bsdos, osvers=2.1, archname=i386-bsdos
    uname='bsdos austin.bsdi.com 2.1 bsdi bsdos 2.1 kernel #4: tue jul
30 13:59:26 mdt 1996 root@:usrsrcsyscompileaustin i386 '
    hint=recommended, useposix=true, d_sigaction=define
    perlstdio=define sfio=
  Compiler:
    cc='shlicc2', optimize='-O2', gccversion=2.7.2
    cppflags=''
    ccflags =''
    stdchar='char', d_stdstdio=, usevfork=false
    voidflags=15, castflags=0, d_casti32=define, d_castneg=define
    intsize=4, alignbytes=4, usemymalloc=n, randbits=31
  Linker and Libraries:
    ld='shlicc2', ldflags =' -L/usr/X11/lib'
    libpth=/usr/lib /usr/X11/lib
    libs=-lXpm -lXaw -lXmu -lXt -lSM -lICE -lXext -lX11 -ltcl -ltermcap
-lrpc -lcdrom -ldl -lm -lc
    libc=/usr/lib/libc.a, so=o
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=o, d_dlsymun=, ccdlflags=' '
    cccdlflags=' ', lddlflags='-r -L/usr/X11/lib'

  Locally applied patches:
        SUIDBUF - Buffer overflow fixes for suidperl security
  Built under bsdos
  Compiled at Apr 22 1997 12:48:10

Characteristics of this binary (from libperl): 
1  @INC:
    /usr/libdata/perl5/i386-bsdos/5.00302
    /usr/libdata/perl5
    /usr/libdata/perl5/site_perl/i386-bsdos
    /usr/libdata/perl5/site_perl
    /usr/libdata/perl5/site_perl/i386-bsdos/include
    .

-- 
Kennneth A Holm  |        META 3 - Webmaster        |webmaster@meta3.com
PO Box 1508      |----------------------------------|(601)948.3399 x 227
Jackson, MS 39215|PGP Key finger webmaster@meta3.com|(601)948.5999 (fax)


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

Date: Thu, 15 Jan 1998 07:14:03 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: C-style assert()ions
Message-Id: <34bda92b.524144494f47414741@radiogaga.harz.de>

Andy Lester (petdance@maxx.mc.net) wrote:
: After having been bitten the other night by mixing up an instance method
: and a class method, I'd like to do some C-style assertions.
[...]
: Is there a package somewhere that does this?  I know it wouldn't be too
: hard to roll my own, of course, but I'd just as soon use what exists
: already.  I see nothing like it in the CPAN.

Then look in your (standard distribution) perl's lib directory. There's
an assert.pl that looks like it's doing what you're searching for.

cu,
  Martin
--
                          | Martin Vorlaender | VMS & WNT programmer
 Ceterum censeo           | work: mv@pdv-systeme.de
 Redmondem delendam esse. |       http://www.pdv-systeme.de/users/martinv/
                          | home: martin@radiogaga.harz.de


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

Date: Thu, 15 Jan 1998 00:14:11 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: Can I create a Linked List in Perl
Message-Id: <34BD9B23.F666731C@coos.dartmouth.edu>

Brian Wheeler wrote:
> 

A doubly-linked list implentation in response to John Porter's
claim that Perl arrays aren't as functional as C-style linked
lists:

> 
>         Here's a doubly-linked list implementation using hashes and hash
> references. Its not pretty, but it works:
> 
> sub MakeNode {
>     my(%hash)=@_;
>     $hash{_prev}=undef;
>     $hash{_next}=undef;
>     return {%hash};
> }
> 
> sub AddNode {
>     my($node,$new_node)=@_;
>     $node->{_next}=$new_node;
>     $new_node->{_prev}=$node;
> }

You'd better hope $node is at the end of the list, or you've just lost
whatever nodes were after it.  And since it's a doubly-linked list,
I'd guess that their reference counts won't go to zero and they'll
stay in memory.

sub AddNode {
    my($node,$new_node)=@_;
    my($temp)=$node->{_next};

    $node->{_next}=$new_node;
    $new_node->{_prev}=$node;
    $new_node->{_next}=$temp;
    if (defined $temp) {
        $temp->{_prev}=$new_node;
    }
}

> sub NextNode {
>     my($node)=@_;
>     return $node->{_next};
> }
> 
> sub PrevNode {
>     my($node)=@_;
>     return $node->{_prev};
> }
> 
> It could be simplified or expanded, but its pretty easy to do them in
> perl...if you have the desire/need to ;)  Perhaps someone should make a
> linked list class with new, add, next, and prev methods....

As I stated in my response to John Porter, Perl arrays are
as functional as C-style linked lists.

Here are new, add, next, and prev methods, for a linked list
implemented simply as an array.

sub newList {
  my($node) = @_;
  return ([$node], 0);
}

sub addNode {
  my($list, $idx, $newnode) = @_;

  splice(@{$list}, ++$idx, 0, $newnode);
  # (add after the node at $idx)
  $idx;
}

sub nextNode {
  my($list, $idx) = @_;

  $idx++;
  if ($idx > $#{$list}) {
    return undef;
  } else {
    return $idx;
  }
}

sub prevNode {
  my($list, $idx) = @_;

  $idx--;
  if ($idx < 0) {
    return undef;
  } else {
    return $idx;
  }
}

($nums, $head) = newList(0);
$cur = $head;
for($i=1;$i<8;$i++) {
    $cur = addNode($nums, $cur, $i);
}

$cur = $head;
while(defined($cur)) {
    print 'data: ', $nums->[$cur], "\n";
    $cur = nextNode($nums, $cur);
}

Of course, you don't really need all these functions to
manipulate an array; they were merely written to provide
an analogy to linked lists.

Chipmunk


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

Date: Thu, 15 Jan 1998 00:59:24 -0600
From: EntreprenuerOnline <melton@pitnet.net>
Subject: Can one Use Image Maps?
Message-Id: <34BDB3CB.FA8A6931@pitnet.net>

This may sound like a newbie question but CAN & HOW does one use Image
maps in Perl 5 generated pages? I have written several scripts that
generate pages but have never tried to incorporate an Image Map. I
simply (and seemingly incorrectly) assumed that the script recognized
the map as an html tag. Below is a sample of my last attempt. This works
GREAT, if I take out the portions referring to the image. If one can use
image maps, what am I doing wrong?

Thanks in advance.

Sincerely,
April D. Melton

SAMPLE:

$header=  qq~<HTML><HEAD><TITLE>Our Server Packages</TITLE></HEAD><BODY
BGCOLOR="#FFFFFF">
<IMG SRC="Headline.gif" ALT="EntreprenuerOnline Headline" BORDER=0
USEMAP="#Headline" HEIGHT=22 WIDTH=600></CENTER> <CENTER><MAP
NAME="Headline"><AREA SHAPE="RECT" COORDS="420,3,510,20"
HREF="http://www.corenet.net/melton/bizpage/idea3.htm"
ALT="HOME"></AREA><AREA SHAPE="RECT" COORDS="512,2,599,21"
HREF="mailto:melton@pitnet.net" ALT="EMAIL"></AREA></MAP>~;

sub header {
print qq~$header\n~;
}

sub footer {
print qq~$footer\n~;
}

sub print_page{
&header;
&body;
&footer
}end of sub print_page



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

Date: Thu, 15 Jan 1998 07:22:49 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: Can Perl talk smtp protocol under NT4?
Message-Id: <34bdab39.524144494f47414741@radiogaga.harz.de>

Jeffrey R. Drumm (drummj@mail.mmc.org) wrote:
: "Alex Dowad" <adowad@nospam.uniserve.com> wrote:
: >I thought that Net::SMTP only worked on UNIX. Was I wrong? And if so, how
: >do you get it working on Windows?

: Net::SMTP is distributed with Gurusamy Sarathy's port of Perl for NT. I was
: going to say that it works fine (based on my experience with Graham's other
: libnet 1.06.03 modules under NT), at least, until I tested it.

It does work. You just have to pass it the right parameters. ;-)

BTW: I'm talking about the standard distribution/libnet package,
compiled with MSVC 4.2.

: It does send mail, but it generates 3 error messages (shown below in the debug
: output). These messages are not Perl messages, however, and seem to be related
: to the backticking of the Unix-specific commands used in the Net::Domain
: module.

: Net::Domain::_hostname(D:\Perl5.04\lib\site/Net/Domain.pm:55):
: 55:             chop($host = `(hostname) 2>/dev/null`); # BSD'ish
:   DB<1>
: The system cannot find the path specified. << 1st error
: Net::Domain::_hostname(D:\Perl5.04\lib\site/Net/Domain.pm:60):
: 60:             chop($host = `uname -n 2>/dev/null`); ## SYSV'ish && POSIX'ish
:   DB<1>
: The system cannot find the path specified. << 2nd error
: Net::Domain::_hostname(D:\Perl5.04\lib\site/Net/Domain.pm:65):
: 65:             $host = (split(/[:\. ]/,`/com/host`,6))[0];
:   DB<1>
: The system cannot find the path specified. << 3rd error

These messages (or some other about being unable to find syscall.ph on my
system) occur only if you don't specify the 'host' parameter with the 
Net::SMTP->new() method.

In the CGI script of mine where I stumbled over this I just provided
$ENV{SERVER_NAME}; since then, no more messages are bothering me.

cu,
  Martin
--
                          | Martin Vorlaender | VMS & WNT programmer
 Ceterum censeo           | work: mv@pdv-systeme.de
 Redmondem delendam esse. |       http://www.pdv-systeme.de/users/martinv/
                          | home: martin@radiogaga.harz.de


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

Date: Thu, 15 Jan 1998 13:15:27 -0800
From: Patrick Stacey <patrick@mediacity.com.sg>
Subject: Re: Displaying GIFs - oops
Message-Id: <34BE7C6F.61CE@mediacity.com.sg>

Thx for the efforts John, but still unable to display. Goto:

http://pat.mediacity.com.sg/adengine/test5.pl

Here's the new code:
--------------------
$gif_image = "c:\\webdocs\\adengine\\sndscape.gif";

binmode(STDOUT);

open(IMAGE,"<".$gif_image);
 $no_bytes = (stat($gif_image))[7];
 undef $/;
 print "Content-type: image/gif\n";
 print "Content-length: $no_bytes\n\n";
 print <IMAGE>;
 $/ = "\n";
close(IMAGE);
--------------------

TIA

/pks

John Porter wrote:
> 
> You definitely should undef $/ so that <IMAGE> gets the entire image
> data blob at once.
> 
> Also, you might try setting binmode(STDOUT).
> 
> Also, after you've read the image data into $gif_image,
> you can get the number of bytes (content length) by simply
> calling length($gif_image), rather than doing the stat.

browser doesn't like that.


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

Date: Thu, 15 Jan 1998 01:19:07 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Displaying GIFs - oops
Message-Id: <comdog-ya02408000R1501980119070001@news.panix.com>
Keywords: from just another new york perl hacker

In article <34BE7C6F.61CE@mediacity.com.sg>, @mediacity.com.sg posted:

>open(IMAGE,"<".$gif_image);

are you sure that you even have an open filehandle?

   open IMAGE, $gif_image or die "$!\n";

> $no_bytes = (stat($gif_image))[7];

might as welll use the -s operator there, just as the docs on
stat() tell you to do.

just as a check, do you get a non-zero file size?

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Thu, 15 Jan 1998 17:24:39 +1100
From: bigiain@mightymedia.com.au (Iain Chalmers)
Subject: Re: Displaying GIFs - oops
Message-Id: <bigiain-ya02408000R1501981724390001@news.ozemail.com.au>

In article <34BE7C6F.61CE@mediacity.com.sg>, @mediacity.com.sg wrote:

> Thx for the efforts John, but still unable to display. Goto:
> 
> http://pat.mediacity.com.sg/adengine/test5.pl
> 
> Here's the new code:
> --------------------
> $gif_image = "c:\\webdocs\\adengine\\sndscape.gif";
> 
> binmode(STDOUT);
> 
> open(IMAGE,"<".$gif_image);
>  $no_bytes = (stat($gif_image))[7];
>  undef $/;
>  print "Content-type: image/gif\n";
>  print "Content-length: $no_bytes\n\n";
>  print <IMAGE>;
>  $/ = "\n";
> close(IMAGE);
> --------------------

FWIW,
i just tried telnetting to your webserver and doing a:

GET /adengine/test5.pl

and your server is not sending the Content-type or Content-length headers

cheers

iain

Iain Chalmers
bigiain@mightymedia.com.au


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

Date: 15 Jan 1998 06:21:46 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Displaying GIFs - oops
Message-Id: <69k9tq$8ir$1@comdyn.comdyn.com.au>

In article <34BE7C6F.61CE@mediacity.com.sg>,
	Patrick Stacey <patrick@mediacity.com.sg> writes:
> Thx for the efforts John, but still unable to display. Goto:

> binmode(STDOUT);
> 
> open(IMAGE,"<".$gif_image);

still no binmode here? How often do we need to suggest this?

binmode(IMAGE);

If your GIF contains a ctrl-Z character, the OS sees that as an EOF,
unless you use binmode.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | For heaven's sake, don't TRY to be
Commercial Dynamics Pty. Ltd.       | cynical. It's perfectly easy to be
NSW, Australia                      | cynical.


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

Date: Thu, 15 Jan 1998 14:54:51 -0800
From: Patrick Stacey <patrick@mediacity.com.sg>
Subject: Re: Displaying GIFs - THX
Message-Id: <34BE93BB.1E44@mediacity.com.sg>

OK - the script now works thanks to y'all.

Goto:

http://pat.mediacity.com.sg/adengine/test5.pl

Basically both the STDOUT and file-handle needed to be in binmode. 

Code:

--------
$gif_image = "c:\\webdocs\\adengine\\sndscape.gif";

binmode(STDOUT);

open(IMAGE,"<".$gif_image);
 binmode(IMAGE);
 $no_bytes = (stat($gif_image))[7];
 undef $/;
 print "Content-type: image/gif\n";
 print "Content-length: $no_bytes\n\n";
 print <IMAGE>;
 $/ = "\n";
close(IMAGE);
--------

THANKOO!

/pks


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

Date: Thu, 15 Jan 1998 00:41:57 -0600
From: language@gol.com
Subject: Help !
Message-Id: <884846069.570818580@dejanews.com>

Hi Everyone, very new to all this , my friend
told me you may help...


I am an English teacher, I want to have
students click on multiple answer questions,
from my page, and their answers are auto
emailed to me .
Is there anywhere that I can get a sample to
cut and paste into my body of HTML

Any help, much appreciated.


Ian

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


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

Date: Thu, 15 Jan 1998 01:37:13 -0600
From: EntreprenuerOnline <melton@pitnet.net>
Subject: Re: Help !
Message-Id: <34BDBCA7.4ACAFF77@pitnet.net>

Hello:

I read your post & although I do not know of any cgi (perl or C) that
you can just cut & paste into your html without a cgi-bin, I have written
scripts that provide students/visitors with a multiple question format & can
mail the results  to you.

If you would like to see samples of my work, please visit EntreprenuerOnline

at http://www.corenet.net/melton/bizpage. Its located in the Business Start
Up Center. Most of the other scripts on the site were also written by me. If

you like what you see, email me & we can discuss your needs further.

April D. Melton




language@gol.com wrote:

> Hi Everyone, very new to all this , my friend
> told me you may help...
>
> I am an English teacher, I want to have
> students click on multiple answer questions,
> from my page, and their answers are auto
> emailed to me .
> Is there anywhere that I can get a sample to
> cut and paste into my body of HTML
>
> Any help, much appreciated.
>
> Ian
>
> -------------------==== Posted via Deja News ====-----------------------
>       http://www.dejanews.com/     Search, Read, Post to Usenet





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

Date: Thu, 15 Jan 1998 01:55:27 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
To: Dave Ekhaus <dse@gist.com>
Subject: Re: help a beginner with search string
Message-Id: <34BDB2DF.4F049C52@coos.dartmouth.edu>

[posted and mailed]

Dave Ekhaus wrote:
> 
> <!FIELD [tagname]>
> [tagvalue]
> <!/FIELD>
>     i need to be able to extract just the 'tagname' and the 'tagvalue'
> from the input - which will contain hundreds of these name/value pairs,
> with varying degrees of complexity (tagvalues may contain, html, plain
> text, etc...).

%tags = m{<!FIELD ([^>]*)>\n?(.*?(?=\n?<!/FIELD>))}gs;

is one way of doing it, although it may be slow.

It also assumes that the tagnames are unique.

And a commented version:

%tags = m{
       <!FIELD ([^>]*)>    # opening tag.  save tagname to $1
                           #   tagname cannot contain >
       \n?                 # optional newline (not part of tagvalue)
       (.*?                # nongreedy match of tagvalue, save to $2
        (?=                # zero-width positive assertion
         \n?               # optional newline (not part of tagvalue)
         <!/FIELD>         # closing tag
        )                  # end of assertion
       )                   # end of tagvalue capturing
    }gsx;                  # global, . matches \n

Chipmunk


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

Date: Thu, 15 Jan 1998 01:26:43 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: Help with my code please
Message-Id: <34BDAC23.4BD38A46@coos.dartmouth.edu>

Greg Bacon wrote:
> 
> In article <34BCF104.714E0833@ixl.com>,
>         Dan Boorstein <dboorstein@ixl.com> writes:
> : for $field ($sitename, $type, $name) { # et cetera
> :   $field =~ s/,|\n//g;
> : }
> 
> Better yet
> 
>     foreach $field ($sitename, $type, $name, ...) {
>         $field =~ s/[,\n]+//g;
>     }

Best yet ;-)

foreach $field ($sitename, $type, $name, ...) {
    $field =~ tr/,\n//d;
}

Note that all of these remove all commas and newlines,
whereas the poster's original code only removed the
first comma and the first newline.

Chipmunk


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

Date: 15 Jan 1998 05:03:34 GMT
From: awrobinson@aol.com (Awrobinson)
Subject: Re: Newbie: how to get file permissions?
Message-Id: <19980115050301.AAA00881@ladder02.news.aol.com>

Thanks!
Andrew Robinson
---
Disclaimer: The opinions expressed are mine alone and do not represent the
views of America Online


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

Date: Wed, 14 Jan 1998 23:05:43 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: perl -- a language for LEARNING programming?
Message-Id: <34BDA716.528A4A12@5sigma.com>

I'm not sure why you're asking.  If you want to learn C or C++,
go ahead!  If not, keep using Perl.  It will take you a while to
run out of useful things to do in Perl, as you have probably
figured out already ....

With the features built into Perl you will not have a particular
need for the contents of an algorithms book.  I'm pretty well
versed in compiler theory, graph algorithms, etc., and I really
can't remember the last time I did something in Perl where those
years of study came in handy.  Well, OK, looking through the Perl 
source code.

A basic understanding of sorting, searching, hashing, etc. might
come in handy.  I still like the classic Algorithms+Data Structures
= Programs, but Sedgewick (the C version) is a pretty good modern
substitute.  The best book I've ever seen on filing structures,
BY FAR, is my old NC State prof's book, File Organization and 
Processing, Alan L. Tharp.

	-joseph
	 http://www.effectiveperl.com

notsew@wwa.com wrote:
> 
> so i've learned a bit of perl, as i figured it'd be helpful on the job
> and it has been.  got the camel book, read some articles, etc.  i love
> it.
> 
> i've no formal training in programming, but i'm thinking now i'd like
> to take some classes or at least do some reading (classes seem
> generally too slow) in general programming theory -- [...]


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

Date: 14 Jan 98 23:41:54 GMT
From: grsshpper@feedME
Subject: Re: Perl running under Linus - #!/bin/usr
Message-Id: <34bd4d42.0@lightning.ica.net>

oroginally I said ...

> I have a question that relates to Perl running under Linux.
> 
> As I understand things, the first line in a perl program 
> in Linux should be #!/bin/usr/perl 

<snip>
 
> Am I wrong about the effect of the #!/bin/usr/perl 
> statement ?

<snip>

OK...  I solved the problem ...  thanks for the replies ..


------------------------------------------------------------------
              Hungry for NEWSGROUPS??? USE feedME.ORG             
         Read and Post to 30,000 groups through feedME.ORG        
     FREE  FREE  FREE  http://www.feedME.ORG  FREE  FREE  FREE    
------------------------------------------------------------------



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

Date: Wed, 14 Jan 1998 20:28:22 -0800
From: Adolf Chavez <adolf@tio.com>
Subject: perl script for deleting text between two markers?
Message-Id: <34BD9066.10E6@tio.com>

Hello. I'm working with a directory with a large number
of html files in it and am trying to find a simple perl
script that will go through each html file and remove everything between
two markers. And optionally replace everything between the markers with
another piece of text.


For example if I had this html file :

<html>
<head>stuff</head>
<body>
text of file
<!-markerstart-->
more test
<!-markerend-->
<body>
</html>

so that after the perl script was run on it you would have :

<html>
<head>stuff</head>
<body>
text of file
<body>
</html>

 Please don't flame. I tried doing some net searches for
an example of script like this - but couldn't find anything that would
do it.  I'm not a Perl programmer - but understand that this language
may be well suited for doing this. If you know of any scripts that are
at all similar or have a way of doing this - I would greatly appreciate
any information or pointers.

Thanks,
Adolf 
adolf@newart.com


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

Date: Wed, 14 Jan 1998 22:19:08 -0800
From: SnowSim@halcyon.com (Simulated Snow)
Subject: Re: perl under windows95
Message-Id: <SnowSim-1401982219090001@blv-lx104-ip16.nwnexus.net>

In article <34BB8FC0.6F7EC31A@mail.uca.edu>, Cameron Dorey
<camerond@mail.uca.edu> wrote:

> Lynchqvctc wrote:
[snip]
> This does not always work in Win95 (don't know about NT)

fails there sometimes also...all too "regularly" for my taste

-- 
"I know of no safe depository of the ultimate powers of the society but the
people themselves; and if we think them not enlightened enough to exercise their
control with a wholesome discretion, the remedy is not to take it from them but
to inform their discretion." - Thomas Jefferson


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

Date: Wed, 14 Jan 1998 11:41:06 -0500
From: Bill Jones <webmaster@fccj.cc.fl.us>
Subject: Re: Problem calling a cgi from cgi
Message-Id: <34BCEA93.10EE@fccj.cc.fl.us>

You are apparently having a problem with the web interface as well.

Your links should look like this for it to call another cgi:

<a href="http:/cgi/some.cgi?someparams">Click for SomeParams</A>

Pls see the CGI.pm module for more insight into this issue.  It can be
found distributed with Version 5.004x or at a local CPAN.

HTH,
Bill


Maxwell Smart wrote:
> 
>     I4m not an expert perl programmer, but i have to design avarious
> script4s in perl, and this is my problem, well the biggest at this time:
> 
>     I have a cgi generated from an user consult sent in the url, the the
> page in the screen have many word tha have to b linked with other cgi. I
> tried to do using the next
> 
>     <a href="04.cgi">$A,</a>
> 
>     where $A is the word that have to be linked with the next cgi that
> will present mor info about the word.
> 
>     Well my dear friends, this is my problem, I really need your help so
> I4ll be waiting for you...        Thanks
> 
> Jorge
> 
>     Please send me a mail to the next adress: patomas@hotmail.com


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

Date: Thu, 15 Jan 1998 02:01:53 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
To: Ian Goldstein <nygsi@ny.ubs.com>
Subject: Re: reg exp question
Message-Id: <34BDB460.F9584E0D@coos.dartmouth.edu>

Ian Goldstein wrote:
> 
> I want to extract all instances of duplicate consecutive
> characters from a string. I came up with a simple algorithm,
> but was wondering if there was a "shorter" method.
> 
> Any pointers would be appreciated. Here is the script:
> 
> #!/usr/local/bin/perl5
> 
> $string = $ARGV[0];
> $_= $string;
> 
> while ( /([a-z])\1/ )  {
>       print "dupe $1\n";
>       $_ = $';
> }

$' should be avoided.  It slows down the entire script because
it forces all regexes to make copies of the target strings.

while (/([a-z])\1/g) {
  print "dupe $1\n";
}

This takes advantage of the magic of /g in a scalar context.

Chipmunk


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

Date: Thu, 15 Jan 1998 00:36:02 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: responding to prompting programs
Message-Id: <comdog-ya02408000R1501980036020001@news.panix.com>
Keywords: from just another new york perl hacker

In article <34BD90D8.64E3C48@dkstat.com>, Jean-Paul Cozzatti <jp@dkstat.com> posted:

>I would actually like to use such methods to make a cgi that makes
>additions to an .htaccess password file.
>Is this possible?

see HTTPD::UserAdmin at your favorite CPAN [1]

[1] 
Comprehensive Perl Archive Network
find one near you at <URL:http://www.perl.com>

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

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 1644
**************************************

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