[13229] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 639 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 25 15:07:26 1999

Date: Wed, 25 Aug 1999 12:05:15 -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           Wed, 25 Aug 1999     Volume: 9 Number: 639

Today's topics:
        "aliasing" functions <jerrad@networkengines.com>
    Re: "Odd number of elements in hash list" (error messag <aqumsieh@matrox.com>
    Re: ** REQUEST FOR A SCRIPT ** <cassell@mail.cor.epa.gov>
    Re: A nice tough RegEx for u to solve..? (Bart Lateur)
    Re: Check if user is on? (Michel Dalle)
        Compiling 5.005_03 source on Solaris 7 <dominic_coombe@lotus.com>
        conditional sub defintion belg4mit@mit.edu
    Re: Desperately searching for perl lint (T. Alex Beamish)
    Re: Desperately searching for perl lint (T. Alex Beamish)
    Re: Desperately searching for perl lint (T. Alex Beamish)
        Documentation Error For require Operator? <james.p.williams@usahq.unitedspacealliance.com>
    Re: exec problems please HELP <cassell@mail.cor.epa.gov>
    Re: extract text (Gary O'Keefe)
    Re: extract text (Michel Dalle)
    Re: extract text <cassell@mail.cor.epa.gov>
    Re: File Upload for WinNT W/ ActivePerl and CGI.pm-2.54 <jerrad@networkengines.com>
        HTML Tools for perl? <voxelman@my-deja.com>
    Re: learning perl from a book,need help <cassell@mail.cor.epa.gov>
    Re: Mail subroutine using postie <cassell@mail.cor.epa.gov>
        need help with constants <davidrubin@lucent.com>
    Re: newbi: Registry Help under NT <cassell@mail.cor.epa.gov>
    Re: Newsgroups via PERL <dont_ever.spam_pvoris@earthlink.net>
    Re: package <garethr@cre.canon.co.uk>
        Perl & email <chris@syl.sj.nec.com>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Wed, 25 Aug 1999 09:55:02 -0400
From: jerrad pierce <jerrad@networkengines.com>
Subject: "aliasing" functions
Message-Id: <37C3F5B6.A8FA5885@networkengines.com>

Okay so I have an existing function: funckychickens
and I want to make it available as greenjelly as well.
What's the best way to do this?
I know:
sub greenjelly{ &funkychickens(@_); }

Will work but is there a way to make greenjelly refer directly to funkychickens?

I've tried \&greenjelly = \&funkychickens and all sorts of other means.

any ideas?

Thanks!


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

Date: Wed, 25 Aug 1999 11:03:36 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: "Odd number of elements in hash list" (error message)
Message-Id: <x3yzozfx5q0.fsf@tigre.matrox.com>


Bill Williams <biwillia@cisco.com> writes:

> ----pseudo - code ------
> 
> while (<PFILE>){
>         chomp;
>             %parvals = split('=',$_);
>             %parameters = (%parameters, %parvals);
>     }
>     $value1 = $parameters{value1};
> 
> ----end pseudo-code-----

Ugh. This seems to me to be exactly equivalent to the following:

    while (<PFILE>) {
	chomp;
	my ($key, $val) = split /=/;
	$parameters{$key} = $val;
    }

which is more intuitive, and clearer.

Note that if split() returns only one element, then $val will be
undef.

HTH,
Ala



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

Date: Wed, 25 Aug 1999 11:25:36 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: ** REQUEST FOR A SCRIPT **
Message-Id: <37C43520.5CF2867@mail.cor.epa.gov>

kilimount wrote:
> 
> Being from now totaly incapable of writing one, I'm searching for a
> script that would calculate details on mortgages.
> The most complex, the best.
> If ever anyone as one to give away, that B cool :O)

Umm, in general this is not the place to ask for free scripts.
There may be a new group in the alt.* hierarchy with some name
like alt.perlcgi.freelance , but my newsfeed doesn't see it.

Still, you're more likely to have success using one of the
primo web search engines to look for your program for you.
There are lots of sites on the web with Perl programs.

One last point: if you consider yourself incapable of writing
a Perl program, how can you ensure that the program you find
does what you want, and correctly at that, and without
creating massive security holes?  Wouldn't it make sense to
learn a *little* Perl?  Enough to look over the code for
intrinsic badness?  You might take a look at:
    http://www.netcat.co.uk/rob/perl/win32perltut.html
which is not actually win32-centric.

Good luck,
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Wed, 25 Aug 1999 18:24:28 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: A nice tough RegEx for u to solve..?
Message-Id: <37c53497.8258523@news.skynet.be>

Bart Lateur wrote:

>You'd better limit the string pattern to [^<>]{40,0}

Oops. I forgot about the whitespace.

	[^<>\s]{40,0}

	Bart.


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

Date: Wed, 25 Aug 1999 17:39:09 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: Check if user is on?
Message-Id: <7q19t3$r3f$1@news.mch.sbs.de>

In article <37C406E4.83586F5E@top.mitre.org>, Patrick Tully <pmt@top.mitre.org> wrote:
>Hi,
>    I run a user-based website, and would like it to be possible to
>check if a user is 'loged-in'.  I use cookies to keep track of sessions
>and don't know if this would be of any help.  I don't know the best way
>to approch this task.  Just checking if an IP address is active is not
>an option, because of dynamicly assigned addresses.  I was thinking of
>if a user logged it, the login script would write to a file and when a
>user logged out, it would delete the entry from the file.  The only
>problem with that, is i know its common for users to not log-out, and
>just type in a different site.  Is there anyway to force a user to log
>out before leaving the site?  Is there a better approch to this
>problem?  Any ideas?

No, no and maybe (or did I miss a 'no' somewhere).

Even if you could add some JavaScript to make leaving your
site more difficult, the first time you did that would be the
last time I visited your site. :-(

Why would you like to know if a user is 'on' ? For some kind
of web-based chatbox or something ? You might keep track of
who WAS "connected" in the last x minutes, but there would still
be no guarantee that the user is still actually connected.

One alternative : use some Java applet to handle all 'on-line'
actions, and consider the user 'gone' as soon as the
socket connection is closed. But then your website is only
used as an entry point, that's all...

Have fun,

Michel.

--
aWebVisit - extracts visitor information from WWW logfiles and shows
the top entry, transit, exit and 'hit&run' pages, the links followed
inside your website, the time spent per page, the visit duration etc.
For more details, see http://gallery.uunet.be/Michel.Dalle/awv.html


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

Date: Wed, 25 Aug 1999 14:10:17 -0400
From: Dominic Coombe <dominic_coombe@lotus.com>
Subject: Compiling 5.005_03 source on Solaris 7
Message-Id: <37C43189.B2D60E6@lotus.com>

Hi All,

I have only just joined this group so I am not sure if I have missed the
reply to this, but has anyone else experiences problems getting a 100%
make test on Solaris 7 on a Sparc?

Running Solaris 7 on a Ultra 5

I am using GNU gcc version = 2.95.1

Configure ran fine or as best as I could see.

I ran make and that seemed to run fine too.

Ran make test and then ./TEST and get the following results.

base/cond..........ok
base/if............ok
base/lex...........ok
base/pat...........ok
base/rs............ok
base/term..........ok
comp/cmdopt........ok
comp/colon.........ok
comp/cpp...........ok
comp/decl..........ok
comp/multiline.....ok
comp/package.......ok
comp/proto.........ok
comp/redef.........ok
comp/require.......ok
comp/script........ok
comp/term..........ok
comp/use...........ok
cmd/elsif..........ok
cmd/for............ok
cmd/mod............ok
cmd/subval.........ok
cmd/switch.........ok
cmd/while..........ok
io/argv............ok
io/dup.............ok
io/fs..............ok
io/inplace.........ok
io/iprefix.........ok
io/pipe............ok
io/print...........ok
io/read............ok
io/tell............ok
op/append..........ok
op/arith...........ok
op/array...........ok
op/assignwarn......ok
op/auto............ok
op/avhv............ok
op/bop.............ok
op/chop............ok
op/closure.........ok
op/cmp.............ok
op/cond............ok
op/context.........ok
op/defins..........ok
op/delete..........ok
op/die.............ok
op/die_exit........ok
op/do..............ok
op/each............ok
op/eval............ok
op/exec............ok
op/exp.............ok
op/flip............ok
op/fork............ok
op/glob............ok
op/goto............ok
op/goto_xs.........ok
op/grep............ok
op/groups..........ok
op/gv..............ok
op/hashwarn........ok
op/inc.............ok
op/index...........ok
op/int.............ok
op/join............ok
op/list............ok
op/local...........ok
op/magic...........ok
op/method..........ok
op/misc............ok
op/mkdir...........ok
op/my..............ok
op/nothread........ok
op/oct.............ok
op/ord.............ok
op/pack............ok
op/pat.............ok
op/pos.............ok
op/push............ok
op/quotemeta.......ok
op/rand............ok
op/range...........ok
op/read............ok
op/readdir.........ok
op/recurse.........ok
op/ref.............ok
op/regexp..........ok
op/regexp_noamp....ok
op/repeat..........ok
op/runlevel........ok
op/sleep...........ok
op/sort............ok
op/splice..........ok
op/split...........ok
op/sprintf.........ok
op/stat............ok
op/study...........ok
op/subst...........ok
op/substr..........ok
op/sysio...........ok
op/taint...........ok
op/tie.............ok
op/tiearray........ok
op/tiehandle.......ok
op/time............ok
op/tr..............ok
op/undef...........ok
op/universal.......ok
op/unshift.........ok
op/vec.............ok
op/wantarray.......ok
op/write...........ok
pragma/constant....ok
pragma/locale......FAILED at test 0
pragma/overload....ok
pragma/strict......ok
pragma/subs........ok
pragma/warning.....ok
lib/abbrev.........ok
lib/anydbm.........ok
lib/autoloader.....ok
lib/basename.......ok
lib/bigint.........ok
lib/bigintpm.......ok
lib/cgi-form.......ok
lib/cgi-function...ok
lib/cgi-html.......ok
lib/cgi-request....ok
lib/checktree......ok
lib/complex........ok
lib/db-btree.......skipping test on this platform
lib/db-hash........skipping test on this platform
lib/db-recno.......skipping test on this platform
lib/dirhand........ok
lib/dosglob........ok
lib/dumper-ovl.....ok
lib/dumper.........FAILED at test 0
lib/english........ok
lib/env............ok
lib/errno..........ok
lib/fatal..........ok
lib/fields.........ok
lib/filecache......ok
lib/filecopy.......ok
lib/filefind.......ok
lib/filehand.......ok
lib/filepath.......ok
lib/filespec.......ok
lib/findbin........ok
lib/gdbm...........skipping test on this platform
lib/getopt.........ok
lib/h2ph...........ok
lib/hostname.......ok
lib/io_dup.........ok
lib/io_pipe........ok
lib/io_sel.........ok
lib/io_sock........ok
lib/io_taint.......FAILED at test 0
lib/io_tell........FAILED at test 0
lib/io_udp.........ok
lib/io_xs..........FAILED at test 0
lib/ipc_sysv.......FAILED at test 0
lib/ndbm...........FAILED at test 0
lib/odbm...........FAILED at test 0
lib/opcode.........ok
lib/open2..........ok
lib/open3..........ok
lib/ops............FAILED at test 0
lib/parsewords.....ok
lib/ph.............FAILED at test 0
lib/posix..........ok
lib/safe1..........ok
lib/safe2..........ok
lib/sdbm...........FAILED at test 0
lib/searchdict.....ok
lib/selectsaver....ok
lib/socket.........ok
lib/soundex........ok
lib/symbol.........ok
lib/textfill.......ok
lib/texttabs.......ok
lib/textwrap.......ok
lib/thread.........skipping test on this platform
lib/tie-push.......ok
lib/tie-stdarray...ok
lib/tie-stdpush....ok
lib/timelocal......ok
lib/trig...........ok
u=0.65  s=0.43  cu=31.63  cs=17.59  scripts=174  tests=6066

Failed Test  Status Wstat Total Fail  Failed  List of failed
-------------------------------------------------------------------------------

lib/dumper-ovl.   0   139    ??   ??       %  ??
lib/filecopy.t    0   132    11    0   0.00%  ??
lib/filehand.t    0    11    11    0   0.00%  ??
lib/io_pipe.t     0   132    10    0   0.00%  ??
lib/io_sock.t     0   139     5    0   0.00%  ??
lib/io_taint.t  139 35584    ??   ??       %  ??
lib/io_tell.t     0   139    ??   ??       %  ??
lib/io_udp.t      0   139     3    0   0.00%  ??
lib/io_xs.t       0   139    ??   ??       %  ??
lib/ipc_sysv.t    0   139    ??   ??       %  ??
lib/ndbm.t        0   132    ??   ??       %  ??
lib/opcode.t      0   132    25    0   0.00%  ??
lib/open2.t       0   132     7    0   0.00%  ??
lib/open3.t       0   139    21    0   0.00%  ??
lib/ops.t         0   138    ??   ??       %  ??
lib/ph.t          0   139    ??   ??       %  ??
lib/safe1.t       0   132    28    0   0.00%  ??
lib/safe2.t       0   132    32    0   0.00%  ??
lib/sdbm.t        0   138    ??   ??       %  ??
op/goto_xs.t      0   139    10    0   0.00%  ??
pragma/locale.t 139 35584    ??   ??       %  ??
5 tests skipped, plus 14 subtests skipped.
Failed 21/190 test scripts, 88.95% okay. 0/6245 subtests failed, 100.00%
okay.


Could someone tell me if this is ok to proceed with for installation?
And how I may correct the problems.

Many thanks,

Dominic Coombe




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

Date: Wed, 25 Aug 1999 17:06:29 GMT
From: belg4mit@mit.edu
Subject: conditional sub defintion
Message-Id: <7q17qa$32d$1@nnrp1.deja.com>

Is this even possible?

if($A){
	print "if ";
	sub baz{ print "true\n"; }}
else{
	print "else ";
	sub baz{ print "false\n"; }}

If run when A is 0 else is printed as expected. and baz prints false
If run when A is 1 if   is printed as expected. and baz prints false !!

I've tried putting it in BEGIN{} as well thinking that might help...


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


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

Date: Wed, 25 Aug 1999 18:42:11 GMT
From: talexb@tabsoft.on.ca (T. Alex Beamish)
Subject: Re: Desperately searching for perl lint
Message-Id: <37c43921.246617150@news1.on.sympatico.ca>

On 24 Aug 1999 14:39:00 GMT, ebohlman@netcom.com (Eric Bohlman) wrote:

>T. Alex Beamish (talexb@tabsoft.on.ca) wrote:
>: Since moving over to perl a year ago I've tried to follow the same
>: practices, but I do not see a perl lint anywhere. Before I attempt to
>
>That's because it's built into perl itself.  If you look at the perlbug 
>manpage, you'll see that the first listed item has to do with the fact 
>that you have to explicitly ask for it :)

Sorry, lint is built in? I had a look at the manpage for perlbug, and
it didn't mention lint at all. The pattern "lint" isn't there.

I am already using -w and "use strict" for all of my scripts; I want
to do more rigorous checking than that.

T. Alex Beamish, Principal -- TAB Software
  Toronto, Ontario -- www.tabsoft.on.ca


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

Date: Wed, 25 Aug 1999 18:43:22 GMT
From: talexb@tabsoft.on.ca (T. Alex Beamish)
Subject: Re: Desperately searching for perl lint
Message-Id: <37c43999.246736447@news1.on.sympatico.ca>

On 24 Aug 1999 15:44:23 +0100, Jonathan Stowe
<gellyfish@gellyfish.com> wrote:

>the -w switch and 'use strict;'
>
>(and possibly the -c switch if you dont want to actually run the program)

I'm using both of those already. That's like using \W4 under the MS C
compiler. I'm trying to find a good lint for perl.

T. Alex Beamish, Principal -- TAB Software
  Toronto, Ontario -- www.tabsoft.on.ca


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

Date: Wed, 25 Aug 1999 18:44:00 GMT
From: talexb@tabsoft.on.ca (T. Alex Beamish)
Subject: Re: Desperately searching for perl lint
Message-Id: <37c439db.246802359@news1.on.sympatico.ca>

On Wed, 25 Aug 1999 00:52:04 +0200, "johan schoen"
<johan.schon@capgemini.se> wrote:

>I suggest the -w switch!

Using it already, as well as "use strict".

T. Alex Beamish, Principal -- TAB Software
  Toronto, Ontario -- www.tabsoft.on.ca


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

Date: Wed, 25 Aug 1999 18:17:20 GMT
From: Jim Williams <james.p.williams@usahq.unitedspacealliance.com>
Subject: Documentation Error For require Operator?
Message-Id: <7q1buv$6fq$1@nnrp1.deja.com>

The perlfunc man page states that the require operator behaves similar
to the following subroutine.  The camel book shows a similar version.

    sub require {
        my($filename) = @_;
        return 1 if $INC{$filename};
        my($realfilename,$result);
        ITER: {
            foreach $prefix (@INC) {
                $realfilename = "$prefix/$filename";
                if (-f $realfilename) {
                    $result = do $realfilename;
                    last ITER;
                }
            }
            die "Can't find $filename in \@INC";
        }
        die $@ if $@;
        die "$filename did not return true value" unless $result;
        $INC{$filename} = $realfilename;
        return $result;
    }

However, it seems $filename should be added to %INC *before* the do
statement, assuming a successful outcome.  Then, on failures, $filename
should be removed from %INC as part of the error handling.  As written,
recursively including the same $filename would cause infinite recursive
calls to this model of require.  This assumption of success agrees with
my reading of how require is actually implemented in pp_ctl.c.

I know it is only supposed to be a model of the real operator, but it
would be easy to correct this inconsistency.

    sub require {
        my($filename) = @_;
        return 1 if $INC{$filename};
        my($realfilename,$result);
        ITER: {
            foreach $prefix (@INC) {
                $realfilename = "$prefix/$filename";
                if (-f $realfilename) {
                    $INC{$filename} = $realfilename;  # added
                    $result = do $realfilename;
                    last ITER;
                }
            }
            die "Can't find $filename in \@INC";
        }
        delete $INC{$filename} if $@ || !$result;  # added
        die $@ if $@;
        die "$filename did not return true value" unless $result;
#       $INC{$filename} = $realfilename;  # removed
        return $result;
    }

Agreed?

Jim Williams


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


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

Date: Wed, 25 Aug 1999 11:15:38 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: exec problems please HELP
Message-Id: <37C432CA.C4C8D0E5@mail.cor.epa.gov>

alghazn@my-deja.com wrote:
> 
> Hi,
> I'm having problems trying to call one of my scripts, say myscript.cgi
> from another script, say, mainscript.cgi
> Doing this in the mainscript.cgi (as explained by someone earlier)
> exec "myscript.cgi?prefix=qwert&&indirect=hello&&criteria=agent";
> gives a server error.

Which server?  
Which OS?
Perl or PerlScript or ...?

There are some cases wher you cannot use exec().  This is
actually mentioned in the ActivePerl FAQ, but it is not 
an inclusive list.  Still, if you're running PerlScript
[to name but one case], it shares the process space with
the web server [and other stuff].  So an exec() would be
A Very Bad Thing.

You do know that exec() executes the system command and
then *never*returns*, right?  Are you sure you want to
do such a thing in your case?  You might want to look
at the system() function and qx// .

HTH,
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Wed, 25 Aug 1999 17:15:53 GMT
From: gary@onegoodidea.com (Gary O'Keefe)
Subject: Re: extract text
Message-Id: <37c42378.31461975@news.hydro.co.uk>

A keyboard was whacked upside Abigail's head and out came:

>michael hagberg (mzh@cntw.com) wrote on MMCLXXXV September MCMXCIII in
><URL:news:7q0l57$4ln$1@news3.global-ip.net>:

What? Michael wrote this message on 2185th September 1993? Cool...

Gary
--
Gary O'Keefe
gary@onegoodidea.com

You know the score - my current employer has nothing to do with what I post


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

Date: Wed, 25 Aug 1999 17:47:03 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: extract text
Message-Id: <7q1abu$r3f$2@news.mch.sbs.de>

In article <7q0l57$4ln$1@news3.global-ip.net>, "michael hagberg" <mzh@cntw.com> wrote:
>problem is, I never know the length. I DO know between which characters I
>want to extract the text from. So I want to say like
>substr(EXPR,OFFSET,FROM,TO) where form and to is the boundaries. I dont see
>how to do that with the help of substr... or am I just blind?

Yep. Look for 'index' in your Perl documentation. This allows you to find the
first occurence of a substring in a string.

Of course, you might be better off matching a regular expression, as described
in perlop : see m//. More details about regular expressions can be found in
perlre.

Michel.


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

Date: Wed, 25 Aug 1999 11:35:54 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: extract text
Message-Id: <37C4378A.F9879546@mail.cor.epa.gov>

Gary O'Keefe wrote:
> 
> A keyboard was whacked upside Abigail's head and out came:
> 
> >michael hagberg (mzh@cntw.com) wrote on MMCLXXXV September MCMXCIII in
> ><URL:news:7q0l57$4ln$1@news3.global-ip.net>:
> 
> What? Michael wrote this message on 2185th September 1993? Cool...

Yep.  All of Abigail's posts use Roman numerals and September
1993.  You've heard the saying "Now it's September all the
time on Usenet" haven't you?  If not, search deja.com for
discussions in this ng on the subject.

HTH,
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Wed, 25 Aug 1999 14:51:56 -0400
From: jerrad pierce <jerrad@networkengines.com>
Subject: Re: File Upload for WinNT W/ ActivePerl and CGI.pm-2.54
Message-Id: <37C43B4C.36520742@networkengines.com>

I'd have to disagree as well. 
I just did this last week.
You want: Win32::ASP::CGI
It's on Matt Seargant's page, author of WIN32::ASP


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

Date: Wed, 25 Aug 1999 18:09:51 GMT
From: voxelman <voxelman@my-deja.com>
Subject: HTML Tools for perl?
Message-Id: <7q1bh6$61t$1@nnrp1.deja.com>

I'm wondering if there is a tool for perl similiar to Zope(www.zope.org)
which is for python. Essentially I need a tool that will allow my to
keep the HTML as seperate as possible from the CGI code...this is so
that graphics people working on the layouts do not deal with the code in
anyway. I've written some tools to substitute variables embedded in the
HTML as the script runs but perhaps there is a better way out there. If
anyone could point me to some tools I would greatly appreciate it.
Thanks in advance.

--
Paul Dlug(Voxelman)


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


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

Date: Wed, 25 Aug 1999 11:21:15 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: learning perl from a book,need help
Message-Id: <37C4341B.58042CED@mail.cor.epa.gov>

Michael de Beer wrote:
> 
> Should these be put in the FAQ?
> 
>  -  'what is a string' question and
>  -  'what is the difference between single and double quotes' question

I don't think so.  Just because the same guy posted these
questions an arbitrary number of times under [at least] two
different names doesn't mean it is 'frequent' yet.

But feel free to write up the answers and post them to
perlfaq-suggestions@perl.com .  The worst that will happen
is that TomC will send you an e-mail telling you that he's not
ready to put it in the FAQ.

Hmmm.. maybe that's not the worst that could happen.  :-)

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Wed, 25 Aug 1999 11:29:45 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Mail subroutine using postie
Message-Id: <37C43619.FCEC8D40@mail.cor.epa.gov>

Stone Cold wrote:
> 
> I'm looking for a simple email subroutine using a third party email
> program called postie.  I'm on the right track, but a little stumped.
> 
> Anyone have a simple subroutine that calles a third party email program?

Since you're posting from a win32 box, I'm going to guess
that you want this for win32, and that you have ActiveState
Perl installed somewhere.  If not, ignore the rest of this
post.

You don't need 'postie', since the ActivePerl FAQ has a
question on mail which includes three different alternatives,
with code for each one.  Net::SMTP or Mail::Sender or
Mail::Sendmail will do, as will Perl code to utilize Blat or
JMail or the NT version of sendmail or wrmail or...

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Wed, 25 Aug 1999 13:13:20 -0400
From: David L Rubin <davidrubin@lucent.com>
Subject: need help with constants
Message-Id: <37C42430.B6518317@lucent.com>

I want to use constants in my program, but I'm having trouble with the syntax.

Let's say I have the following modules (I'm just typing this in as I go, so
excuse incorrect syntax):

package Constants;
use constant E_TIMEOUT => "timeout";
use constant E_FILE => "file error";
use constant E_NET => "networking error";

# Export the constants under the tag "errors"

----------
package MyProg;
use Constants qw(:errors);

 ...


Now, using constants makes it easy and nice to do things like this

my $err = foo();
if ($err eq E_TIMEOUT) {print ....}

But how can I use constants in a hash context? For instance, I could do this

%handle_error=(
	eval{E_TIMEOUT} => &handle_timeout,
	eval{E_FILE} => &handle_file,
	eval{E_NET} => &handle_net,
);

which only kind of sucks, or I could do this

%handle_error=(
	@{[E_TIMEOUT]} => &handle_timeout,
	@{[E_FILE]} => &handle_file,
	@{[E_NET]} => &handle_net,
);

as indicated in 'perldoc constant', but this is *really* ugly. The alternative
seems to be that I export

my $E_TIMEOUT => "timeout";
my $E_FILE => "file error";
my $E_NET => "networking error";

from Constants, and use $E_X everywhere. This works a bit better in hash
contexts, but
it's really not as nice in scalar contexts (plus, these variables are not
constants).

