[19695] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1890 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 8 11:05:30 2001

Date: Mon, 8 Oct 2001 08:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1002553506-v10-i1890@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 8 Oct 2001     Volume: 10 Number: 1890

Today's topics:
    Re: Am I asking too much ??? <jurgenex@hotmail.com>
    Re: Any help with this program? (Anno Siegel)
        Call perl script in html page <harm.bouwman@mediasys.nl>
    Re: Can't get $? to work... (Anno Siegel)
        Full-Time Perl programmer <dgreen@lowebroadway.com>
    Re: How to run perl under bash not sh <andrew@erlenstar.demon.co.uk>
    Re: How to run perl under bash not sh <invalid@nowhere.com>
    Re: Multiplexing strings <dtweed@acm.org>
        Net::FTP and get() method <nobody@nowhere.com>
    Re: Net::FTP and get() method <Thomas@Baetzler.de>
    Re: Net::FTP and get() method <Peter.Dintelmann@dresdner-bank.com>
        New posters to comp.lang.perl.misc <gbacon@cs.uah.edu>
        newbie question on passing global variable <pmishra@mailcity.com>
        newbie sendmail question <jessica.bull@broadwing.com>
    Re: newbie sendmail question (Mark Taylor)
        perl interaction with (Postgres) databases (obakesan)
    Re: Q: How to use LWP behind a Microsoft ISA-server fir <eramaqu@set132.gsm.ericsson.se>
        Statistics for comp.lang.perl.misc <gbacon@cs.uah.edu>
    Re: warnings and $a, $b <djberge@qwest.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 8 Oct 2001 06:09:43 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Am I asking too much ???
Message-Id: <3bc1a596@news.microsoft.com>

"Tana" <tana@acedsl.com> wrote in message
news:4294f74d.0110070827.d0102c0@posting.google.com...
> Yes, you all have a point there.
> But I am not trying to get "free code" or something like that.

Actually you do.

> I am not a perl programmer, nor php programmer.
> I am just trying to use PayPal Instant notification PERL script.
> The PERL script provided by PayPal does not work for me, that's all.

Then why don't you ask PayPal to fix the problem? It seems it's their fault.

jue




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

Date: 8 Oct 2001 13:31:41 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Any help with this program?
Message-Id: <9ps9rt$pqu$2@mamenchi.zrz.TU-Berlin.DE>

