[14031] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1441 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Nov 20 00:08:51 1999

Date: Fri, 19 Nov 1999 21:05:08 -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: <943074308-v9-i1441@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 19 Nov 1999     Volume: 9 Number: 1441

Today's topics:
    Re: [JOB]: Web Developer/Senior Web Developer: SGML, XM <xtrm@xtrm.karoo.co.uk>
    Re: [JOB]: Web Developer/Senior Web Developer: SGML, XM (Arved Sandstrom)
    Re: Adding to @INC during perl install (Martien Verbruggen)
    Re: Adding to @INC during perl install (Martien Verbruggen)
    Re: alias a mailer (Martien Verbruggen)
    Re: Do you now an affordable Perl editor for Windows NT (Steve McKay)
    Re: Encryption Algorithm for Perl Source Code?? mason@voodoo.net
    Re: Encryption Algorithm for Perl Source Code?? <kbandes@home.com>
    Re: environment vars <cpcollin@wam.umd.edu>
    Re: file descriptors already used when perl starts (Abigail)
    Re: file descriptors already used when perl starts (Mark-Jason Dominus)
    Re: file descriptors already used when perl starts (Mark-Jason Dominus)
    Re: Generating pi (Craig Berry)
    Re: Generating pi (Simon Cozens)
        How to parse a variable for a Specific value? <nobody@newsfeeds.com>
        Macintosh specifc perl syntax? (jakal)
    Re: Perl programming sytle (Martien Verbruggen)
    Re: Removing all combinations of spaces/tabs at end of  <votemand@earthlink.net>
    Re: signature question (was Re: Help with Stoopid Nutsc (Abigail)
        Small scripting question (Cissy Hartley)
        Variable expansion in Perl limbostar@my-deja.com
        win32 alarm workaround??? <dthusma@home.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sat, 20 Nov 1999 02:14:04 -0000
From: "xtrm" <xtrm@xtrm.karoo.co.uk>
Subject: Re: [JOB]: Web Developer/Senior Web Developer: SGML, XML, PERL5, LINUX
Message-Id: <81505s$4pa$1@supernews.com>

Echo the Wonder Tube <rick@violetshiversBITE-ME-YOU-SPAMMING-SCUM.com> wrote
in message news:kJg1OHQ3uimU0qdzKCO=HTyb7Zgr@4ax.com...
> On Fri, 19 Nov 1999 12:29:44 +0000, Richard Padley
> <richard@semantico.com> wrote:
> >Semantico Limited
> >Web Developer/Programmer
> >
> >The salary range for the right person is dependent on your experience
> >but will be in the range of 22-26K for a developer at the intermediate
> >level and up to 35K for a senior developer.
>
> Even in UK pounds, that's pretty light on the salary.

You're in danger of over-estimating the value UK companies place on mere
'techies'

<uk_business>
I mean, it's just typing stuff into a computer - how much skill and
knowledge can that take?
Besides which they're all just geeks so its not as if they've got a life
outside to spend money on.
</uk_business>

Got a client who's just found they can export HTML files from Word so think
that means they can also maintain and develop their CGI scripts
themselves... So maybe I'm just in a cynical mood right now!





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

Date: Fri, 19 Nov 1999 23:51:28 -0400
From: Arved_37@chebucto.ns.ca (Arved Sandstrom)
Subject: Re: [JOB]: Web Developer/Senior Web Developer: SGML, XML, PERL5, LINUX
Message-Id: <Arved_37-1911992351280001@dyip-59.chebucto.ns.ca>

In article <kJg1OHQ3uimU0qdzKCO=HTyb7Zgr@4ax.com>, Echo the Wonder Tube
<rick@violetshiversBITE-ME-YOU-SPAMMING-SCUM.com> wrote:

> On Fri, 19 Nov 1999 12:29:44 +0000, Richard Padley
> <richard@semantico.com> wrote:
> >Semantico Limited
> >Web Developer/Programmer
> >
> >The salary range for the right person is dependent on your experience
> >but will be in the range of 22-26K for a developer at the intermediate
> >level and up to 35K for a senior developer.
> 
> Even in UK pounds, that's pretty light on the salary.

The Metro Transit (bus) drivers here in Halifax-Dartmouth, Nova Scotia
start at about CAN $30K. They don't necessarily have to finish high-school
even. So, yeah, 22-26K (even in pounds) for an intermediate developer
position is pretty shabby. Considering also that a Canadian dollar here
probably goes further than a pound does in the UK...

Ahhh, what the hell. Expertise in Perl5, SGML, XML, maintaining IIS - any
bozo can pick that up in a couple of weeks, right? :-)

Arved Sandstrom


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