What is the preferred "Perl Way?" Or, does anyone have other suggestions?
Thanks.

	david

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
David L Rubin			      f 1.973.581.6665 v 1.973.386.8598
Lucent Technologies, NJ0117 14J-211, 67 Whippany Rd, Whippany, NJ 07981


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

Date: Wed, 25 Aug 1999 11:33:12 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: newbi: Registry Help under NT
Message-Id: <37C436E8.926910B8@mail.cor.epa.gov>

Jenda Krynicky wrote:
[snip of gender error]
> HIS site!
> 
> Oh well. I guess I should put a picture of me online or at least specify my sex on my site.
> 
> Never mind :-)

Just keep repeating these three words:
   Americans.. are.. stupid.

David, proud to be stupid^WAmerican
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Wed, 25 Aug 1999 09:36:59 -0700
From: Joe Schmoe <dont_ever.spam_pvoris@earthlink.net>
Subject: Re: Newsgroups via PERL
Message-Id: <37C41BAB.F447910B@earthlink.net>

See response above for 'A simple Perl newsreader'
and convert to CGI.

P



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

Date: Wed, 25 Aug 1999 17:26:04 GMT
From: Gareth Rees <garethr@cre.canon.co.uk>
Subject: Re: package
Message-Id: <siwvuju5zn.fsf@cre.canon.co.uk>