According to Jon Fanti <jonathan@unique.com>:
> Hi,
> 
> Sorry, it would help if the clock on this PC was correct (D'oh!).
> 
> I'm still a Perl newbie(ish) and am trying to write a script that runs
> through a dir and emails me with a list of any files that look like *.xml,
> *.xml.lock (upper and lowercase). As well as print this on screen. The major
> problems I have are:
> 
> a. I can't work out how to get this to search sub directories.

Use File::Find.  It does the recursion through directories for you.

> b. how to email me all found files in one email. At the moment it sends a
> separate email for each file found.

Don't just print the file names as you find them, collect them in a
list too.  This would happen in your "wanted routine" (see perldoc
File::Find).  Then, after the run of find, inspect the list and mail
it if it isn't empty.

Anno


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

Date: Mon, 8 Oct 2001 16:14:52 +0200
From: <harm.bouwman@mediasys.nl>
Subject: Call perl script in html page
Message-Id: <9psccs$j4i$1@news1.xs4all.nl>

Hi,

I'am pretty new to writing perl scripts and have have the following problem.
I have written an perl script which I what to call from an HTML page. I have
create an HTML page like example below, but it does not work. The perl
script itself works fine.

Can anybody tell me what is wrong here!

Thanks, Harm
harm.bouwman@mediasys.nl

------ Example ------
<!-- Main //-->
<html>
<head>
<title>Main</title>
<!link rel="Stylesheet" href="./intranet.css" type="text/css">
</head>
<script language="PerlScript"
src="http://mysite.com/cgi-bin/main.pl"></script>

</BODY>
</HTML>
------- End Example ------






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

Date: 8 Oct 2001 13:25:19 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Can't get $? to work...
Message-Id: <9ps9fv$pqu$1@mamenchi.zrz.TU-Berlin.DE>

According to  <nobull@mail.com>:
> peter@servplex.com (Peter Elsner) writes:
> 
> 
> > `echo \"cd data\nascii\nput $FILENAME\nquit\n\" | ftp -i $SERVER`;
> > 
> > $ERR=$?;
> 
> ISTR that the exit value of a pipeline may be the exit value of the
> _first_ command (i.e. echo in this case) in some shells.

That would lead up to a solution like (untested):

    open my $ftp, "| ftp -i $SERVER" or die "Can't fork ftp process";
    print $ftp "cd data\n";
    print $ftp "ascii\n";
    print $ftp "put $FILENAME\n";
    print $ftp "quit\n";
    close $ftp;
    $err = $?; # etc

That way we don't need a shell pipeline and "echo" to provide ftp's
input, and $? can only depend on the status of ftp.

Or, of course, use Net::FTP.

Anno


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

Date: Mon, 08 Oct 2001 15:46:44 +0000
From: dell <dgreen@lowebroadway.com>
Subject: Full-Time Perl programmer
Message-Id: <B7E77AE3.2679%dgreen@lowebroadway.com>

Full-Time Perl programmer wanted with a flare for writing CGI's.
----------------------------------------------------------------

To work for a large Advertising and Marketing Group in the Integrated
Software Solutions 
Department working with clients on programming solutions to produce/speed
delivery of marketing/workflow
materials for themselves or their clients.

You will need to be comfortable in a Unix environment? (Linux, BSD, etc) and
know Perl with some experience/knowledge of writing CGI's.

This opportunity provides a platform for the right candidate  to prove their
programming skills 
on real world problems whilst helping to propose new ideas and develop the
business.

You will be part of a team of 7 who's aim is to solve customer every day
problems with well planned, well
thought out solutions.

We have many clients at the moment involving a lot of the largest Investment
houses in the world as well as government work
with more work on the books backed up until the middle of next year.

This is an ideal opportunity to put those skills learnt through those late
nights studying thick, cryptic text books
and writing shell/perl scripts that delete your operating system because you
forgot you were logged in as ROOT!

The departmental aim is that every member of the team develops into an
expert in their specialised area, but has
every opportunity to learn others languages.

Salary: 19k-25k depending upon experience.

Please apply via email or post to :
Dell Green
Director
Integrated Software Solutions
Lowe Broadway
Lowe Group
10-11 Percy Street
London
W1T 1DA
dgreen@lowebroadway.com

----------------------------------------------------------------------------
-----------------------------
This is a full time position based in Percy Street, London, UK. so no
part-time or contractors please.
----------------------------------------------------------------------------
-----------------------------



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

Date: 08 Oct 2001 14:10:45 +0100
From: Andrew Gierth <andrew@erlenstar.demon.co.uk>
Subject: Re: How to run perl under bash not sh
Message-Id: <871ykenup6.fsf@erlenstar.demon.co.uk>

>>>>> "Larry" == Larry Alkoff <invalid@nowhere.com> writes:

 Larry> I have a small perl script that "paginates" output from any
 Larry> program that would scroll output off the screen.  It's called
 Larry> "so" for "scrolled output"/.

 Larry> However, many of my programs are aliased and my perl script
 Larry> complains.  For example dir is aliased and the command "so
 Larry> dir" gives the error message "sh: dir: command not found.

The best way to fix that problem isn't actually anything to do with
perl at all; tell the shell to expand the aliases before actually
invoking the perl program.  To do that (with any POSIX-style shell,
not just bash), define an alias for your script that ends with a space
character.  e.g.  alias so='so '

Then if you have, say, alias dir='ls -l', then when you invoke 'so
dir' the shell will expand that to 'so ls -l' before running the
script.  (This is the only way that works with aliases defined
on-the-fly, because aliases are not inherited.)

-- 
Andrew.


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

Date: Mon, 08 Oct 2001 14:47:42 GMT
From: Larry Alkoff <invalid@nowhere.com>
Subject: Re: How to run perl under bash not sh
Message-Id: <hjd3stkj7hlv7lku5jas7lgj048o7h98r7@4ax.com>

Andrew Gierth <andrew@erlenstar.demon.co.uk> wrote:

> >>>>> "Larry" == Larry Alkoff <invalid@nowhere.com> writes:
> 
>  Larry> I have a small perl script that "paginates" output from any
>  Larry> program that would scroll output off the screen.  It's called
>  Larry> "so" for "scrolled output"/.
> 
>  Larry> However, many of my programs are aliased and my perl script
>  Larry> complains.  For example dir is aliased and the command "so
>  Larry> dir" gives the error message "sh: dir: command not found.
> 
> The best way to fix that problem isn't actually anything to do with
> perl at all; tell the shell to expand the aliases before actually
> invoking the perl program.  To do that (with any POSIX-style shell,
> not just bash), define an alias for your script that ends with a space
> character.  e.g.  alias so='so '
> 
> Then if you have, say, alias dir='ls -l', then when you invoke 'so
> dir' the shell will expand that to 'so ls -l' before running the
> script.  (This is the only way that works with aliases defined
> on-the-fly, because aliases are not inherited.)


My question is actually very much on topic in this newsgroup
and has nothing to do with bash.

It has to do with how is perl called and what shell(s) it uses internally.

It's obvious that when perl runs on my system (Slack 8.0) it is
_somehow_ using the sh shell since    the error messages start with sh:.

My question then is where in perl or it's startup script or whereever
is perl invoking the sh shell when I start it under the bash shell.

Using strings on /usr/bin/perl I found the following interesting strings:

PL_sh_path
/bin/sh		found twice
/bin/csh	found twice
BASH_ENV	looks like an environment variable

I tried export BASH_ENV=/bin/bash but that didn't help perl find anything.

Thanks for your interest and
hope you can help,

Larry Alkoff




-- 
Larry Alkoff N2LA
My address is:  larryalk is_at mindspring dot com


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

Date: Mon, 08 Oct 2001 13:19:22 GMT
From: Dave Tweed <dtweed@acm.org>
Subject: Re: Multiplexing strings
Message-Id: <3BC1A686.D47A60A9@acm.org>

Jean-Philippe Fauvelle wrote:
> @W   = @WORDS           = qw/aabbccddeeff AABBCCDDEEFF 001122334455/;
> $W   = $WORDS           = @WORDS;
> $TL  = $TOKEN_LENGTH    = 2;
> $WL  = $WORD_LENGTH     = length($WORDS[0]);
> $TPW = $TOKENS_PER_WORD = $WORD_LENGTH / $TOKEN_LENGTH;
> 
> $regexp = sprintf "(.{$TL})(?=%s)", sprintf( ".{%d}(.{$TL})", $WL-$TL ) x ($W-1);
> $result = join '', join('',@W) =~ /$regexp/go;

It's pretty elegant, but very slow. It's a little faster than your "one-liner"
on short strings, but takes about twice as long on long strings.

-- Dave Tweed


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

Date: Mon, 8 Oct 2001 23:55:51 +1000
From: "Gregory Toomey" <nobody@nowhere.com>
Subject: Net::FTP and get() method
Message-Id: <ydiw7.2921$e5.5864@newsfeeds.bigpond.com>

Hi Perl Gurus.

I've just got Net::FTP working fine and have a question about retrieving
files. get() always writes the file to disk and returns the name of the file
retrieved.

I want something like get() from LWP::Simple that just returns the data and
does not write to disk, but does it for ftp. Is there a way to do this?

gtoomey




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

Date: Mon, 08 Oct 2001 16:39:16 +0200
From: =?ISO-8859-1?Q?Thomas_B=E4tzler?= <Thomas@Baetzler.de>
Subject: Re: Net::FTP and get() method
Message-Id: <jie3stsvara1ara00qpi9tfgdsm7bstiid@4ax.com>

On Mon, 8 Oct 2001, "Gregory Toomey" <nobody@nowhere.com> wrote:

>I want something like get() from LWP::Simple that just returns the data and
>does not write to disk, but does it for ftp. Is there a way to do this?

OTTOH: Try writing to an IO::Scalar filehandle. Somebody is surely going
to hate me for suggesting this :-)

