[12720] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 131 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 13 20:07:30 1999

Date: Tue, 13 Jul 1999 17:02:48 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 13 Jul 1999     Volume: 9 Number: 131

Today's topics:
        Reclaiming hashed memory <laurens@bsqaure.com>
    Re: Reclaiming hashed memory (Anno Siegel)
    Re: Reclaiming hashed memory <laurens@bsquare.com>
    Re: Reclaiming hashed memory <laurens@bsqaure.com>
    Re: redirect perl script to other domain (Abigail)
    Re: regex to eat all html tags (Craig Berry)
    Re: regex to eat all html tags (Abigail)
    Re: regex to eat all html tags (Philip 'Yes, that's my address' Newton)
    Re: Removing duplicate items (Abigail)
        Running PERL darkmanjs@my-deja.com
        sample code for net::pop3? <breville@mpce.mq.edu.au>
    Re: sample code for net::pop3? (Michael Fuhr)
    Re: Script question (Tad McClellan)
        Search help for PerlMagick. <fh-mail@usa.net>
        Searching a new whois database inlandpac@my-deja.com
    Re: Searching a new whois database (Abigail)
        Searching files inlandpac@my-deja.com
        Searching flat file problems inlandpac@my-deja.com
    Re: Searching flat file problems (Tad McClellan)
    Re: Sending Attachments with email <donnawalk@netscape.net>
    Re: Sending Attachments with email <jcreed@cyclone.jprc.com>
    Re: Sending email by perl in NT <donnawalk@netscape.net>
        Simple HTTPd filter dbpete@my-deja.com
    Re: Simple HTTPd filter (Abigail)
    Re: Simple HTTPd filter <ckaiser@stockholm.ptloma.edu>
    Re: Simple HTTPd filter (Tad McClellan)
    Re: Simple HTTPd filter (Randal L. Schwartz)
    Re: simple Perl question: (Abigail)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Mon, 12 Jul 1999 13:55:21 -0700
From: "Lauren Smith" <laurens@bsqaure.com>
Subject: Reclaiming hashed memory
Message-Id: <7mdkob$fkj$1@brokaw.wa.com>

Hi all,

In Perl FAQ 3:19 it says that I am unable to reclaim hashed memory.  Does
this apply also to hashes created inside the scope of a loop?

When I check the size of the hash after each iteration, it either stays the
same size or increases in size.  My impression of scoped variables was that
they were destroyed upon reaching the end of their block.

Since the program runs over data in a large set of files memory constraints
eventually become an issue.  Is there a way to shrink the size of a hash?

Thanks,
Lauren




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

Date: 13 Jul 1999 20:25:17 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Reclaiming hashed memory
Message-Id: <7mg7bd$d73$1@lublin.zrz.tu-berlin.de>

Lauren Smith <laurens@bsqaure.com> wrote in comp.lang.perl.misc:
>Hi all,
>
>In Perl FAQ 3:19 it says that I am unable to reclaim hashed memory.  Does
>this apply also to hashes created inside the scope of a loop?

It says you can't free memory so that you program shrinks (below
a size it has once reached).  You still can free memory inside
your program for re-use.

>When I check the size of the hash after each iteration, it either stays the
>same size or increases in size.  My impression of scoped variables was that
>they were destroyed upon reaching the end of their block.

How do you check the size of your hash?  If it still exists, it hasn't
gone out of scope (obviously).

>Since the program runs over data in a large set of files memory constraints
>eventually become an issue.  Is there a way to shrink the size of a hash?

undef %hash, or, as you say, letting it go out of scope.

Anno


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

Date: Tue, 13 Jul 1999 15:31:08 -0700
From: "Lauren Smith" <laurens@bsquare.com>
Subject: Re: Reclaiming hashed memory
Message-Id: <7mgena$hdu$1@brokaw.wa.com>


Anno Siegel wrote in message <7mg7bd$d73$1@lublin.zrz.tu-berlin.de>...
>Lauren Smith <laurens@bsqaure.com> wrote in comp.lang.perl.misc:


>>When I check the size of the hash after each iteration, it either stays
the
>>same size or increases in size.  My impression of scoped variables was
that
>>they were destroyed upon reaching the end of their block.
>
>How do you check the size of your hash?  If it still exists, it hasn't
>gone out of scope (obviously).


I assigned the hash to a scalar:

my $hash_size = %hash;
print $hash_size;

Output:
12/256

This is put inside the loop where %hash is also created with my().

The contents of the hash increase and decrease in size, but the total size
of the hash only increases.  It seems that when the hash is destroyed only
the contents are destroyed.

Of course, my whole interpretation of assigning the hash to a scalar is
mistaken, but the ## / ### format gives me the impression that I am looking
at the number of elements vs. the size of the hash.

>undef %hash

I have tried this to no avail.  The hashtable never gets destroyed nor
shrunk, it seems.

Maybe this is a feature (bug?) in ActivePerl?

Lauren





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

Date: Tue, 13 Jul 1999 15:44:54 -0700
From: "Lauren Smith" <laurens@bsqaure.com>
Subject: Re: Reclaiming hashed memory
Message-Id: <7mgfhl$gs4$1@brokaw.wa.com>


Anno Siegel wrote in message <7mg7bd$d73$1@lublin.zrz.tu-berlin.de>...
>Lauren Smith <laurens@bsqaure.com> wrote in comp.lang.perl.misc:


>>In Perl FAQ 3:19 it says that I am unable to reclaim hashed memory.  Does
>>this apply also to hashes created inside the scope of a loop?
>
>It says you can't free memory so that you program shrinks (below
>a size it has once reached).  You still can free memory inside
>your program for re-use.
>


Doh!  If the problem is what I think it is, I'm just creating a hash that
takes up the size of memory.  Since speed is not a priority, maybe I'll
rewrite this script storing the values in an array.

Thanks,
Lauren




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

Date: 13 Jul 1999 00:13:14 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: redirect perl script to other domain
Message-Id: <slrn7olimh.h7.abigail@alexandra.delanet.com>

deja@kiama.com (deja@kiama.com) wrote on MMCXLI September MCMXCIII in
<URL:news:7mcrd0$mng$1@nnrp1.deja.com>:
,, I am looking for a way to make a perl script redirect to another perl
,, script on a different domain. I tried the obvious, but it doesn't seem
,, to work:

It works the same as if you would want to to redirect from one
SNOBOL program to another, aka, this is not a Perl program.

Please find yourself a more suitable group.



Abigail
-- 
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Mon, 12 Jul 1999 21:54:16 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: regex to eat all html tags
Message-Id: <cuti3.29$SH.445@newsfeed.slurp.net>

Abigail (abigail@delanet.com) wrote:
: dave shaffer (shaffer2@ptd.net) wrote on MMCXXXV September MCMXCIII in
: <URL:news:Zqwg3.255$uA5.40194@nnrp1.ptd.net>:
: // HELP!!!
: // 
: // I need a regular expression to match/remove html tags -actually anything in
: // greater/lessthan brackets "<all characters >" and on multiple lines.
: 
: Well, the first is impossible - see the FAQ. 
: The latter is trivial, s/<.*>//s;  But you probably don't want that.


Especially as it's broken* -- use s/<.*?>//s; instead.

* Either that, or Abigail is playing a little "work to spec" game with
  your question.

-- 
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      "It's not an optical illusion; it just looks like one."


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

Date: 12 Jul 1999 21:01:31 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: regex to eat all html tags
Message-Id: <slrn7ol7f2.h7.abigail@alexandra.delanet.com>

Craig Berry (cberry@cinenet.net) wrote on MMCXLI September MCMXCIII in
<URL:news:cuti3.29$SH.445@newsfeed.slurp.net>:
$$ Abigail (abigail@delanet.com) wrote:
$$ : dave shaffer (shaffer2@ptd.net) wrote on MMCXXXV September MCMXCIII in
$$ : <URL:news:Zqwg3.255$uA5.40194@nnrp1.ptd.net>:
$$ : // HELP!!!
$$ : // 
$$ : // I need a regular expression to match/remove html tags -actually anything
$$ : // greater/lessthan brackets "<all characters >" and on multiple lines.
$$ : 
$$ : Well, the first is impossible - see the FAQ. 
$$ : The latter is trivial, s/<.*>//s;  But you probably don't want that.
$$ 
$$ 
$$ Especially as it's broken* -- use s/<.*?>//s; instead.

Why? Dave said "<all characters >", so if I have "foo <bar> baz <quuz>",
I assume he wants to remove "<bar> baz <quuz>". Or is any of '>', ' ',
'b', 'a', 'z', '<' not a character in your book?



