[18364] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 532 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 20 09:05:56 2001

Date: Tue, 20 Mar 2001 06:05:17 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <985097117-v10-i532@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 20 Mar 2001     Volume: 10 Number: 532

Today's topics:
    Re: "Malformed multipart POST" error with  $HTTP::Reque (Chris Fedde)
    Re: Can an Object have overloaded or multiple construct (Anno Siegel)
    Re: Can an Object have overloaded or multiple construct (Damian James)
    Re: Caugt a SIGSEGV - what does it mean? <oliver@first.in-berlin.de>
        change password script <yungp@netvigator.com>
    Re: change password script <peb@bms.umist.ac.uk>
    Re: change password script <wyzelli@yahoo.com>
    Re: confused about my and scoping nobull@mail.com
        Cost of using the CGI library <bertilow@chello.se>
        DateTime -> UnixTime <ubl@schaffhausen.de>
    Re: DateTime -> UnixTime (Anno Siegel)
    Re: DateTime -> UnixTime <ubl@schaffhausen.de>
    Re: Die with 'use strict' <bart.lateur@skynet.be>
        Distributing Perl program ?? <peter.turcan@minerva-is.sk>
    Re: Distributing Perl program ?? <ubl@schaffhausen.de>
    Re: Distributing Perl program ?? <meisl@amvt.tu-graz.ac.at>
    Re: Distributing Perl program ?? <wyzelli@yahoo.com>
    Re: error =? nobull@mail.com
    Re: error =? <bart.lateur@skynet.be>
    Re: Exception Handling , divide by zero , and compiler nobull@mail.com
    Re: Hallucinations of symrefs? <bart.lateur@skynet.be>
    Re: Help! Need script to execute a form POST (Bill Drobin)
        How can a SMTP mail be deleted from a Unix mailbox by a <elf@messer.de>
    Re: How can a SMTP mail be deleted from a Unix mailbox  (Chris Fedde)
    Re: How to find the existence of an array variable? (Anno Siegel)
    Re: how to swap 2 fields in a file <johnlin@chttl.com.tw>
        Is a function/class library for processing of SMTP-mail <elf@messer.de>
    Re: Is a function/class library for processing of SMTP- <newsgroups@webfreezer.com>
    Re: Is a function/class library for processing of SMTP- nobull@mail.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 20 Mar 2001 12:36:44 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: "Malformed multipart POST" error with  $HTTP::Request::Common::DYNAMIC_FILE_UPLOAD=1;
Message-Id: <w9It6.70$T3.182979584@news.frii.net>

In article <3AB69AA4.B800F307@pcocd2.intel.com>,
Glenn M. Lewis <glewis@pcocd2.intel.com> wrote:
>Hi!
>
>       I have the following script, running on Windows 2000 using
>ActiveState Perl version 5.6, build 623, called "testme.pl":
>
>  my $res = $ua->request(POST $url,
>                         Content_Type => 'form-data',
>                         Content => $href,

If I'm reading the syntax right I think that you want  

                          Content => [ %$href ],

here.

Good luck
chris
-- 
    This space intentionally left blank


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

Date: 20 Mar 2001 11:11:58 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Can an Object have overloaded or multiple constructors???
Message-Id: <997dtu$arj$2@mamenchi.zrz.TU-Berlin.DE>

According to Damian James <damian@qimr.edu.au>:
> Brian Francis chose 19 Mar 2001 15:59:59 -0700 to say this:
> >
> >Can an Object have overloaded or multiple constructors???
> >
> 
> Yes.

This sounds as if you know what the poster means with his question.

I don't.  Overloading a constructor doesn't make sense, because
overloading only applies to Perl builtins, which constructors aren't.

Having multiple constructors makes sense for *classes*, which of
course can have multiple methods that generate objects.  But it
would be a stretch to say that an object "has" any or all of these.

Anno


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

Date: 20 Mar 2001 12:21:12 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: Can an Object have overloaded or multiple constructors???
Message-Id: <slrn9beip4.6kl.damian@puma.qimr.edu.au>

Anno Siegel chose 20 Mar 2001 11:11:58 GMT to say this:
>According to Damian James <damian@qimr.edu.au>:
>> >...
>> >Can an Object have overloaded or multiple constructors???
>> 
>> Yes.
>
>This sounds as if you know what the poster means with his question.
>
>I don't.  Overloading a constructor doesn't make sense, because
>overloading only applies to Perl builtins, which constructors aren't.
>
>Having multiple constructors makes sense for *classes*, which of
>course can have multiple methods that generate objects.  But it
>would be a stretch to say that an object "has" any or all of these.
>

I took this as something like:

	- overloading methods doesn't make sense (the answer is undefined)
	- 'multiple constructors' I took as separate methods for creating 
		objects in the one class, which a class clearly can have (true).
	- the OP used 'or', the first expression was false, the second true,
		therefore the answer to the question is 'yes'.

OK, I'm not very good at being facetious. I hadn't, for instance, untangled
classes from objects. I assume the OP already knows something about OO from
another language, and will find the answer after a slightly less cursory
examination of the docs.

Oh well, at least my miss rate is going down.

Cheers,
Damian
-- 
@;=0..23;@;{@;}=split//,<DATA>;while(@;){for($;=@;;--$;;){next if($:=rand($;
+1))==0+$;;@;[$;,$:]=@;[$:,$;]}print map{$;{$_}}(@| ,@;);push@|,shift@;if$;[
0]==@|;$|=1;select$&,$&,$&,1/80;print"\b"x(@;+@|)}print"\n"__END__
Just another Perl Hacker


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