Date: 20 Nov 1999 02:50:19 GMT
From: mgjv@wobbie.heliotrope.home (Martien Verbruggen)
Subject: Re: Adding to @INC during perl install
Message-Id: <slrn83c34m.1k9.mgjv@wobbie.heliotrope.home>

[migth as well correct myself while I'm here]

On Fri, 19 Nov 1999 08:43:33 -0500,
	Tony Demark <tpost@intelihealth.com> wrote:
> Martien Verbruggen wrote:
> > But, I think he rather was asking for a way to change the system wide
> > configuration of his perl instalation. The above two solutions will only
                              installation
> > work for a single script.
>
> Yep ... I am surprised that there doesn't seem to be a way to do this
> easily. I guess I should feel better, though, at least I wasn't just
> being stupid and missing something obvious!  =)

Well.. There may be ways, I just never have done it
I doubt that there are any ways to do it after installation,
but you could try fiddling with config.sh before compiling, or writing a
config.over file. The INSTALL file doesn't really help much, and
browsing through config.sh doesn't really suggest anything to me either.

I'm too lazy to actually dive into the code to see how @INC is built :)

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | 
Commercial Dynamics Pty. Ltd.   | "Mr Kaplan. Paging Mr Kaplan..."
NSW, Australia                  | 


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

Date: 20 Nov 1999 03:03:46 GMT
From: mgjv@wobbie.heliotrope.home (Martien Verbruggen)
Subject: Re: Adding to @INC during perl install
Message-Id: <slrn83c3tt.1k9.mgjv@wobbie.heliotrope.home>

On Fri, 19 Nov 1999 08:43:33 -0500,
	Tony Demark <tpost@intelihealth.com> wrote:
> Martien Verbruggen wrote:
> > But, I think he rather was asking for a way to change the system wide
> > configuration of his perl instalation. The above two solutions will only
> > work for a single script.
>
> Yep ... I am surprised that there doesn't seem to be a way to do this
> easily. I guess I should feel better, though, at least I wasn't just
> being stupid and missing something obvious!  =)

Well.. I had a little peek at the sopurce anyway. Look in perl.c and
find the occurences of incpush(). That'll show you how @INC gets built.
The only potential I can see there, without changing that code is the
undocumented APPLLIB_EXP, although, since it's undocumented, I don't
know what it's supposed to be used for.

An alternative, of course, is to add one to the code. Of course, since
incpush accepts multiple paths in one string, separated by ':' (';' for
DOS and derived menu systems, '|' for VMS), you could just try
specifying a multipath string during configuration.  Haven't tried it
myself, but it could work.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | If at first you don't succeed, try
Commercial Dynamics Pty. Ltd.   | again. Then quit; there's no use
NSW, Australia                  | being a damn fool about it.


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

Date: 20 Nov 1999 02:29:41 GMT
From: mgjv@wobbie.heliotrope.home (Martien Verbruggen)
Subject: Re: alias a mailer
Message-Id: <slrn83c1u0.1k9.mgjv@wobbie.heliotrope.home>

On Fri, 19 Nov 1999 22:01:49 GMT,
	Fox <hry@163.net> wrote:
> hi all:
> i got a problem....
> in my /etc/aliases
> i definded :
> 
> aaa:|/www/fox/test.pl
> 
> in /www.fox/test.pl i wrote:

That's not the same thing.

> #!/usr/bin/perl

-w, and use strict are considered to be good things.

> open (ifile,">>test");

You should always check the return code of this open.

> $time=localtime();
> print ifile "$time\n";
> print ifile "mail is comming\n";
> close (ifile);

And in the case of potentially multiple access to that output file, you
should probably also implement locking.

> and i send a mail to aaa,the server returned:
> 
> sh: /www/fox/test.pl: Text file busy

That's an error from sh, not from perl

> 554 |/www/fox/test.pl... unknown mailer error 126

That's an error from your MTA, not from perl

> why?

I don't know. Maybe you should ask on a group that talks about mail.
Somewhere in the comp.mail hierarchy you'll be able to find a group that
talks about your specific MTA.

What happens if you execute the script, feeding it an email message on
stdin? Have you even tried?

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | I'm just very selective about what I
Commercial Dynamics Pty. Ltd.   | accept as reality - Calvin
NSW, Australia                  | 


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

Date: 20 Nov 1999 04:20:22 GMT
From: steve@colgreen.com (Steve McKay)
Subject: Re: Do you now an affordable Perl editor for Windows NT
Message-Id: <8E83C464Ecolgreen@207.69.128.140>

samhobbs@mindspring.com (Sam Hobbs) wrote in 
<7vfqe8$nl9$1@nntp4.atl.mindspring.net>:

I love Textpad (http://www.textpad.com/). It has proven to be a very 
flexible and extensible text editor. It includes color coding, custom tools 
(like perl -cw or just perl -w), libraries (with *many* free contributed 
libraries), totally configurable...

Best $40 I ever spent.

--

Steve McKay

steve@colgreen.com

Colgreen Internet Development

http://www.colgreen.com/


>I'm using Multi-Edit and/or Notepad and/or Codewright. I have heard PFE
>(Programmer's File Editor) highly recommended. There is also Vedit for
>Windows or the old command line vedit (very compact and usable).
>Sam
>
>Don Sambrook <don@softwork-orange.com> wrote in message
>news:381AD6C0.9929B132@softwork-orange.com...
>> SitePad Pro
>> http://www.modelworks.com
>>
>> Fantastic programming editor for may languages.
>>
>> Johnny 'Loopy' Ooi wrote:
>>
>> > What's wrong with Notepad? ;-)
>> >
>> > --
>> > Johnny Ooi. Aliases: Loopy, Tuxedo Mask, Quote Master.....
>> > E-Mail          : jjyooi@dcs.qmw.ac.uk or jjyooi@yahoo.com
>> > WWW             : http://www.dcs.qmw.ac.uk/~jjyooi/
>> > ICQ No          : 6155774
>> >
>> > "Stay sane guys!"
>> >
>> > ===============================================================
>>
>
>
>


-- 


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

Date: Sat, 20 Nov 1999 04:14:38 GMT
From: mason@voodoo.net
Subject: Re: Encryption Algorithm for Perl Source Code??
Message-Id: <38361f91.1465229@news.singnet.com.sg>

I don't think so because

a) It came as a with a .cgi extension
b) When I placed it into my cgi-bin it ran as per normal
c) The first line of it starts with #!/usr/bin/Perl/ or whatever

I also don't think that its uuencoded although I don't discount the
possibility.

I'd really love to place the code in its entireity in my message but I
really don't want to get flamed for it. :)

Think I can email it to you?

On 19 Nov 1999 22:56:03 -0000, Jonathan Stowe
<gellyfish@gellyfish.com> wrote:

>On Fri, 19 Nov 1999 03:14:39 GMT jut@letterbox.com wrote:
>> Hello, I recently downloaded this script. I can't say where but when I
>> was deconstructing it to see how it did it's stuff and to learn,
>> imagine my horror when I saw a whole load of gibberish!!! 
>> 
>
>Of course thee file has been archived and packed somehow.  You will
>have to tell us what the extension of the file was to be sure - but
>usually files are tarred and gzipped .
>
>/J\



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

Date: Sat, 20 Nov 1999 04:43:15 GMT
From: Kenneth Bandes <kbandes@home.com>
Subject: Re: Encryption Algorithm for Perl Source Code??
Message-Id: <38362704.5C2B4D8@home.com>

mason@voodoo.net wrote:
> On 19 Nov 1999 22:56:03 -0000, Jonathan Stowe
> <gellyfish@gellyfish.com> wrote:
> 
> >On Fri, 19 Nov 1999 03:14:39 GMT jut@letterbox.com wrote:
> >> Hello, I recently downloaded this script. I can't say where but when I
> >> was deconstructing it to see how it did it's stuff and to learn,
> >> imagine my horror when I saw a whole load of gibberish!!!
> >>
> >
> >Of course thee file has been archived and packed somehow.  You will
> >have to tell us what the extension of the file was to be sure - but
> >usually files are tarred and gzipped .

> I don't think so because
> 
> a) It came as a with a .cgi extension
> b) When I placed it into my cgi-bin it ran as per normal
> c) The first line of it starts with #!/usr/bin/Perl/ or whatever

I recently saw something like this in a Perl program distributed
with some software we got at work.  At first, it appeared to be
all ASCII 1s and 0s.  On closer inspection, it turned that all the
variable names had been modified to various strings of 0s, 1s, and
(letter) ls.  Mixed in were standard Perl operators, a few file
names, etc.

In other words, it wasn't actually encrypted, just obfuscated.  I'd
guess that's what you've got too.

Ken Bandes


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

Date: Fri, 19 Nov 1999 23:27:03 -0500
From: "Chris Collins" <cpcollin@wam.umd.edu>
Subject: Re: environment vars
Message-Id: <815804$en7$1@hecate.umd.edu>

Wow,

I'm catching alot of flak for asking an innocent question.
Maybe I'll just write all my code in ADA from now on

Chris