Cheers,
-- 
use strict;my($i,$t,@r)=(0,'5 -.@BHJPT4acd6e2hk2lmn2o4r2s3tuz',map{ord}
split//,unpack('u*','L#`T&)QD5#0`#!!`#%1D)#08`#P05!!(3``$$"``#"0L&``('.
'"`P<!`````0$`'));$t=~s/(\d)(.)/$2x$1/eg;map{$t.=substr$t,$i,1,''while
$_--;$i++}@r;print"$t\n";# Thomas@Baetzler.de - http://baetzler.de/perl


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

Date: Mon, 8 Oct 2001 16:25:20 +0200
From: "Dr. Peter Dintelmann" <Peter.Dintelmann@dresdner-bank.com>
Subject: Re: Net::FTP and get() method
Message-Id: <9pscc8$k7p1@news-1.bank.dresdner.net>

    Hi,

"Gregory Toomey" <nobody@nowhere.com> wrote in message
news:ydiw7.2921$e5.5864@newsfeeds.bigpond.com...


> I've just got Net::FTP working fine and have a question about retrieving
> files. get() always writes the file to disk and returns the name of the
file
> retrieved.
>
> I want something like get() from LWP::Simple that just returns the data
and
> does not write to disk, but does it for ftp. Is there a way to do this?

    From the Net::FTP docu...
    get ( REMOTE_FILE [, LOCAL_FILE [, WHERE]] )
    Get REMOTE_FILE from the server and store locally. LOCAL_FILE may be
    a filename or a filehandle.

    Thus specify a handle and access the data this way.

    Alternatively use LWP::Simple instead of Net::FTP. It works with ftp
URIs
    as well.

    Regards,

        Peter Dintelmann






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

Date: Mon, 08 Oct 2001 14:12:50 -0000
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: New posters to comp.lang.perl.misc
Message-Id: <ts3d32mo3i1jb3@corp.supernews.com>

Following is a summary of articles from new posters spanning a 7 day
period, beginning at 01 Oct 2001 15:00:20 GMT and ending at
08 Oct 2001 17:33:47 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" email address and name.
    - Original Content Rating (OCR) is the ratio of the original content
      volume to the total body volume.
    - Find the News-Scan distribution on the CPAN!
      <URL:http://www.perl.com/CPAN/modules/by-module/News/>
    - Please send all comments to Greg Bacon <gbacon@cs.uah.edu>.
    - Copyright (c) 2001 Greg Bacon.
      Verbatim copying and redistribution is permitted without royalty;
      alteration is not permitted.  Redistribution and/or use for any
      commercial purpose is prohibited.

Totals
======

Posters:  105 (35.6% of all posters)
Articles: 165 (17.7% of all articles)
Volume generated: 289.3 kb (16.6% of total volume)
    - headers:    128.9 kb (2,640 lines)
    - bodies:     155.7 kb (5,200 lines)
    - original:   114.2 kb (4,058 lines)
    - signatures: 4.5 kb (95 lines)

Original Content Rating: 0.734

Averages
========

Posts per poster: 1.6
    median: 1 post
    mode:   1 post - 73 posters
    s:      1.5 posts