belg4mit@mit.edu wrote:
> Is there a way to tell if a given package is loaded?

One possibility, from the perlvar manpage:

    %INC    The hash %INC contains entries for each filename
	    that has been included via do or require.  The key
	    is the filename you specified, and the value is the
	    location of the file actually found.  The require
	    command uses this array to determine whether a given
	    file has already been included.

Another possibility:

    sub module_is_loadable {
      my ($module) = @_;
      eval { require "$module.pm" };
      return !$@;
    }

And another:

    sub package_is_nonempty {
      my ($package) = @_;
      no strict "refs";
      !!%{"${package}::"};
    }

(These all do different things - which one is right for you depends on
what you want to do with the information.)

-- 
Gareth Rees


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

Date: Wed, 25 Aug 1999 17:44:36 +0000
From: Chris Tembreull <chris@syl.sj.nec.com>
Subject: Perl & email
Message-Id: <37C42B84.25A4EAE6@syl.sj.nec.com>


Greetings.

I'm working on an app right now, an in/out board for the employees
in my company.  The basic idea is to let them use the web to indicate
where they are - so they can be found if they need to be.  One of the
features I'm supposed to add is a "mail-in" function, so any employee
can email a certain address with the following subject:

----------
[headers... none of these matter]
Subject: joe_schmoe@syl.sj.nec.com:OUT

I'm still in Boston, my flight has been cancelled due to storm 
warnings.  I expect to be out until tomorrow afternoon at the
latest.  

--
Joe Schmoe
VP of Widgets
NEC Systems, Inc.

----------

Frankly, I'm not so sure how to go about this project yet.. I need to
figure out the following:
	1) how to collect and process the headers automatically
	2) how to snip out .sig files of varying types

I've tried using Mail::Util qw(read_mbox), but it doesn't seem to 
do quite what I want to do.  Would anyone care to give a stressed-out
geek a hand?

-- 
Cheers!

Chris Tembreull
Web Developer, NEC Systems Inc.                      110 Rio Robles Dr.
chris@syl.sj.nec.com                                 San Jose, CA 95134
http://www.necsyl.com                                  (408) 434 - 7175



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

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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu. 

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


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