Abigail
-- 
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
         / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 
         % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
         BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Tue, 13 Jul 1999 04:54:13 GMT
From: nospam.newton@gmx.net (Philip 'Yes, that's my address' Newton)
Subject: Re: regex to eat all html tags
Message-Id: <378ac4c4.2622908@news.nikoma.de>

On Mon, 12 Jul 1999 21:54:16 GMT, cberry@cinenet.net (Craig Berry)
wrote:

>Abigail (abigail@delanet.com) wrote:
>: dave shaffer (shaffer2@ptd.net) wrote on MMCXXXV September MCMXCIII in
>: <URL:news:Zqwg3.255$uA5.40194@nnrp1.ptd.net>:
>: // HELP!!!
>: // 
>: // I need a regular expression to match/remove html tags -actually anything in
>: // greater/lessthan brackets "<all characters >" and on multiple lines.
>: 
>: Well, the first is impossible - see the FAQ. 
>: The latter is trivial, s/<.*>//s;  But you probably don't want that.
>
>
>Especially as it's broken* -- use s/<.*?>//s; instead.
>
>* Either that, or Abigail is playing a little "work to spec" game with
>  your question.

Well, the original poster did say "< ALL CHARACTERS >"... and *all*
characters is .* ... so Abigail was just telling him what he asked for
(not necessarily what he wanted to know, but them's the breaks).

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.net>


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

Date: 12 Jul 1999 21:11:42 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Removing duplicate items
Message-Id: <slrn7ol826.h7.abigail@alexandra.delanet.com>

Jason Stapels (jmstapel_n0spam@mtu.edu) wrote on MMCXLI September
MCMXCIII in <URL:news:7md4cp$st6$1@campus1.mtu.edu>:
__ I was wondering what a quick way of going through a list and
__ removing duplicate entries would be.


That's a FAQ, isn't?

@unique = do {local %_; grep {!$_ {$_} ++} @duplicates};


Abigail
-- 
echo "==== ======= ==== ======"|perl -pes/=/J/|perl -pes/==/us/|perl -pes/=/t/\
 |perl -pes/=/A/|perl -pes/=/n/|perl -pes/=/o/|perl -pes/==/th/|perl -pes/=/e/\
 |perl -pes/=/r/|perl -pes/=/P/|perl -pes/=/e/|perl -pes/==/rl/|perl -pes/=/H/\
 |perl -pes/=/a/|perl -pes/=/c/|perl -pes/=/k/|perl -pes/==/er/|perl -pes/=/./;


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Tue, 13 Jul 1999 19:03:00 GMT
From: darkmanjs@my-deja.com
Subject: Running PERL
Message-Id: <7mg2gq$rj9$1@nnrp1.deja.com>

How do I start a Perl script from an HTML file, and does it need to be
an SSI document?  I tried <!--#include variable="yada yada"--> and that
didn't work.  I also tried substituding 'name' in for 'variable'.  Can
someone help??


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Tue, 13 Jul 1999 18:43:16 +1000
From: "Brendan Reville" <breville@mpce.mq.edu.au>
Subject: sample code for net::pop3?
Message-Id: <7meu7u$pql$1@sunb.ocs.mq.edu.au>

hi all,

I hate asking what's probably a RTFM kinda question, but I've had no luck
hunting Perl sites today.  I'm trying to find authoritative documentation on
Net::pop3, which I was told was part of the normal libraries for Perl.
Secondly, I'd like to find some sample code showing how to use New::pop3
(the only documentation I found through altavista had the sample code
section empty).  Any suggestions on exactly where I can find these things?

thanks heaps





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

Date: 13 Jul 1999 03:03:24 -0600
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: sample code for net::pop3?
Message-Id: <7mevcs$lf1@flatland.dimensional.com>

"Brendan Reville" <breville@mpce.mq.edu.au> writes:

> I hate asking what's probably a RTFM kinda question, but I've had no luck
> hunting Perl sites today.  I'm trying to find authoritative documentation on
> Net::pop3, which I was told was part of the normal libraries for Perl.
> Secondly, I'd like to find some sample code showing how to use New::pop3
> (the only documentation I found through altavista had the sample code
> section empty).  Any suggestions on exactly where I can find these things?

Go to http://www.perl.com/ and enter "Net::POP3" in the "Search Perl
Reference" box partway down the left-hand side of the page.  It'll tell
you which module to install; documentation is included.

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/


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

Date: Mon, 12 Jul 1999 10:52:18 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Script question
Message-Id: <2fvcm7.rfe.ln@magna.metronet.com>

Faisal Nasim (swiftkid@bigfoot.com) wrote:
: : :Does anyone know of a PERL script that could accomplish this without
: : :system calls?
: :
: : It's quite impossible, because if you do not consult the operating
: : system about its files, you cannot know what your operating system
: : thinks its files are!


   I wonder who it was that said the quote above.

   You should leave in the attribution when you quote someone...


: Doesn't glob()/readdir work on all systems?


   "work" in conjuction with "glob" is arguable (due to its 
   dependence on a shell).

   I think readdir() works on all systems.


: The sample shell script also uses 'find' call.


   Tom was being pedantic about system() calls versus System calls
   (i.e. calls that talk to the kernel).


   glob()/readir()/find()  _all_ make System calls.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Tue, 13 Jul 1999 23:30:45 +0200
From: Frank =?iso-8859-1?Q?H=F6lting?= <fh-mail@usa.net>
Subject: Search help for PerlMagick.
Message-Id: <378BB005.8FB15C68@usa.net>


Hi =


If I run my script with Image::Magick Perl print the following message

$ perl my.pl
Can't load
'/usr/lib/perl5/site_perl/5.005/i586-linux/auto/Image/Magick/Magick.so'
for module Image::Magick:
/usr/lib/perl5/site_perl/5.005/i586-linux/auto/Image/Magick/Magick.so:
undefined symbol: XError at
/usr/lib/perl5/5.00502/i586-linux/DynaLoader.pm line 168. =


at ./my.pl line 2
BEGIN failed--compilation aborted at ./my.pl line 2.

Perl path:

/usr/lib/perl5/site_perl/5.005/i586-linux/auto/Image/Magick
/usr/lib/perl5/site_perl/5.005/i586-linux/auto/Image/Magick/Magick.bs
/usr/lib/perl5/site_perl/5.005/i586-linux/auto/Image/Magick/Magick.so
/usr/lib/perl5/site_perl/5.005/i586-linux/Image/Magick.pm

my.pl :

#!/usr/bin/perl
use Image::Magick;
use strict;

my ($image,$status);

$image =3D Image::Magick->new;

$status =3D $image->Read('images/dog*.gif');
warn "$status" if $status;
$image->Transparent('#FFFFFF');
$image->Zoom('50%');
$cube =3D Image::Magick->new;
$status =3D $cube->Read('NETSCAPE:');
warn "$status" if $status;
$image->Map($cube);
$status =3D $image->Set(loop=3D>0,dispose=3D>2);
warn "$status" if $status;

undef $image;

I don=B4t now what that is. The lib is at the right place. Wy ?

Frank


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

Date: Tue, 13 Jul 1999 02:57:14 GMT
From: inlandpac@my-deja.com
Subject: Searching a new whois database
Message-Id: <7me9u6$6jj$1@nnrp1.deja.com>

I currently have a script that accesses whois in the following manner:

push (@INC,"../perl-lib");
require 'cgi-lib.pl';
&ReadParse(*form_data);  #parse form
$whois = "whois -h rs.internic.net";  #which database to search?
$command = $form_data{'command'};  #what am I looking for?
$result = `$whois \"$command.\"`;  #perform the search with . at end

So if I enter in the address:
http://www.mydomain.com/whois/myscript.com?whis+-
h+rs.internic.net?command=pepsi

I a listing of whois for 'pepsi.'

What I would like to do is access the new (still in testing) whois
database at
http://www.nsiregistry.com/cgi-bin/whois?whois_nic=$keyword

Anyone have any ideas on how I can do this?

Chad.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 13 Jul 1999 01:37:58 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Searching a new whois database
Message-Id: <slrn7olnlb.h7.abigail@alexandra.delanet.com>

inlandpac@my-deja.com (inlandpac@my-deja.com) wrote on MMCXLII September
MCMXCIII in <URL:news:7me9u6$6jj$1@nnrp1.deja.com>:
'' 
'' What I would like to do is access the new (still in testing) whois
'' database at
'' http://www.nsiregistry.com/cgi-bin/whois?whois_nic=$keyword
'' 
'' Anyone have any ideas on how I can do this?


It's an http URL. So, use something that uses the HTTP.


Oh, you expect us to give you a complete script? I don't think so.



Abigail
-- 
package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
                                      print } sub __PACKAGE__ { &
                                      print (     __PACKAGE__)} &
                                                  __PACKAGE__
                                            (                )


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Tue, 13 Jul 1999 19:32:44 GMT
From: inlandpac@my-deja.com
Subject: Searching files
Message-Id: <7mg48s$s7u$1@nnrp1.deja.com>

I have a search pattern where I am trying to extract domains:
(<DB> being my file I am reading from)

my @domains = /\)\s+(.*)/, <DB>;
chomp @domains;