David Cassell <cassell@mail.cor.epa.gov> wrote in message
news:3835E240.B291908@mail.cor.epa.gov...
> Martien Verbruggen wrote:
> [snip]
> > We've seen it here more than once (in fact, we just had one good example
> > by the name of Re'em Bar). If you don't tell them to read the docs, they
> > just keep asking. I don't know whether this particular poster would
> > have, but it's still better to understand, and to learn how to answer
> > your own questions.
> >
> > And I'll be damned if I get that fish metaphor out of the closet again.
> > It's dusty.
> >
> > Give a person a banana, and they slip. Show a person a banana tree and
> > they can learn how to climb.
>
> Okay, I think it's time for the sing-along.  Everybody!
>
> Just a Spoonful of perldoc
> [to the tune of 'A Spoonful of Sugar' from 'Mary Poppins']
>
> The newbie strug-gling with Perl
> until he's just about to hurl,
> he's sickened by this code that is a pox,
> but if he'd only use the docs
> he'd sprint out of the blocks,
> He'd get
> a life
> instead of all this strife...
>
> Just a spoonful of perldoc helps the documents get read
> the documents get re-ead
> the documents get read.
> Just a spoonful of perldoc helps the documents get read
> in a most convenient way!
>
> The worker hammering on code
> to earn the money he is owed,
> he feels this nut is just to hard to crack,
> but if he'd only read the FAQ
> he'd find out how to hack...
> It's fast!
> It's fun!
> It's clear to everyone...
>
> that a  spoonful of perldoc helps the documents get read
> the documents get re-ead
> the documents get read.
> Just a spoonful of perldoc helps the documents get read
> in a most convenient way!
>
> David, yes I am spending lots of time with my four-year-old,
> why do you ask?
> --
> David Cassell, OAO                     cassell@mail.cor.epa.gov
> Senior computing specialist
> mathematical statistician




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

Date: 19 Nov 1999 20:23:40 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: file descriptors already used when perl starts
Message-Id: <slrn83c1nm.m2v.abigail@alexandra.delanet.com>

Ilya Zakharevich (ilya@math.ohio-state.edu) wrote on MMCCLXXI September
MCMXCIII in <URL:news:814n2a$9ns$1@charm.magnus.acs.ohio-state.edu>:
$$ [A complimentary Cc of this posting was sent to Abigail
$$ <abigail@delanet.com>],
$$ who wrote in article <slrn83bmrn.l1a.abigail@alexandra.delanet.com>:
$$ > // >    "By convention the Unix shells associate file descriptor 0 with
$$ > // >     the standard input of a process, file descriptor 1 with the
$$ > // >     standard output, and file descriptor 2 with the standard error.
$$ > // >     This is a convention employed by the Unix shells and many Unix
$$ > // >     applications -- it is not a feature of the kernel.
$$ > // 
$$ > // 
$$ > // Unless you consider xterm as a shell.  Did you say that when kernel
$$ > // starts a user's shell, it has no stdin/stdout/stderr associated to it,
$$ > // but has a prepared tty?  Possible.  But is it probable?
$$ > 
$$ > No, I did not say that, nor did Stevens say that. All he said was
$$ > that the kernel doesn't necessarely map stdin/stdout/stderr to file
$$ > descriptors 0/1/2.
$$ > 
$$ > However, further reading of Stevens suggest that the entire
$$ > stdin/stdout/stderr concept is something that lives in the stdio library,
$$ > and isn't something the kernel is aware of.
$$ 
$$ Definitely.  Read what I wrote above as fd 0/1/2 being open to /dev/tty.

/dev/tty is a device. I don't know what you mean with file descriptors
being open to devices. I don't see anything above where you say anything
about file descriptors being open to devices either.

$$ > Oh, BTW, the kernel doesn't start a users shell. The shell is started
$$ > from login (or telnetd, or some other daemon), which is started from getty,
$$ > which is started from init (or inetd in case of certain daemons).
$$ 
$$ Fine.  So this is a question about telnetd/login/etc.  Do the programs
$$ started by them have fd 0/1/2 open to /dev/tty?


Sorry, don't know what you mean by that.



Abigail
-- 
perl -e '$a = q 94a75737420616e6f74686572205065726c204861636b65720a9 and
         ${qq$\x5F$} = q 97265646f9 and s g..g;
         qq e\x63\x68\x72\x20\x30\x78$&eggee;
         {eval if $a =~ s e..eqq qprint chr 0x$& and \x71\x20\x71\x71qeexcess}'


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


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

Date: Sat, 20 Nov 1999 04:30:40 GMT
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: file descriptors already used when perl starts
Message-Id: <81584c$f35$1@monet.op.net>

[Mailed and Posted.]

In article <814n2a$9ns$1@charm.magnus.acs.ohio-state.edu>,
Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
>Fine.  So this is a question about telnetd/login/etc.  Do the programs
>started by them have fd 0/1/2 open to /dev/tty?

For telnetd, the answer is yes.  It is telnetd's responsibility to
locate a pseudo-tty device and attach descriptors 0, 1, and 2 to it
before it execs login.  The `getty' program behaves similarly when the
login is on a console or other physical terminal instead of via
telnet, except that getty does not allocate a pseudo-tty; instead its
command-line argmuent tells it which terminal device to use for 0, 1,
and 2.  Both of these programs then run `login', which expects to
inherit stdin, stdout, and stderer open to the right place.