Message size: 1795.2 bytes
    - header:     800.1 bytes (16.0 lines)
    - body:       966.2 bytes (31.5 lines)
    - original:   708.8 bytes (24.6 lines)
    - signature:  27.9 bytes (0.6 lines)

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

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

    8    17.4 (  7.4/  8.0/  5.6)  Ilmari Karonen <usenet11598@itz.pp.sci.fi>
    7    10.7 (  4.7/  6.0/  2.4)  Tana <tana@acedsl.com>
    6     9.7 (  4.9/  4.7/  3.1)  Vladimir Volovich <vvv@vsu.ru>
    5     8.4 (  4.1/  4.3/  3.2)  "Markus Dehmann" <markus.cl@gmx.de>
    4    11.8 (  2.8/  9.0/  6.1)  Doug <shadowmint@mailcity.com>
    3     5.6 (  3.3/  2.4/  2.4)  "Jessica Bull" <jessica.bull@broadwing.com>
    3     6.7 (  2.0/  4.6/  2.8)  mgilfix@eecs.tufts.edu
    3     6.7 (  2.5/  3.3/  2.1)  Ilmari Karonen <usenet11596@itz.pp.sci.fi>
    3     6.0 (  3.1/  2.9/  2.1)  "Andrew U" <ReplyVia_contact.asp@URLinSig>
    3     4.4 (  2.4/  2.1/  1.5)  slidge@slidge.com

These posters accounted for 4.8% of all articles.

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

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

  17.4 (  7.4/  8.0/  5.6)      8  Ilmari Karonen <usenet11598@itz.pp.sci.fi>
  11.8 (  2.8/  9.0/  6.1)      4  Doug <shadowmint@mailcity.com>
  10.7 (  4.7/  6.0/  2.4)      7  Tana <tana@acedsl.com>
   9.7 (  4.9/  4.7/  3.1)      6  Vladimir Volovich <vvv@vsu.ru>
   8.4 (  4.1/  4.3/  3.2)      5  "Markus Dehmann" <markus.cl@gmx.de>
   7.4 (  2.4/  5.0/  1.5)      3  Dan Boyce <dboyce@phoenixcolor.com>
   6.7 (  2.0/  4.6/  2.8)      3  mgilfix@eecs.tufts.edu
   6.7 (  2.5/  3.3/  2.1)      3  Ilmari Karonen <usenet11596@itz.pp.sci.fi>
   6.0 (  3.1/  2.9/  2.1)      3  "Andrew U" <ReplyVia_contact.asp@URLinSig>
   5.9 (  2.6/  3.3/  1.3)      3  "linkster" <adwr96@dial.pipex.com>

These posters accounted for 5.2% of the total volume.

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

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

0.996  (  2.4 /  2.4)      3  "Jessica Bull" <jessica.bull@broadwing.com>
0.742  (  3.2 /  4.3)      5  "Markus Dehmann" <markus.cl@gmx.de>
0.738  (  1.5 /  2.1)      3  slidge@slidge.com
0.724  (  2.1 /  2.9)      3  "Andrew U" <ReplyVia_contact.asp@URLinSig>
0.694  (  5.6 /  8.0)      8  Ilmari Karonen <usenet11598@itz.pp.sci.fi>
0.676  (  6.1 /  9.0)      4  Doug <shadowmint@mailcity.com>
0.652  (  3.1 /  4.7)      6  Vladimir Volovich <vvv@vsu.ru>
0.626  (  2.1 /  3.3)      3  Ilmari Karonen <usenet11596@itz.pp.sci.fi>
0.612  (  2.8 /  4.6)      3  mgilfix@eecs.tufts.edu
0.410  (  2.4 /  6.0)      7  Tana <tana@acedsl.com>

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

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

0.724  (  2.1 /  2.9)      3  "Andrew U" <ReplyVia_contact.asp@URLinSig>
0.694  (  5.6 /  8.0)      8  Ilmari Karonen <usenet11598@itz.pp.sci.fi>
0.676  (  6.1 /  9.0)      4  Doug <shadowmint@mailcity.com>
0.652  (  3.1 /  4.7)      6  Vladimir Volovich <vvv@vsu.ru>
0.626  (  2.1 /  3.3)      3  Ilmari Karonen <usenet11596@itz.pp.sci.fi>
0.612  (  2.8 /  4.6)      3  mgilfix@eecs.tufts.edu
0.410  (  2.4 /  6.0)      7  Tana <tana@acedsl.com>
0.395  (  1.2 /  3.1)      3  Jay <jay@utils.net.nospam>
0.383  (  1.3 /  3.3)      3  "linkster" <adwr96@dial.pipex.com>
0.305  (  1.5 /  5.0)      3  Dan Boyce <dboyce@phoenixcolor.com>

13 posters (12%) had at least three posts.

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

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

      26  comp.lang.perl.modules
      13  alt.perl
       5  comp.lang.perl
       3  comp.security.unix
       2  comp.sys.mac.system
       2  comp.sys.mac.programmer.misc
       2  comp.unix.programmer
       2  comp.unix.questions
       1  comp.unix.aix
       1  comp.os.ms-windows.networking.misc

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

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

       8  "Markus Dehmann" <markus.cl@gmx.de>
       3  Ann Tsai <mktgadm@usenix.org>
       2  "Evil Overlord" <webmaster@thedarkcitadel.com>
       2  BSD Bob the old greybeard BSD freak <bobkeys@weedcon1.cropsci.ncsu.edu>
       2  ZnU <znu@znu.dhs.org>
       1  Ilmari Karonen <usenet11598@itz.pp.sci.fi>
       1  Destiny's Lost Child <destinyslostchild@theironpig.com>
       1  "Michael Greenberg" <mberloga@sympatico.ca>
       0  Anatoly Karp <karp@math.wisc.edu>
       0  perl-student <keerthidharam@iis.com>


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