foreach (@domains) {

print qq!
     <tr>
     <td nowrap>
     <p>
     <FONT SIZE="-2" FACE="Verdana,Tahoma,Arial,Helvetica">$_
     </font>
     </td>
     <td nowrap>
     <p>
     <FONT SIZE="-2" FACE="Verdana,Tahoma,Arial,Helvetica">
     <a href="http://www.$_">$_</a>
     </font>
     </td>
     </tr>
!;

I am still getting erroneous results!  For example:

(inlandaerospace-dom) inlandaerospace.com instead of just
inlandaerospace.com

How can I extend my search pattern to remove anything that is in
parenthesis?  I do not care if there are domains in the parenthesis.  I
don't want them.

Thanks,
Chad.



Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Tue, 13 Jul 1999 17:50:16 GMT
From: inlandpac@my-deja.com
Subject: Searching flat file problems
Message-Id: <7mfu8i$pi3$1@nnrp1.deja.com>

I have a search pattern where I am trying to extract domains:
(<DB> being my file I am reading from)

my @domains = /\)\s+(.*)/, <DB>;
chomp @domains;

foreach (@domains) {

print qq!
     <tr>
     <td nowrap>
     <p>
     <FONT SIZE="-2" FACE="Verdana,Tahoma,Arial,Helvetica">$_
     </font>
     </td>
     <td nowrap>
     <p>
     <FONT SIZE="-2" FACE="Verdana,Tahoma,Arial,Helvetica">
     <a href="http://www.$_">$_</a>
     </font>
     </td>
     </tr>
!;

I am still getting erroneous results!  For example:

(inlandaerospace-dom) inlandaerospace.com instead of just
inlandaerospace.com

How can I extend my search pattern to remove anything that is in
parenthesis?  I do not care if there are domains in the parenthesis.  I
don't want them.

Thanks,
Chad.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Tue, 13 Jul 1999 13:05:54 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Searching flat file problems
Message-Id: <ilrfm7.qph.ln@magna.metronet.com>

inlandpac@my-deja.com wrote:

: my @domains = /\)\s+(.*)/, <DB>;


   Are you really wanting to test against $_ and discard a line?

   Or are you missing 4 characters [egpr] there?

   *Don't* type code. Use cut/paste. Else you will just get
   smart ass comments about your typos, and your real question
   will be ignored.

   Like in this followup.

   :-)



   [snip regex question with includes a regex, but no strings
    to match it against, resulting in insufficient info to
    consider helping.
   ]


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Tue, 13 Jul 1999 16:41:27 -0400
From: Donna Walker <donnawalk@netscape.net>
To: "Gary M. Greenberg" <garyg@gator.net>
Subject: Re: Sending Attachments with email
Message-Id: <378BA476.904F1D1F@netscape.net>