`xterm' is analogous to telnetd: It locates a new pseudo-tty device
and opens 012 onto it.  If you look into the source code for xterm you
can see this.

It really isn't a kernel feature; it's more like a giant conspiracy
between the programs that allocate terminals, the shells, and the C
standard I/O library.


Hope this helps.


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

Date: Sat, 20 Nov 1999 04:36:36 GMT
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: file descriptors already used when perl starts
Message-Id: <8158fh$f65$1@monet.op.net>

In article <814jtn$7op$1@charm.magnus.acs.ohio-state.edu>,
Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
>[A complimentary Cc of this posting was sent to Abigail
><abigail@delanet.com>],
>who wrote in article <slrn83bfl4.l1a.abigail@alexandra.delanet.com>:
>>    "By convention the Unix shells associate file descriptor 0 with
>>     the standard input of a process, file descriptor 1 with the
>>     standard output, and file descriptor 2 with the standard error.
>>     This is a convention employed by the Unix shells and many Unix
>>     applications -- it is not a feature of the kernel.
>
>Unless you consider xterm as a shell.  Did you say that when kernel
>starts a user's shell, it has no stdin/stdout/stderr associated to it,
>but has a prepared tty?  Possible.  But is it probable?

What Stevens means is that the meaning of stdin and stdout is supplied
by the shell.  Without the shell, fd1 and fd2 are totally identical.
Why is one of then stdout and one stderr?  Because of the semantics of
the | and > symbol in the shell, which has the convention that | and >
redirect fd1 and not fd2; this is why fd1 is stdout and fd2 is stderr.
Without the shell, there is still a preopened fd1 and fd2, but they
cannot be identified as `stdout' and `stderr'.



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

Date: Sat, 20 Nov 1999 04:07:14 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Generating pi
Message-Id: <s3c7jipj3ef11@corp.supernews.com>

John Arrowwood (jarrowwx@NOSPAM.home.com) wrote:
: Cool, and easy (took less than 5 minutes to code), but not very
: accurate.  I wanted to do a similar thing once, but to one million
: decimal places.  This only works to about 3 decimal places, then loses
: out due to rounding errors (most likely).  Any other suggestions?

My implementation of this series yields digits accurate out to at least
the seventh place, and presumably out to double-precision limits if you're
willing to wait long enough.  I can't imagine why yours would yield less
precision.  (My implementation was posted earlier on this thread.)

-- 
   |   Craig Berry - cberry@cinenet.net
 --*--  http://www.cinenet.net/users/cberry/home.html
   |   "They do not preach that their God will rouse them
      a little before the nuts work loose." - Kipling


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

Date: 20 Nov 1999 04:41:42 GMT
From: simon@brecon.co.uk (Simon Cozens)
Subject: Re: Generating pi
Message-Id: <slrn83c9k6.qud.simon@othersideofthe.earth.li>

Ilya Zakharevich (comp.lang.perl.misc):
>This one is almost instantaneous:
>...308078
>...307782

But still imprecise.

-- 
VMS, n.:
	The world's foremost multi-user adventure game.


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

Date: Fri, 19 Nov 1999 22:11:21 -0600
From: Anonymous <nobody@newsfeeds.com>
Subject: How to parse a variable for a Specific value?
Message-Id: <38361f61$1_5@anonymous.newsfeeds.com>

I am trying to fix the mbox2imap.pl script.  The
mbox2imap.pl script is used to migrate users
mailbox files to a IMAP server (cyrus).

Currently, when the mbox2imap.pl script runs, it
stores the message on the IMAP server with the
Current Date/Time that the message was placed into
the mailbox, and not with the Date/time that the
message was originally received

The mbox2imap.pl script breaks a users mailbox
file (/var/spool/mail/user) into the individual
messages and places it into $message.  I now need
to parse $message in order to retrieve the first
"Date: *" contained in the message.

Could anyone advise on how I could retrieve the
"Date: *\r\n" from $message in perl?

How do I go line by line thru $message and then
break out of the loop when the first "Date: *\r\n"
is found and only returning that "Date *\r\n"
line.

mbox2imap.pl stores a message, similar to the
below, text into $message before sending it to the
IMAP server, each line is separated by a CRLF:

Return-Path: <test>\r\n
Received: (from test@localhost)\r\n
        by mail.nowhere.org (8.9.3/8.9.3) id
EAA03109\r\n
        for root; Sun, 31 Oct 1999
04:02:01 -0600\r\n
Date: Sun, 31 Oct 1999 04:02:01 -0600\r\n
From: Test <test@nowhere.org>\r\n
Message-Id:
<199910311002.EAA03109@mail.nowhere.org>\r\n
To: nobody@nowhere.org\r\n
Subject: test message\r\n
Status: RO\r\n
\r\n
message body\r\n
\r\n
---