Date: 20 Mar 2001 12:24:56 +0100
From: Oliver Bandel <oliver@first.in-berlin.de>
Subject: Re: Caugt a SIGSEGV - what does it mean?
Message-Id: <997em8$1ca@first.in-berlin.de>


Iain Hosking <iain_hosking@hotmail.com> wrote:
> I've started noticing the occasional:

> Caught a SIGSEGV at foo.pl line 0
> $ = eval {...} called from file `foo.pl' line 0

It's a segmentation fault (memory exception).

> I can't find any reference to this error in the perl doco (I'm using

A SIGSEGV is no Perl-specific error.

I think you have problems with your perl-implementation.
Or do you have written C-extensions?


> ActiveState Perl 5.6 build 623) - the programs appear to run to completion

Oh, Windows.

No wonder, why this problem occurs.

I think you have Problem with your "operating system". :->


Regards,
    Oliver
-- 
http://www.heise.de/newsticker/data/jk-17.03.01-004/


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

Date: Tue, 20 Mar 2001 17:53:35 +0800
From: "yungp" <yungp@netvigator.com>
Subject: change password script
Message-Id: <9979dh$5pu3@imsp212.netvigator.com>

Hi ,

I am trying to develop a webpage interface, which will allow users to change
there own password through my web page interface.  I am running Redhat Linux
6.2.  I was wondering does anyone have any idea of how to write this kind of
script?

Thanks.

Peter




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

Date: Tue, 20 Mar 2001 11:19:08 +0000
From: Paul Boardman <peb@bms.umist.ac.uk>
Subject: Re: change password script
Message-Id: <3AB73CAC.E6509E0F@bms.umist.ac.uk>

yungp wrote:
> I am trying to develop a webpage interface, which will allow users to change
> there own password through my web page interface.  I am running Redhat Linux
> 6.2.  I was wondering does anyone have any idea of how to write this kind of
> script?

I know it's not nice to be nasty to people but...

how about learning perl?  Then try writing a script & then if you have
any problems make sure you have warnings 'turned on' and are 'USEing
strict' then consult the FAQ and the documentation & then, after doing
all this, if 
you still have trouble, come back here and ask for more specific help.

If I'm reading this wrong & you have been learning perl then how about
having a peruse of the CGI module?

perldoc CGI

should be a start.

also here is an excerpt from the FAQ to get you started.

=head2 Where can I learn about CGI or Web programming in Perl?
 
For modules, get the CGI or LWP modules from CPAN.  For textbooks,
see the two especially dedicated to web stuff in the question on
books.  For problems and questions related to the web, like ``Why
do I get 500 Errors'' or ``Why doesn't it run from the browser right
when it runs fine on the command line'', see these sources:
 
    WWW Security FAQ
        http://www.w3.org/Security/Faq/
 
    Web FAQ
        http://www.boutell.com/faq/
 
    CGI FAQ
                http://www.webthing.com/tutorials/cgifaq.html
 
    HTTP Spec
        http://www.w3.org/pub/WWW/Protocols/HTTP/
 
    HTML Spec
        http://www.w3.org/TR/REC-html40/
        http://www.w3.org/pub/WWW/MarkUp/
 
    CGI Spec
        http://www.w3.org/CGI/
 
    CGI Security FAQ
        http://www.go2net.com/people/paulp/cgi-security/safe-cgi.txt 

HTH 
                                    
Paul


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

Date: Tue, 20 Mar 2001 20:49:37 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: change password script
Message-Id: <c1Ht6.6$dX.1934@vic.nntp.telstra.net>

"yungp" <yungp@netvigator.com> wrote in message
news:9979dh$5pu3@imsp212.netvigator.com...
> Hi ,
>
> I am trying to develop a webpage interface, which will allow users to
change
> there own password through my web page interface.  I am running Redhat
Linux
> 6.2.  I was wondering does anyone have any idea of how to write this kind
of
> script?

You realise that can be a major security risk?

Wyzelli
--
#Modified from the original by Jim Menard
for(reverse(1..100)){$s=($_==1)? '':'s';print"$_ bottle$s of beer on the
wall,\n";
print"$_ bottle$s of beer,\nTake one down, pass it around,\n";
$_--;$s=($_==1)?'':'s';print"$_ bottle$s of beer on the
wall\n\n";}print'*burp*';




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

Date: 20 Mar 2001 12:25:49 +0000
From: nobull@mail.com
Subject: Re: confused about my and scoping
Message-Id: <u94rwomxte.fsf@wcl-l.bham.ac.uk>

rgarciasuarez@free.fr (Rafael Garcia-Suarez) writes like Godzilla:

> You shouldn't use hard references then. Code that uses hard references
> is usually hard to maintain.

This is pathologically bad advice.  I can only hope it's a typo.

Code that uses _symbolic_ references inappropriately is usually hard to
maintain.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Tue, 20 Mar 2001 12:47:47 GMT
From: "Bertilo Wennergren" <bertilow@chello.se>
Subject: Cost of using the CGI library
Message-Id: <TjIt6.2741$8%.22661@nntp1.chello.se>

I know that we're not supposed to "roll your own", but to the
CGI library. But I've already done it. I have a cgi script that
has been working successfully for years now, and when I wrote it
I thought that for speed reasons I should roll my own routines
for getting the parameters etc.

Now I plan to rewrite this script, and my question is: Was it
foolish to think that using CGI.pm would have slowed the script 
down? The parts of my code that correspond to stuff that CGI.pm
would have done are a lot smaller than CGI.pm.

The script is quite big, and does all sorts of strange things,
but it needs to be as fast as it can possibly be (in Perl).

Any thoughts?

(As a bythought: Rolling this stuff myself gave me a chance
to learn a lot of Perl tricks that I would not have learned
otherwise. Using ready made modules whenever you can does have 
a backside...)

-- 
#####################################################################
                         Bertilo Wennergren
                 <http://purl.oclc.org/net/bertilo>
                        <bertilow@chello.se>
#####################################################################




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

Date: Tue, 20 Mar 2001 10:21:08 +0100
From: Malte Ubl <ubl@schaffhausen.de>
Subject: DateTime -> UnixTime
Message-Id: <3AB72103.DA762E9C@schaffhausen.de>

Hi,

please hint me to a module on CPAN whch will convert DateTime
values to seconds since the epoch. I didnt find one myself.

Thank You,

Malte Ubl


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

Date: 20 Mar 2001 10:07:55 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: DateTime -> UnixTime
Message-Id: <997a5r$8nl$1@mamenchi.zrz.TU-Berlin.DE>

According to Malte Ubl  <ubl@schaffhausen.de>:
> Hi,
> 
> please hint me to a module on CPAN whch will convert DateTime
> values to seconds since the epoch. I didnt find one myself.

I find that hard to believe.  Depending on how you define "DateTime
values", you can use Time::Local, which is in the standard distribution,
or one of the Date::* modules a CPAN search will show you.  How on
earth did you manage to miss all these?

Anno


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

Date: Tue, 20 Mar 2001 11:56:55 +0100
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: DateTime -> UnixTime
Message-Id: <3AB73776.AE5363D6@schaffhausen.de>

Anno Siegel schrieb:
> 
> According to Malte Ubl  <ubl@schaffhausen.de>:
> > Hi,
> >
> > please hint me to a module on CPAN whch will convert DateTime
> > values to seconds since the epoch. I didnt find one myself.
> 
> I find that hard to believe.  Depending on how you define "DateTime
> values", you can use Time::Local, which is in the standard distribution,
> or one of the Date::* modules a CPAN search will show you.  How on
> earth did you manage to miss all these?

I didnt, but although I had in the back of my mind that I had done this
before and that it was quite easy, I must have read the documentations
without realizing what they actually mean.
I'm sorry I bothered you with such a stupid question.

Bye,
->malte


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

Date: Tue, 20 Mar 2001 12:09:29 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Die with 'use strict'
Message-Id: <h4iebt8jvj2tb9u5mhue402e2e6u3o0qt9@4ax.com>

Uri Guttman wrote:

>my $result ;
>$result  = `ls foobar` or die "Failed: $result\n";
>
>will work.

Not really. It dies only if $result is empty and then error message
won't be that useful.

-- 
	Bart.


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

Date: Tue, 20 Mar 2001 11:11:49 +0100
From: "Peter Turcan" <peter.turcan@minerva-is.sk>
Subject: Distributing Perl program ??
Message-Id: <997afs$f0r$1@ID-66615.news.dfncis.de>

Hi all!
What is necessary to distribute perl program to other PC machine? I want to
send some perl script to custom and he has not perl installed. It is
necessarry to install whole perl? Is there some free convertor to .exe file?

thanks for any help
Peter Turcan

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Peter Turcan     peter.turcan@minerva-is.sk  ICQ#76032190
Minerva Slovensko, a. s.           TEL +421.(0)855.5400722
Sokolska 7 / ZVOLEN / 96001        FAX +421.(0)855.5400720
                                MOBILE: +420.(0)903.552880
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-




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

Date: Tue, 20 Mar 2001 12:00:39 +0100
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: Distributing Perl program ??
Message-Id: <3AB73857.2A2BBFE2@schaffhausen.de>

Peter Turcan schrieb:
> 
> Hi all!
> What is necessary to distribute perl program to other PC machine? I want to
> send some perl script to custom and he has not perl installed. It is
> necessarry to install whole perl? 

You only need to install those modules which you actually use although
that might
be harder than doing a complete installation.

> Is there some free convertor to .exe file?

As far as I know there isnt, although I think I once saw some simple c code
which wrapped a Perl compiler and a script together. However, this wont be
any easier than just doing a normal Perl installation.

Bye,
->malte


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

Date: 20 Mar 2001 13:09:48 +0100
From: Christian Meisl <meisl@amvt.tu-graz.ac.at>
Subject: Re: Distributing Perl program ??
Message-Id: <m3r8zsfxpv.fsf@famvtpc59.tu-graz.ac.at>

Malte Ubl <ubl@schaffhausen.de> writes:
> > Is there some free convertor to .exe file?
> 
> As far as I know there isnt, [...]

There is! Have a look at

http://www.indigostar.com/perl2exe.htm

Regards,
Christian

-- 
Christian Meisl <meisl@amvt.tu-graz.ac.at>        www.amft.tu-graz.ac.at
   Inst. f. Apparatebau, Mech. Verfahrenstechnik und Feuerungstechnik
--------- Everything put together falls apart sooner or later ----------
PGP fingerprint:      DF48 2503 0411 F0EF 149C  851B 1EF0 72B9 78B6 034A


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

Date: Tue, 20 Mar 2001 22:19:30 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Distributing Perl program ??
Message-Id: <vlIt6.8$dX.2242@vic.nntp.telstra.net>

"Peter Turcan" <peter.turcan@minerva-is.sk> wrote in message
news:997afs$f0r$1@ID-66615.news.dfncis.de...
> Hi all!
> What is necessary to distribute perl program to other PC machine? I want
to
> send some perl script to custom and he has not perl installed. It is
> necessarry to install whole perl? Is there some free convertor to .exe
file?
>

The Perl Development Kit from Activestate (www.activestate.com) includes
PerlApp which will compile a standalone executeable.  $125 USD (But they
provide Active Perl free.. so they are Good guys).  I have used this to
compile some executeables and it seems to work well (needs NT or 2000 to
make the executeables, but they work on 95/98/ME).

Perl2exe from www.dynamicstate.com is another solution as well.

Or you could install a minimal perl onstallation.. The zip for ActivePerl
5.6 is only 7.5 Mb

I have also used perlcc on Linux, and that also worked OK, though it is
provided with some caveats.

Wyzelli
--
#Modified from the original by Jim Menard
for(reverse(1..100)){$s=($_==1)? '':'s';print"$_ bottle$s of beer on the
wall,\n";
print"$_ bottle$s of beer,\nTake one down, pass it around,\n";
$_--;$s=($_==1)?'':'s';print"$_ bottle$s of beer on the
wall\n\n";}print'*burp*';




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

Date: 20 Mar 2001 08:48:09 +0000
From: nobull@mail.com
Subject: Re: error =?
Message-Id: <u9n1agn6gb.fsf@wcl-l.bham.ac.uk>

<anjan50@home.com> writes:

> Subject:  error =?

perldoc perldiag.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Tue, 20 Mar 2001 12:15:36 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: error =?
Message-Id: <geiebtoj8s0bcrj0for3j5r42o4hhqk5a5@4ax.com>

<anjan50@home.com> wrote:

>Response.pm: BEGIN not safe after errors--compilation aborted at
>GKGSRS/Response.pm l

That is just the final conclusion. It indicates that compilation failed
after some errors. Which errors, well, that should have been printed out
right above it.

This here is a bit too much like geek speak, I agree.

-- 
	Bart.


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

Date: 20 Mar 2001 08:54:23 +0000
From: nobull@mail.com
Subject: Re: Exception Handling , divide by zero , and compiler
Message-Id: <u9k85kn4c3.fsf@wcl-l.bham.ac.uk>

Chandramohan Neelakantan<cmon_209@hotmail.com> writes:
> 1.  eval
> 2.   {
> 3.    $c=\8;
> 4.    $d=\0;
> 5.    $result = $$c/$$d;
> 6.    };

> Exception caught

> Example 2  uses CONSTANT references.Why doesnt the   compiler dereference  the
> CONSTANT references and generate a compile time error ? My argument is ...the
> compiler knows that the values $c and $d are pointing to,cannot change...then
> why should it allow compilation?

Your underlying point is valid but your example is bogus.  $c and $d
themselves can change - only a non-local optomiser would spot that
they didn't change.  Non-local optomisers are very compute-intensive
and since Perl is compiled each time it is run a non-local optomiser
would be a bad idea.  Worse, Perl is supposed to evolving towards
being totally thread-safe and optomisating the above would not be.

Anyhow all this is a red herring.  The Perl compiler even isn't smart
enought to spot that ${\0} is a constant.  Perhaps is could be, but
then why bother?  The normal assumption is that the programmer is not
trying to trick the optomiser.

If you want symbolically named constants then 'use constant'.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Tue, 20 Mar 2001 12:26:47 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Hallucinations of symrefs?
Message-Id: <qliebtkff5moprqm0sb7q129cqa0kf07v8@4ax.com>

Eric Bohlman wrote:

>The following is an excerpt of code from the latest (yet unreleased) 
>version of XML::TokeParser:

>#    if (defined($self->{src}) && ($self->{src_offset}<length(${$self->{src}}))) {
>#      $buf=substr(${$self->{src}},$self->{src_offset},4096);
>#      $self->{src_offset}+=4096;
>#    }

>If I use the code in the commented-out if block rather than the one below 
>it, when the end of the string referenced by $self->{src} is reached I 
>get a fatal "can't use undefined value as symbol reference" error in the 
>if statement.  A print statement reveals that both $self->{src} and 
>$self->{src_offset} are defined at this point.  *Any* mention of 
>$self->{src_offset} in the if conditional causes this error.

This looks like a Perl bug. But I can't test it. Can't you provide some
environment to where this sub is supposed to be plugged in, so we can
run it for ourselves? At least a compatible object, that would be nice.

-- 
	Bart.


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

Date: Tue, 20 Mar 2001 11:56:22 GMT
From: bdrobin@zdnetonebox.com (Bill Drobin)
Subject: Re: Help! Need script to execute a form POST
Message-Id: <3ab7464f.466948616@news.ne.mediaone.net>

On Mon, 19 Mar 2001 23:05:01 -0600, Albert Spohn <spohn@bigfoot.com>
wrote:

Thanks for the suggestion Al.  It is a one-shot deal.  I know that the
answer lies in LWP::UserAgent and HTTP::Request modules, but I am
having a difficult time understanding the documentation of those
modules in the context of this code.   I've played around and tried
some stuff, but nothing is working.  So, if anyone can look at the
original code and help me out, it would be GREATLY appreciated!

Thanks again.



>In article <3ab6b767.430363880@news.ne.mediaone.net>, 
>bdrobin@zdnetonebox.com says...
>> Newbie here.....I have searched high and low and cannot figure out how
>> to get my perl script to emulate a user filling in a username and
>> password.   I have the user name and password, and need my perl script
>> to login to the site so it can automatically access some of its
>> resources.    Can someone help?
>> 
>> I believe this is the relevant code from the web page.
>[...]
>This is probably an overly general answer, but unless this type of thing 
>is a one-shot deal for you, odds are you'll be well served by checking 
>out the following book (or maybe the current O'Reilly equivilent since 
>I'm thinking this one may be out of print):
>
>http://www.oreilly.com/catalog/webclient/
>
>in conjunction with the WWW related modules (I think LWP and HTTP would 
>suffice for what you're trying to do):
>
>http://theoryx5.uwinnipeg.ca/mod_perl/cpan-search?request=cat;catinfo=15
>
>Once you get the hang of using modules the types of things you can do 
>writing http clients (spelled out nicely in the book) is really pretty 
>cool.  
>
>Hope this helps,
>Al
>
>
>
>
>



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

Date: Tue, 20 Mar 2001 10:16:51 +0100
From: "Markus Elfring" <elf@messer.de>
Subject: How can a SMTP mail be deleted from a Unix mailbox by a script?
Message-Id: <997737$f6c$1@news.messer.de>

I've written a script that processes a SMTP mail to import it into another
system after it was piped by the forward command (see "man forward"). The
script should delete the original message from the inbox or mailbox after a
successful import.

- How can the mail deleted with the use of the Unix commands "mail" or
"mailx" in the preferred programming languages "bash", "Perl", "PHP" or
"TCL"?
- What actions must be performed to remove the specific mail from the mbox
file?




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

Date: Tue, 20 Mar 2001 12:24:42 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: How can a SMTP mail be deleted from a Unix mailbox by a script?
Message-Id: <e_Ht6.69$T3.170604544@news.frii.net>

In article <997737$f6c$1@news.messer.de>, Markus Elfring <elf@messer.de> wrote:
>I've written a script that processes a SMTP mail to import it into another
>system after it was piped by the forward command (see "man forward"). The
>script should delete the original message from the inbox or mailbox after a
>successful import.
>
>- How can the mail deleted with the use of the Unix commands "mail" or
>"mailx" in the preferred programming languages "bash", "Perl", "PHP" or
>"TCL"?
>- What actions must be performed to remove the specific mail from the mbox
>file?
>

The standard unix paradigm for mbox format is as follows. Get an exclusive
lock on the mailbox file.  Process its contents appropriately.
Truncate the mailbox file. Remove the lock.  If you need to process
one message at a time then you read one message, copy the data
forward in the file and truncate at the end before unlocking.  Perl
can easily do all this without the help of an external program.

You may get some mileage out of one of the Mail::Folder modules. Or it
might be reasonable to use Net::POP3 if your host supports a pop server.

chris
-- 
    This space intentionally left blank


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

Date: 20 Mar 2001 13:03:48 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: How to find the existence of an array variable?
Message-Id: <997kfk$ed9$1@mamenchi.zrz.TU-Berlin.DE>

According to David Ness  <DNess@Home.Com>:
> Jagan Mohan K wrote:
> > 
> > Hi,
> >   Any idea how to find the whether a variable exists or not in Perl?
> > What I mean is a command something like  [info exists a ] checks for
> > existence of the variable in Tcl.
> > 
> > Thanks,
> > -Jagan
> 
> perldoc -f defined

Don't use defined() on aggregate variables.  The result can be
misleading, and it will produce a warning if enabled.  defined(),
applied to an array, tells you if there is storage allocated to
the array, not if it actually contains any elements.  The latter
is most easily tested by using the array in a boolean context.

To see the difference, watch this:

    no warnings;

    my @array;
    print "1: defined\n" if defined @array;
    print "1: boolean\n" if @array;

    push @array, 1;
    print "2: defined\n" if defined @array;
    print "2: boolean\n" if @array;

    pop @array;
    print "3: defined\n" if defined @array;
    print "3: boolean\n" if @array;

Anno


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

Date: Tue, 20 Mar 2001 15:47:50 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: Re: how to swap 2 fields in a file
Message-Id: <9971sa$2po@netnews.hinet.net>

"ckw" wrote:
> how do i swap 2 fields in a file
> for eg
> abcdef                ghiji
> becomes
> ghiji                    abcdef

perl -lape "@F[0,1]=@F[1,0]; $_=join(' ',@F)" yourfile

or

perl -pe "s/(\S+)(\s+)(\S+)/$3$2$1/" yourfile

to keep original spaces.

John Lin





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

Date: Tue, 20 Mar 2001 10:12:14 +0100
From: "Markus Elfring" <elf@messer.de>
Subject: Is a function/class library for processing of SMTP-mails available?
Message-Id: <9976qi$f65$1@news.messer.de>

I've found the following:
> man forward
" ...
     If the first character of the address is a vertical bar (|),
     sendmail(1M)  pipes the message to the standard input of the
     command the bar precedes.
 ... "

I want to read this piped message to import it in one of our systems after
the sender and the subject had been checked.
Do you know a function or class library for a programming language (e. g.
PHP, TCL or Perl) that helps me to process this mail?




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

Date: Tue, 20 Mar 2001 12:05:31 +0100
From: "Sascha Kimmel" <newsgroups@webfreezer.com>
Subject: Re: Is a function/class library for processing of SMTP-mails available?
Message-Id: <997di0$ab7$1@wrath.news.nacamar.de>

Hi,

my .forward looks like this:

>>>
venice% more .forward
"|IFS='' && exec /usr/local/bin/procmail -f- || exit 75 #USERNAME"
<<<

where USERNAME is my user name.
So as you see you need procmail to achieve what you want to do.
I then forward the complete message to a perl script via procmail:

>>>
venice% more testing.rc
:0
{
:0 fw: perl.lock
| /usr/home/USERNAME/send.pl
:0/dev/null
}
<<<

The perl script processes the e-mail and forwards it based on certain
criteria.
You can of course do whatever you want in this perl script.

Regards,
Sascha Kimmel



"Markus Elfring" <elf@messer.de> schrieb im Newsbeitrag
news:9976qi$f65$1@news.messer.de...
> I've found the following:
> > man forward
> " ...
>      If the first character of the address is a vertical bar (|),
>      sendmail(1M)  pipes the message to the standard input of the
>      command the bar precedes.
> ... "
>
> I want to read this piped message to import it in one of our systems after
> the sender and the subject had been checked.
> Do you know a function or class library for a programming language (e. g.
> PHP, TCL or Perl) that helps me to process this mail?
>
>




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

Date: 20 Mar 2001 12:35:36 +0000
From: nobull@mail.com
Subject: Re: Is a function/class library for processing of SMTP-mails available?
Message-Id: <u9wv9klip1.fsf@wcl-l.bham.ac.uk>

"Markus Elfring" <elf@messer.de> writes _exactly_ the same thing he
wrote 4 weeks ago.  We answered him then.

Go away troll!

Followups sent somewhere appropriate. :-)

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

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

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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


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