Date: Mon, 08 Oct 2001 19:39:58 +0530
From: Prakash Mishra <pmishra@mailcity.com>
Subject: newbie question on passing global variable
Message-Id: <3BC1B3B6.BA5FC177@mailcity.com>

Can I pass a global variable across different namespaces ?


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

Date: Mon, 08 Oct 2001 14:21:34 GMT
From: "Jessica Bull" <jessica.bull@broadwing.com>
Subject: newbie sendmail question
Message-Id: <ODiw7.655665$NK1.59898945@bin3.nnrp.aus1.giganews.com>

I am on Win NT 4.0.  I have this script that will send mail for me.  I got
it from another script that was writ by someone that is here no longer.  I
know there is an easier way to do this, but I don't know what it is.  I
looked at the FAQ's and found this module: Mail::Sendmail
I don't know how or where to install this at. If someone could point me in
the right direction, I would appreciate it.  Thanks.


It dies at :
if (!connect(S, pack('Sna4x8', AF_INET, $port, $smptaddr))) { return -3; }

Here is the code that it is inside.  The box that it is running on is Win NT
4.0

sub Sendmail
{
    use Socket;
    my ($from, $reply, $to, $smtp, $subject, $body) = @_;
    my ($fromaddr)  = $from;
    my ($replyaddr) = $reply;

    $to        =~ s/[ \t]+/, /g;        # pack spaces and add comma
    $fromaddr  =~ s/.*<([^\s]*?)>/$1/;  # get from email address
    $replyaddr =~ s/.*<([^\s]*?)>/$1/;  # get reply email address
    $replyaddr =~ s/^([^\s]+).*/$1/;    # use first address
    if (!$to) { return -8; }
    my($proto) = (getprotobyname('tcp'))[2];
    my($port)  = (getservbyname('smtp', 'tcp'))[2];
    my($smptaddr) = ($smtp =~/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/)
      ? pack('C4',$1,$2,$3,$4)
      : (gethostbyname($smtp))[4];

    if (!defined($smptaddr)) { return -1; }
    if (!socket(S, AF_INET, SOCK_STREAM, $proto)){ return -2; }
    if (!connect(S, pack('Sna4x8', AF_INET, $port, $smptaddr)))
{ return -3; }
    my($oldfh) = select(S); $| = 1; select($oldfh);
    $_ = <S>; if (/^[45]/) { close S; return -4; }
    print S "helo localhost\r\n";
    $_ = <S>; if (/^[45]/) { close S; return -5; }
    print S "mail from: <$fromaddr>\r\n";
    $_ = <S>; if (/^[45]/) { close S; return -5; }
    foreach (split(/, /, $to)) {
 print S "rcpt to: <$_>\r\n";
 $_ = <S>; if (/^[45]/) { close S; return -6; }
    }
    print S "data\r\n";
    $_ = <S>; if (/^[45]/) { close S; return -5; }
    print S "To: $to\r\n";
    print S "From: $from\r\n";
    print S "Reply-to: $replyaddr\r\n" if $replyaddr;
    print S "X-Mailer:NDM Transfer Script \r\n";
    print S "Subject: $subject\r\n\r\n";
    print S "$body";
    print S "\r\n.\r\n";
    $_ = <S>; if (/^[45]/) { close S; return -7; }
    print S "quit\r\n";
    $_ = <S>;
    close S;
    return 1;
}





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

Date: 8 Oct 2001 09:42:18 -0500
From: mtaylor@lrim.com (Mark Taylor)
Subject: Re: newbie sendmail question
Message-Id: <Xns913464F996DCCmtaylorlrimcom@128.242.171.114>

"Jessica Bull" <jessica.bull@broadwing.com> wrote in
<ODiw7.655665$NK1.59898945@bin3.nnrp.aus1.giganews.com>: 