Below is the Perl code where I need to retrieve
the Date from $message:

    #
    # Get the Date of a Message
    #
    sub GetMessageDate {
        my ($message) = @_;

        my $msgDate = "";
        my $tmpDate = "";
        my $day = "20";
        my $month = "Nov";
        my $year = "1999";
        my $time = "16:00:00";
        my ($tzoff, $tzone) = "-0000";
        my ($junk1, $junk2, $junk3, $wkday) = "";

        #
        #  Code to retrieve "Date: *" from
$message
        #  NOTE: There may be more than 1
occurrence of "Date: *" in $message,
        #  we only want the first one.

        $tmpDate = "Date: Sun, 31 Oct 1999
04:02:01 -0600";

        ($junk1, $wkday, $day, $month, $year,
$time, $tzone, $junk2, $junk3) = split(' ',
$tmpDate, 9999);

        # tmpDate may have the following formats:
        #
        # Date: 31 Oct 1999 04:02:01
        # Date: 31 Oct 1999 04:02:01 -0600
        # Date: 31 Oct 1999 04:02:01 -0600 (TZ
ABV)
        # Date: Sun, 31 Oct 1999 04:02:01
        # Date: Sun, 31 Oct 1999 04:02:01 -0600
        # Date: Sun, 31 Oct 1999 04:02:01 -0600
(TZ ABV)
        if (substr($wkday, -1) ne ',' ) {
             $tzone = $time;
             $time = $year;
             $year = $month;
             $month = $day;
             $day = $wkday;
        }

        if (substr($tzone, 1, 1) eq '+') {
             $tzoff = $tzone;
        }
        elsif (substr($tzone, 1, 1) eq '-') {
            $tzoff = $tzone;
        }

        $msgDate = "$day-$month-$year $time
$tzoff";

        print "$msgDate \n";

        return ($msgDate);
    }

#This routine breaks $mboxfile into individual
messages.
    sub TransferMbox {
        my ($imap, $mailbox, $mboxfile) = @_;

        my $blank = 1;
        my $count = 1;
        my $message = "";
        my $response;

        print "Transferring $mboxfile...\n";
        open(MBOX, $mboxfile);
        while (<MBOX>) {
            if ($blank && /^From /) {
                if ($message) {
                    chop $message;  # Remove extra
blank line before next From
                    $msgdate =
GetMessageDate($message);
                    $response =
$imap->append($mailbox, $message, Date =>
$msgdate) if $count;
                    $count++;
    #               print $response->status, "-",
$response->status_text, "\n";
                }
                $message = "";
            }
            else {
                chop;
                s/$/\r\n/;      # IMAP requires
CR/LF on each line
                $message .= $_;
            }
            $blank = /^\r$/ ? 1 : 0;
        }
        $msgdate = GetMessageDate($message);
        $response = $imap->append($mailbox,
$message, Date => $msgdate) if $count;
    #   print $response->status, "-",
$response->status_text, "\n";
        close(MBOX);
        print "Transferred $count messages from
$mboxfile to $mailbox.\n";
    }






  --------== Posted Anonymously via Newsfeeds.Com ==-------
     Featuring the worlds only Anonymous Usenet Server
    -----------== http://www.newsfeeds.com ==----------


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

Date: Sat, 20 Nov 1999 15:16:37 +1030
From: jakem@camtech.net.au (jakal)
Subject: Macintosh specifc perl syntax?
Message-Id: <jakem-2011991516370001@dialup-sa-1-173.uni.camtech.net.au>

I am porting a large Perl script from a Windows NT server to a Macintosh
server and having no end of trouble. It seems that most, if not all of the
difficulties arise from trying to open files.

In the script which sits on the NT machine, I have several file locations
at the start of the script:

   $logfile = "E:/students/mac/bbs/bbslog.log";

   $URL = "http://www.server.edu.au/students/mac/bbs/bbs.pl";

   $discussion_file = "E:/students/mac/bbs/discuss.txt";

   $path_to_users = "E:/students/mac/bbs/users";

Then throughout the script I refer to these variables, sometimes adding
local variables:

   open(USERS, "$script_path/users.txt")|| die "$! can't open users.txt!!!";

This works fine on the NT machine, allowing me to move the script and all
its associated files from directory to directory and only having to change
the few lines at the start of the script.

However, it seems to die on the Macintosh server without opening the file.
The difficult thing is that the Macintosh server, unlike the NT one, does
not output any error messages, so it is so hard to know where or why it is
dying. I have written in several print statements which print to a test
file, and have been able to ascertain that it is dying at the point at
which I'm trying to open the files.