I have the same need.  Where do I subscribe to the Perl Journal?

Thank.

Donnaw
CPFS
Ewing, New Jersey

Gary M. Greenberg wrote:

> simchadov@my-deja.com wrote:
> >
> > I want to write a Perl script that allows me to build and send an email
> > message with an attachment. Are there modules that do this sort of thing
> > or has anyone seen examples of ways to do this?
> >
> Here's a perfect reason to subscribe to The Perl Journal; the newest
> article contains code to do this with explanations.
>
> > If you could cc me with an email- that would be great.
> [posted && mailed]
>
> --
> Gary



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

Date: 13 Jul 1999 17:19:28 -0400
From: Jason Reed <jcreed@cyclone.jprc.com>
Subject: Re: Sending Attachments with email
Message-Id: <a1so6sgsdb.fsf@cyclone.jprc.com>

Donna Walker <donnawalk@netscape.net> writes:

> I have the same need.  Where do I subscribe to the Perl Journal?
Check out www.tpj.com. Code samples are available whether
you're a subscriber or not, IIRC.

---Jason


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

Date: Tue, 13 Jul 1999 16:24:03 -0400
From: Donna Walker <donnawalk@netscape.net>
Subject: Re: Sending email by perl in NT
Message-Id: <378BA063.99072F95@netscape.net>