>I am on Win NT 4.0.  I have this script that will send mail for me.  I
>got it from another script that was writ by someone that is here no
>longer.  I know there is an easier way to do this, but I don't know what
>it is.  I looked at the FAQ's and found this module: Mail::Sendmail
>I don't know how or where to install this at. If someone could point me
>in the right direction, I would appreciate it.  Thanks.
>
>
>It dies at :
>if (!connect(S, pack('Sna4x8', AF_INET, $port, $smptaddr))) { return -3;
>} 
>
>Here is the code that it is inside.  The box that it is running on is
>Win NT 4.0
>
>sub Sendmail
>{
>    use Socket;
>    my ($from, $reply, $to, $smtp, $subject, $body) = @_;
>    my ($fromaddr)  = $from;
>    my ($replyaddr) = $reply;
>
>    $to        =~ s/[ \t]+/, /g;        # pack spaces and add comma
>    $fromaddr  =~ s/.*<([^\s]*?)>/$1/;  # get from email address
>    $replyaddr =~ s/.*<([^\s]*?)>/$1/;  # get reply email address
>    $replyaddr =~ s/^([^\s]+).*/$1/;    # use first address
>    if (!$to) { return -8; }
>    my($proto) = (getprotobyname('tcp'))[2];
>    my($port)  = (getservbyname('smtp', 'tcp'))[2];
>    my($smptaddr) = ($smtp
>    =~/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/) 
>      ? pack('C4',$1,$2,$3,$4)
>      : (gethostbyname($smtp))[4];
>
>    if (!defined($smptaddr)) { return -1; }
>    if (!socket(S, AF_INET, SOCK_STREAM, $proto)){ return -2; }
>    if (!connect(S, pack('Sna4x8', AF_INET, $port, $smptaddr)))
>{ return -3; }

<snip>


I can't see where the script get the smtp address but I suspect it may be 
on a machine in your own network. Possibly on the same machine. Have you 
checked to see if your SMTP server is running? Add some code (or have a 
look in other parts of the script to determine what the SMTP address really 
is and be sure the SMTP server is running on that machine.

Just a thought...

Mark

______________________________________________________________________________
Posted Via Binaries.net = SPEED+RETENTION+COMPLETION = http://www.binaries.net


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

Date: Mon, 08 Oct 2001 13:47:27 GMT
From: cjundieseastwd@powerup.com.au (obakesan)
Subject: perl interaction with (Postgres) databases
Message-Id: <P7iw7.280$T4.5506@nnrp.gol.com>

Hi

being reasonably new to perl 5 and having only done basic things with perl 
before and coming from a Pro*C back ground I have some questions on perl 
access of databases.

I was doing some inserts into a database (Postgres) and had some errors 
that seemed to be pars errors based on empty quoted strings. The system 
design that we are (read imposed by my client) using pre defines the 
columns that are included in the insert string, and then uses an 
associative (hash) array to contain the values of those strings. If there 
are more than a few that are empty I get an insert statement that has lots 
of '','','', in it. This seemed to cause Postgres to barf, so I ended up 
solving the problem with a quick and dirty regular expression to replace 
these with NULL, NULL, NULL in the final output that was sent to the 
database.

is this the best way?? are there things like "host variables" that we have 
in Oracle Pro*C that I have missed in the reading that I've done to come up 
to speed??


is there a better way to be doing this than passing a string for the sql 
engine to parse??

thanks folks



See Ya

--
(when bandwidth gets better ;-)

Chris Eastwood
Photographer, Programmer Motorcyclist and dingbat

please remove   u n d i e s   for reply


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

Date: Mon, 08 Oct 2001 15:37:50 +0200
From: Martin Quensel <eramaqu@set132.gsm.ericsson.se>
Subject: Re: Q: How to use LWP behind a Microsoft ISA-server firewall
Message-Id: <3BC1AC2E.BD81B2C9@set132.gsm.ericsson.se>

Peter Terpstra wrote:
> 
> Hi,
> I'm trying to use the LWP modules to download urls from my perl programs.
> Our company uses the Microsoft ISA server as a firewall.
> This firewall denies our http:get requests. (we also do not succeed in
> downloading with the TelePort-Pro sitemapper tool)
> Does someone know how to configure the ISA server to permit this?
> 
> Peter

This was the simplest perl question i ever had.
There is an error on line 13 in your code. It should be "print", and not
"pirnt".

But to get a soloution to your problem you might ask the right persons.
As far as i know, Perl and Microsoft firewalls have very little in
common.

For questions about how to configure firewalls, you migt try some
newsgroup that deals with firewall configuration.

Best Regards
Martin Quensel

When i dive with my new kodak camera, i have a problem.
At 30 meters there are some fantastic fishes that i love to take
pictures of, but they get scared from the bubbles comming from my
aqualung regulator that i breathe in, and swim away when i try to take a
picture.
I have asked Kodak what to do to fix this problem, but so far no
response. Anyone out there having the same problems with kodak cameras?


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

Date: Mon, 08 Oct 2001 14:12:48 -0000
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: Statistics for comp.lang.perl.misc
Message-Id: <ts3d30pgvajlb0@corp.supernews.com>

Following is a summary of articles spanning a 7 day period,
beginning at 01 Oct 2001 15:00:20 GMT and ending at
08 Oct 2001 17:33:47 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" email address and name.
    - Original Content Rating (OCR) is the ratio of the original content
      volume to the total body volume.
    - Find the News-Scan distribution on the CPAN!
      <URL:http://www.perl.com/CPAN/modules/by-module/News/>
    - Please send all comments to Greg Bacon <gbacon@cs.uah.edu>.
    - Copyright (c) 2001 Greg Bacon.
      Verbatim copying and redistribution is permitted without royalty;
      alteration is not permitted.  Redistribution and/or use for any
      commercial purpose is prohibited.

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

perlfaq-suggestions\@(?:.*\.)?perl\.com
faq\@(?:.*\.)?denver\.pm\.org

Totals
======

Posters:  295
Articles: 930 (432 with cutlined signatures)
Threads:  240
Volume generated: 1746.6 kb
    - headers:    754.7 kb (15,000 lines)
    - bodies:     930.9 kb (31,658 lines)
    - original:   586.5 kb (21,916 lines)
    - signatures: 60.1 kb (1,304 lines)

Original Content Rating: 0.630

Averages
========

Posts per poster: 3.2
    median: 1 post
    mode:   1 post - 159 posters
    s:      5.4 posts
Posts per thread: 3.9
    median: 3.0 posts
    mode:   1 post - 56 threads
    s:      3.5 posts
Message size: 1923.1 bytes
    - header:     831.0 bytes (16.1 lines)
    - body:       1025.0 bytes (34.0 lines)
    - original:   645.8 bytes (23.6 lines)
    - signature:  66.2 bytes (1.4 lines)

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

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

   56   134.2 ( 45.1/ 85.7/ 46.5)  Benjamin Goldberg <goldbb2@earthlink.net>
   33    55.7 ( 29.4/ 26.0/ 15.1)  Bart Lateur <bart.lateur@skynet.be>
   32    63.4 ( 28.4/ 26.0/ 15.9)  =?ISO-8859-1?Q?Thomas_B=E4tzler?= <Thomas@Baetzler.de>
   27    42.7 ( 20.8/ 19.9/ 11.6)  nobull@mail.com
   18    28.8 ( 13.3/ 15.4/  6.1)  Anno Siegel <anno4000@lublin.zrz.tu-berlin.de>
   18    35.5 ( 19.6/ 15.9/ 11.4)  Dave Tweed <dtweed@acm.org>
   17    29.8 ( 12.4/ 17.4/ 10.6)  "S Warhurst" <s.warhurst@rl.ac.uk>
   17    36.5 ( 14.1/ 21.6/  7.1)  Michael Budash <mbudash@sonic.net>
   17    35.8 ( 16.5/ 16.0/  9.1)  Joe Schaefer <joe+usenet@sunstarsys.com>
   16    34.8 ( 14.0/ 17.7/ 10.2)  mgjv@tradingpost.com.au

These posters accounted for 27.0% of all articles.

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

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

 134.2 ( 45.1/ 85.7/ 46.5)     56  Benjamin Goldberg <goldbb2@earthlink.net>
  63.4 ( 28.4/ 26.0/ 15.9)     32  =?ISO-8859-1?Q?Thomas_B=E4tzler?= <Thomas@Baetzler.de>
  55.7 ( 29.4/ 26.0/ 15.1)     33  Bart Lateur <bart.lateur@skynet.be>
  42.7 ( 20.8/ 19.9/ 11.6)     27  nobull@mail.com
  41.2 ( 14.6/ 21.8/ 17.1)     16  Mark Jason Dominus <mjd@plover.com>
  36.7 ( 14.2/ 22.5/ 12.0)     16  Jean-Philippe Fauvelle <JPFauvelle@Colt-Telecom.fr>
  36.5 ( 14.1/ 21.6/  7.1)     17  Michael Budash <mbudash@sonic.net>
  35.8 ( 16.5/ 16.0/  9.1)     17  Joe Schaefer <joe+usenet@sunstarsys.com>
  35.5 ( 19.6/ 15.9/ 11.4)     18  Dave Tweed <dtweed@acm.org>
  34.8 ( 14.0/ 17.7/ 10.2)     16  mgjv@tradingpost.com.au

These posters accounted for 29.6% of the total volume.

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

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

1.000  (  4.7 /  4.7)      8  Rafael Garcia-Suarez <rgarciasuarez@free.fr>
0.977  ( 18.3 / 18.7)     13  abigail@foad.org
0.852  (  5.3 /  6.2)      6  Miko O'Sullivan <miko@idocs.com>
0.820  (  5.0 /  6.1)      8  "Mr. Sunblade" <djberge@qwest.com>
0.786  ( 17.1 / 21.8)     16  Mark Jason Dominus <mjd@plover.com>
0.773  (  4.1 /  5.3)      5  David Coppit <newspost@coppit.org>
0.742  (  3.2 /  4.3)      5  "Markus Dehmann" <markus.cl@gmx.de>
0.718  ( 11.4 / 15.9)     18  Dave Tweed <dtweed@acm.org>
0.695  (  8.0 / 11.6)      8  Logan Shaw <logan@cs.utexas.edu>
0.694  (  5.6 /  8.0)      8  Ilmari Karonen <usenet11598@itz.pp.sci.fi>

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

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

0.410  (  2.4 /  6.0)      7  Tana <tana@acedsl.com>
0.393  (  6.1 / 15.4)     18  Anno Siegel <anno4000@lublin.zrz.tu-berlin.de>
0.392  (  3.8 /  9.8)     11  Randal L. Schwartz <merlyn@stonehenge.com>
0.380  (  2.1 /  5.5)      8  John J. Trammell <trammell@haqq.hypersloth.invalid>
0.353  (  2.5 /  7.0)     10  Ilya Martynov <ilya@martynov.org>
0.330  (  1.4 /  4.3)      7  "Tintin" <tintin@snowy.calculus>
0.330  (  7.1 / 21.6)     17  Michael Budash <mbudash@sonic.net>
0.306  (  1.6 /  5.1)      5  Steven Kuo <skuo@mtwhitney.nsc.com>
0.273  (  1.8 /  6.7)      7  Glenn <glenn@surveystar.com>
0.113  (  0.9 /  8.4)      5  Venkatesh Babu Sira <vsira@hotmail.com>

45 posters (15%) had at least five posts.

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

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

   28  Multiplexing strings
   19  Efficient code?
   18  Yet another fork question
   17  filehandles between functions
   15  Can't unlink file under Perl for NT
   14  Is Perl for CGI going the way of the dodo?
   13  Skipping following lines if the same
   13  Perl 5.6.0 chmod bug?
   10  time transformation
   10  RegExp /g shall substitute more often

These threads accounted for 16.9% of all articles.

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

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

  53.3 ( 26.5/ 24.9/ 15.1)     28  Multiplexing strings
  44.6 ( 14.5/ 29.0/ 17.5)     19  Efficient code?
  41.5 ( 10.3/ 29.9/ 23.8)     13  Perl 5.6.0 chmod bug?
  40.3 ( 15.2/ 23.8/ 12.6)     18  Yet another fork question
  37.1 ( 15.3/ 18.3/ 11.4)     17  filehandles between functions
  28.8 ( 11.3/ 16.4/  9.8)     14  Is Perl for CGI going the way of the dodo?
  25.2 ( 12.9/ 12.1/  4.7)     15  Can't unlink file under Perl for NT
  24.1 (  9.4/ 13.6/  8.4)     10  2nd request pls-Embed sound to cgi?
  22.9 (  7.2/ 15.5/  8.0)      9  append column upon match (newbie)
  22.2 (  8.4/ 13.0/  8.2)     10  RegExp /g shall substitute more often

These threads accounted for 19.5% of the total volume.

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

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

0.803  (  5.2/   6.5)      6  strict and undisciplined me
0.795  ( 23.8/  29.9)     13  Perl 5.6.0 chmod bug?
0.782  (  2.9/   3.7)      5  XS Question
0.777  (  4.8/   6.2)      5  IE vs. Netscape problems in perl
0.766  (  2.3/   3.0)      6  how to get rid of spaces around a string?
0.717  (  5.0/   6.9)      7  Perl 5.6.0 bug: best workaround?
0.709  (  4.4/   6.2)      8  Nested loops and scoping $_
0.706  (  6.4/   9.1)      6  CGI form email oddness - not acting as expected
0.704  (  8.7/  12.4)      8  Stop Transversal of a Directory... the dot dot problem
0.701  (  2.4/   3.4)      5  Accessing Files on Client PC

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

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

0.433  (  3.0 /  7.0)      8  Multiplexing strings - one line only
0.431  (  0.9 /  2.0)      5  best regular expression
0.421  (  1.1 /  2.6)      7  How to change date of a file
0.389  (  4.7 / 12.1)     15  Can't unlink file under Perl for NT
0.367  (  1.2 /  3.3)      5  Need help to suppress STDOUT
0.365  (  1.9 /  5.2)      5  USEing modules in another directory
0.357  (  1.8 /  5.0)      5  building perl - installing modules in Win32
0.348  (  2.3 /  6.6)      5  Help on 'perl -lne'
0.229  (  1.9 /  8.3)      5  Perl Guru needed for this extremely frustrating search and replace problem.
0.170  (  2.2 / 13.0)      8  How to add date stamp to a log file

69 threads (28%) had at least five posts.

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

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

      26  comp.lang.perl.modules
      13  alt.perl
       5  comp.lang.perl
       3  comp.security.unix
       2  comp.sys.mac.system
       2  comp.sys.mac.programmer.misc
       2  comp.unix.programmer
       2  comp.unix.questions
       1  comp.unix.aix
       1  comp.os.ms-windows.networking.misc

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

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

       8  "Markus Dehmann" <markus.cl@gmx.de>
       5  japhy@pobox.com
       4  Benjamin Goldberg <goldbb2@earthlink.net>
       3  Ann Tsai <mktgadm@usenix.org>
       3  Randal L. Schwartz <merlyn@stonehenge.com>
       2  Ook <ookookook@yahoo.com>
       2  * Tong * <sun_tong@users.sourceforge.net>
       2  "Evil Overlord" <webmaster@thedarkcitadel.com>
       2  mcnuttj@nin.iats.missouri.edu
       2  Mark Jason Dominus <mjd@plover.com>


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

Date: Mon, 8 Oct 2001 09:22:05 -0500
From: "Mr. Sunblade" <djberge@qwest.com>
Subject: Re: warnings and $a, $b
Message-Id: <%ziw7.17$MO6.65428@news.uswest.net>

"Benjamin Goldberg" <goldbb2@earthlink.net> wrote in message
news:3BBE708A.75935FC4@earthlink.net...
<snip>
> > #/usr/local/bin/perl -w
> > use strict;
> > my $obj = Set::Array->new(qw(1 4 2));
> > $obj->sort(sub{$a <=> $b});
>
> sub { $a <=> $b } is a coderef.
>
> [snip]
> > my @sorted = sort{ $a <=> $b } @list;
>
> { $a <=> $b } is a block, not a coderef.

Yes, I know.  However, I don't know of a way to do something like:

$obj->sort({$a<=>$b});  # hash ref?!

So, to get around this, I just mandated a 'sub' like:

$obj->sort(sub{$a<=>$b});

> [snip]
> > First, if $a and $b are recognized as special variables and don't
> > generate the usual warnings, why am I getting warnings in my version?

I dunno what I changed, but I don't get these warnings at all now.  Hmmm....

<snip>
> A better way would be to do as you would for passing a sub made in one
> package to a call to CORE::sort in another... that is, give the sub a
> prototype of ($$) and pass the arguments in as normal sub arguments.
>
> This would make your code be:
> $obj->sort( sub ($$) { $_[0] <=> $_[1] } );
>
> And instead of doing:
> local *a = \${caller . "::a"};
> local *b = \${caller . "::b"};
> $a = $foo; $b = $bar; $comparison = $thesub->();
> you would do:
> $comparison = $thesub->($foo, $bar);

I'm not sure I agree with this for the 'sort' method, simply because people
are used to $a and $b and the syntax just feels a little odd to me with the
prototypes.  However, I'll likely use your approach here for the 'foreach'
method since I was looking for something more flexible than what I had.

Thanks!

Regards,

Mr. Sunblade




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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 1890
***************************************


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