Is there something unique with MacPerl that requires a particular syntax
when opening files?? What else could be causing all these problems??

Thankyou for your time,

Jake

-- 
jakal


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

Date: 20 Nov 1999 02:11:11 GMT
From: mgjv@wobbie.heliotrope.home (Martien Verbruggen)
Subject: Re: Perl programming sytle
Message-Id: <slrn83c0rb.1k9.mgjv@wobbie.heliotrope.home>

On Fri, 19 Nov 1999 18:26:20 GMT,
	Scott McMahan <scott@aravis.softbase.com> wrote:

> Besides, who cares how "efficient" an interpreted language is?

If you mean that Perl is an interpreted language, you should probably be
a bit careful with that. It's not strictly and necessarily true.

perlfaq1 talks a little bit about this.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Failure is not an option. It comes
Commercial Dynamics Pty. Ltd.   | bundled with your Microsoft product.
NSW, Australia                  | 


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

Date: Fri, 19 Nov 1999 23:17:39 -0500
From: Michael Fischer <votemand@earthlink.net>
Subject: Re: Removing all combinations of spaces/tabs at end of string
Message-Id: <383620CA.8686FA0F@earthlink.net>



David Cassell wrote:
> 
> David H. Adler wrote:
> >
> > Personally, if the docs aren't with your copy of perl, I'd reinstall.
> > Many (if not most) consider a perl install w/o documentation to be
> > quite broken.
> 
> I certainly feel that way.
> 
> But many posters to this ng use a copy of Perl which sits
> on their ISP's machine rather than their own.  While they
> *ought* to get their own copy of Perl, they certainly
> can get a copy of the FAQ, and there is no excuse not
> to since it is available even without installing Perl first.
> 
> BTW, is it true that certain intro Perl books, like one
> for dummies, come with a CD of [pieces of] Perl which
> is lacking the docs?

Well, that exact one does have them, thank goodness.
Difficult enough getting one's brain 
around Perl in the first place, let alone trying to get on
in a unix world while you're running a mac or M$ thing.

At least it lets you get started.

OTOH, the MacPerl I run has a decent assortment of libs, pod, etc.,
but downloading the doc's in HTML form, if you can gunzip them somehow
(stuffit can be persnickity about it) is a much more readable format.

--
Michael Fischer,
who is looking forward to getting his Linux box and seeing things
in their proper light.



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

Date: 19 Nov 1999 20:25:21 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: signature question (was Re: Help with Stoopid Nutscrape (Netscape))
Message-Id: <slrn83c1qr.m2v.abigail@alexandra.delanet.com>

David Cassell (cassell@mail.cor.epa.gov) wrote on MMCCLXXII September
MCMXCIII in <URL:news:3835E668.7C01D5CD@mail.cor.epa.gov>:
%% Abigail wrote:
%% > 
%% > John McNamara (jmn.ac.delete@abanet.it) wrote on MMCCLXX September
%% > MCMXCIII in <URL:news:=vYzOCo=h4C4KzBxKaXHLLf5olLP@4ax.com>:
%% > ==
%% > == The regex (and Abagail) are discussed in Chapter 10 of Andrew L.
%% > == Johnson's Book. In Section 10.6.1 "Prime number regex".
%% [snip]
%% > Hmmm, I wonder if they send me a copy of the book then.
%% > Probably not, times seem to have changed.
%% 
%% Well, I got a free copy.  Maybe it's yours.  Just try getting
%% it back.
%% 
%% And I didn't even contribute any code.  Except for the snippet
%% in that exercise titled "Find all the bugs in this horrid bit
%% of trayfe".  :-)


I didn't even know I contributed code. But then, I've reviewed books,
and had to buy my own copy as well.



Abigail
-- 
perl -wle\$_=\<\<EOT\;y/\\n/\ /\;print\; -eJust -eanother -ePerl -eHacker -eEOT


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


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

Date: Sat, 20 Nov 1999 04:16:18 GMT
From: cissy@writerspace.removethis.com (Cissy Hartley)
Subject: Small scripting question
Message-Id: <38362010.13997267@news>

I hope some of you will be able to help me. I'm still in the "learning
to manipulate scripts" stage of learning PERL which pretty much means
I can make changes to scripts when I can find a model to follow, but I
don't know enough of the language to start something from scratch.
(Hopefully I haven't just branded myself a total loser in the eyes of
the group).