Hello group.  I'm not a perl programmer but have need of a perl script
similar to the one below.  I need to send email with body text and an
attachment (or two).  Can anyone tell me the complete script to handle my
wish?

Thanks in advance for you assistance.

Donnaw
CPFS
Ewing, New Jersey

bababozorg@aol.com wrote:

> hi
> i know how to send email by perl in unix, i simply would using these:
> $mailprog= '/usr/lib/sendmail';
>         open(MAIL,"|$mailprog -t");
>         print MAIL "To: reciver\n";
>         print MAIL "From: sender\n";
>         print MAIL "Subject: subject\n\n";
>         print MAIL "text";
>         close (MAIL);
> but i just want to know can i use the same thing in NT?
> i dont have NT to check it so i can test it! :)
> if i cant what do i have to change?
> thanks for your help
> hamed
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.



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

Date: Tue, 13 Jul 1999 04:06:36 GMT
From: dbpete@my-deja.com
Subject: Simple HTTPd filter
Message-Id: <7mee06$7vg$1@nnrp1.deja.com>

I'm writing some web apps that will go to a special backend HTTP
server.  The trick with this HTTP server, is that it requires a special
header to be set in order to do certain operations.

In a real production environment, all the pieces will be in place to
supply the HTTP server with the needed header.  During development, on
the other hand, I don't have all the needed pieces.  Fortunately, there
is a fairly simple solution...

I'd like to create a simple HTTP server that accepts client
connections, adds the "special" header (and it might change a few...
for instance "Host:"), then pass the request on to the real HTTP
server.  I guess it will also need to wait for a response and return
that to the client.

I'm sure I can write a server to do this using Socket or IO::Socket,
reading through the headers, etc... but, I'd like to try to use what's
already out there.  What I'm looking for is some suggestions and hints
on how to simplify this task.  For instance, are there any packages
already written that help with:

  - server init (e.g. socket(); bind(); listen(); accept())
  - parsing HTTP headers
  - adding and/or deleting HTTP headers
  - reading content including POST data (or any data for that matter)
  - connecting to another HTTP server and receiving the response

Hmmm, perhaps the easiest thing would be to tie the client output to
the real server input, through a simple loop that looks for the end of
the headers, then adds the special header.  Everything else it just
blindly copies.  Then, tie the real server output directly to the
client input.

Thanks for any help.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 13 Jul 1999 01:39:17 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Simple HTTPd filter
Message-Id: <slrn7olnnr.h7.abigail@alexandra.delanet.com>

dbpete@my-deja.com (dbpete@my-deja.com) wrote on MMCXLII September
MCMXCIII in <URL:news:7mee06$7vg$1@nnrp1.deja.com>:
'' 
'' I'm sure I can write a server to do this using Socket or IO::Socket,
'' reading through the headers, etc... but, I'd like to try to use what's
'' already out there.  What I'm looking for is some suggestions and hints
'' on how to simplify this task.  For instance, are there any packages
'' already written that help with:


Is there a reason you cannot go to CPAN yourself and read the modulelist?




Abigail
-- 
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")
                       -> define ("foldoc", "perl")) [0] -> print'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 13 Jul 1999 09:04:06 -0500
From: Cameron Kaiser <ckaiser@stockholm.ptloma.edu>
Subject: Re: Simple HTTPd filter
Message-Id: <JGHi3.21504$m7.701766@newscene.newscene.com>

dbpete@my-deja.com writes:

>I'd like to create a simple HTTP server that accepts client
>connections, adds the "special" header (and it might change a few...
>for instance "Host:"), then pass the request on to the real HTTP
>server.  I guess it will also need to wait for a response and return
>that to the client.
>I'm sure I can write a server to do this using Socket or IO::Socket,
>reading through the headers, etc... but, I'd like to try to use what's
>already out there.  What I'm looking for is some suggestions and hints
>on how to simplify this task.  For instance, are there any packages
>already written that help with:

>  - server init (e.g. socket(); bind(); listen(); accept())
>  - parsing HTTP headers
>  - adding and/or deleting HTTP headers
>  - reading content including POST data (or any data for that matter)
>  - connecting to another HTTP server and receiving the response

Try 

http://httpi.ptloma.edu/

Build the Demonic version, and then read through the object. No modules
are used, so you're looking at the code in its entirety. This might give
you some clues.

--
 Cameron Kaiser * ckaiser@stockholm.ptloma.edu * posting with a Commodore 128
   http://calvin.ptloma.edu/~spectre/ * "When in doubt, take a pawn." -- M:I
 -- Supporting the Commodore 64 and 128: http://www.armory.com/~spectre/cwi/ --
   head moderator comp.binaries.cbm * cbm special forces unit $ea31 [tincsf]


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

Date: Tue, 13 Jul 1999 04:24:45 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Simple HTTPd filter
Message-Id: <d4tem7.pag.ln@magna.metronet.com>

Abigail (abigail@delanet.com) wrote:
: dbpete@my-deja.com (dbpete@my-deja.com) wrote on MMCXLII September
: MCMXCIII in <URL:news:7mee06$7vg$1@nnrp1.deja.com>:
: '' 
: '' I'm sure I can write a server to do this using Socket or IO::Socket,
: '' reading through the headers, etc... but, I'd like to try to use what's
: '' already out there.  What I'm looking for is some suggestions and hints
: '' on how to simplify this task.  For instance, are there any packages
: '' already written that help with:


: Is there a reason you cannot go to CPAN yourself and read the modulelist?


   Paying particular attention to the 'libwww' bundle.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 13 Jul 1999 08:38:49 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Simple HTTPd filter
Message-Id: <m1oghg5zli.fsf@halfdome.holdit.com>

>>>>> "dbpete" == dbpete  <dbpete@my-deja.com> writes:

dbpete> I'd like to create a simple HTTP server that accepts client
dbpete> connections, adds the "special" header (and it might change a few...
dbpete> for instance "Host:"), then pass the request on to the real HTTP
dbpete> server.  I guess it will also need to wait for a response and return
dbpete> that to the client.

I wonder how hard it is to find my WebTechniques columns.  It must
be, or people wouldn't keep asking questions in these newsgroups
that are answered right out of the columns. :)

Anyway, go look at http://www.stonehenge.com/merlyn/WebTechniques/ and
look for the "proxy server" examples.  Your problem should be readily
solved by a slight modification of either of them (the forking or
preforking versions).

print "Just another Perl and Web hacker,"

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: 12 Jul 1999 19:37:20 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: simple Perl question:
Message-Id: <slrn7ol2de.h7.abigail@alexandra.delanet.com>

elephant (e-lephant@b-igpond.com) wrote on MMCXLI September MCMXCIII in
<URL:news:MPG.11f444183ab1a54b989b2d@news-server>:
@@ Abigail writes ..
@@ >Instead of giving a side answer, can you make a function that takes the
@@ >arguments in the same way as print?
@@ 
@@ in your own style - RTFM (in fact print is even given as an example)
@@ 
@@   Advanced Perl Programming p109 .. The indirect notation


Well, yes, but if we make:


sub IO::Handle::println {
    shift; print @_, "\n";
}


then 'println 1, 2, 3, 4;' isn't going to work; and it sure it's
going fail if some module you're using also decided to define an
IO::Handle::println method.



Abigail
-- 
sub f{sprintf$_[0],$_[1],$_[2]}print f('%c%s',74,f('%c%s',117,f('%c%s',115,f(
'%c%s',116,f('%c%s',32,f('%c%s',97,f('%c%s',0x6e,f('%c%s',111,f('%c%s',116,f(
'%c%s',104,f('%c%s',0x65,f('%c%s',114,f('%c%s',32,f('%c%s',80,f('%c%s',101,f(
'%c%s',114,f('%c%s',0x6c,f('%c%s',32,f('%c%s',0x48,f('%c%s',97,f('%c%s',99,f(
'%c%s',107,f('%c%s',101,f('%c%s',114,f('%c%s',10,)))))))))))))))))))))))))


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

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

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 V9 Issue 131
*************************************


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