I'm currently making some changes to a postcards script for my
website. I'm setting it up for authors to use to send images of their
bookcovers to their mailing lists when they have new releases. I want
to set it up so that when a postcard is chosen, the script
automatically inserts a link to Amazon.com to buy the book. Basically
I just need the script to know which isbn# to insert into the template
for the postcard output, and since all the images are named by isbn#,
it should be simple enough to do.  Here's my problem - when an image
is selected for a postcard, the form "value" for the picture is the
full file name (isbn#.gif). So for example, this section of the form:
   <IMG SRC="/0380803291.gif" HEIGHT=107 WIDTH=75 BORDER=1><BR>
   <INPUT TYPE="radio" NAME="PICTURES" VALUE="0380803291.gif">

would correspond to this section of the script:
   $pic = $VALUE{'PICTURES'};
   $VALUE{'PICTURE'} = $VALUE{'PICTURES'};
   $VALUE{'PICTURES'} = "$basepicurl$pic";
   
I need a piece of script that would take the $VALUE{'PICTURES'}
(0380803291.gif), strip off the '.gif' and create another
$VALUE{'ISBN'} (0380803291)

Could someone help me with this?

Thanks,

Cissy
cissy@writerspace.removethis.com
(please remove spam filter in my return address)


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

Date: Sat, 20 Nov 1999 04:23:42 GMT
From: limbostar@my-deja.com
Subject: Variable expansion in Perl
Message-Id: <8157oc$ql3$1@nnrp1.deja.com>

I have a really specific problem that I can't seem
to find the solution to; if this is the wrong place
to ask, forgive me.

The situation is this:  I am reading from a text
file various patterns and replacements which act on
a body of text.  For example, I might have two
lines in the file:

\*\*([^\*]*)\*\*
<b>$1</b>

These are both regexps that change anything **
within double asterisks** into <b>html boldface</b>
 .

The problem is - it doesn't work.  I mean, it works
fine if I have the strings quoted as literals, but
since i'm reading them in from a file, they're
inside variables themselves, so I wind up with an
HTML bolded $1, and the pattern be damned.

The s///g construct looks like:

$line =~ s-$pattern-$replace-g;

I've deduced by logic that the $1 is not being
expanded because it's in another variable.

There's got to be a way to do this, but I can't
figure it out.

Can anyone help me?

I'd appreciate personal replies, because I'm
obviously not a regular...

stephen@awdang.notthispart.com

Take out whatever you feel like :)

Thanks in advance,

Stephen.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sat, 20 Nov 1999 04:23:58 GMT
From: Darrin H <dthusma@home.com>
Subject: win32 alarm workaround???
Message-Id: <38362607.96C1C305@home.com>

okay, I think I have it this time.  Try these scripts on Win32 .

on unix, you would go
eval {
            alarm(5);
            system("/usr/bin/vi");
}
if (  $? ) {
        print "alarm exception\n";
 .......

here, you will write
#-----------------------------------------
use Win32::Process;
use Getopt::Std;

#this will run alarm1 over notepad
$now=time;
$App="c:\\perl\\bin\\perl.exe",
$TMOUT=5000;
#instead of system("/usr/bin/vi"), do Win32::Process to another shell
that does
# another Win32 process call to notepad with a $Process->Wait(5000),
## as Win32 timeouts are milliseconds.
### I was just running null.pl with sleep 35;  or sleep 2; for testing
#$Cmd="perl.exe c:\\apps\\perl_alarm\\alarm1.pl -t $TMOUT -a
c:\\perl\\bin\\perl
 .exe -c \"perl c:\\apps\\perl_alarm\\null.pl\"";
$Cmd="perl.exe c:\\apps\\perl_alarm\\alarm1.pl -t $TMOUT -a
c:\\windows\\notepad
 .exe -c \"notepad.exe\"";
$bInherit=1;
$Flags=CREATE_NEW_PROCESS;
$Dir=".";

$PID=Win32::Process::Create (   $Process1,
                                $App,
                                $Cmd,
                                $bInherit,
                                $Flags,
                                $Dir);

print "started local process...waiting $TMOUT milliseconds\n";
#I know, the other sub-Process also has a TMOUT of the same, call this
# a backup, mkay?
$Process1->Wait("$TMOUT");
$delta= time - $now;
print "end local process... runtime was $delta seconds\n";

#-----------------------------------------------------
#here is alarm1.pl
use Win32::Process;
use Getopt::Std;


getopts("t:a:c:");


$App=$opt_a;
$Cmd=$opt_c;
$bInherit=1;
$Flags=CREATE_NEW_PROCESS;
$Dir=".";
$TMOUT=$opt_t;
print "\t->started alarm1.pl gonna run $opt_a and $opt_c with $TMOUT\n";

$PID=Win32::Process::Create (   $Process1,
                                $App,
                                $Cmd,
                                $bInherit,
                                $Flags,
                                $Dir);

$Process1->Wait("$TMOUT");
print "\t->ended alarm1.pl with TMOUT=$TMOUT\n";

$Process1->Kill($exitcode);


#---------------------------------------------

So far , this has worked for me, but I would like feedback before I
deploy it to production.




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

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


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