[6462] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 87 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 11 09:17:17 1997

Date: Tue, 11 Mar 97 06:00:27 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 11 Mar 1997     Volume: 8 Number: 87

Today's topics:
     Re: (Q) HTTP.PL (brian d foy)
     Re: Autostart perl program (A. Deckers)
     dupe checking and compressing in string <b.leguen@ctr.renault.fr>
     Re: dupe checking and compressing in string (Honza Pazdziora)
     Re: dupe checking and compressing in string <mikael.nystrom@sebank.se>
     Efficient multiple regexp searching (Mark J Hewitt)
     Re: Field Separators (Andy Wardley)
     Re: flock() problem (Honza Pazdziora)
     Re: Getting Started with Sockets <pcunnell@csfp.co.uk>
     Re: How to delete a file? Or/and By date. (brian d foy)
     Re: Looking for Interactive Training CD-ROM for Perl (Lisa McClure)
     Re: Looking for Interactive Training CD-ROM for Perl (Clay Irving)
     Re: Numeric Output, format help. (brian d foy)
     Re: perl religion (was: Re: Which one is the best (patt (Ollivier Robert)
     Re: Perl running on a VMSserver... <...petri.backstrom@icl.fi>
     Re: PLEASE HELP! (brian d foy)
     Re: Please Respond (Greg Hassan)
     Problem by compiling a socket routine <li@rus.uni-stuttgart.de>
     Re: Reading an HTML file using P (Honza Pazdziora)
     Re: Reading an HTML file using P (brian d foy)
     Re: Reading an HTML file using P (brian d foy)
     Re: Reading an HTML file using P (A. Deckers)
     RFC821Header Decoder (Sun Tong)
     Re: Scope? (Honza Pazdziora)
     Re: Scope? <dehon_olivier@jpmorgan.com>
     Re: Shadow passwords and perl <kistlerp@ezinfo.ethz.ch>
     Re: So easy they do not explain pattern match. (Honza Pazdziora)
     Win32 GNU emacs perl debugging <D.G.Jones@scuna.dircon.co.uk>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Tue, 11 Mar 1997 04:16:15 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: (Q) HTTP.PL
Message-Id: <comdog-1103970416150001@nntp.netcruiser>

In article <33247D94.5843@xyplex.com>, jalciere@xyplex.com wrote:

> We are thinking of using perl to automate testing of an html/http-based
> user interface.  Has anyone had experience doing this?  Is there such a
> thing as "http.pl" -- or are there other perl libraries that will be
> useful for this application?

sounds like a job for the LWP modules, available at your favorite
CPAN (Comprehensive Perl Archive Network) site (found through
your favorite search engine) :)

the LWP distribution comes with plenty of examples, and there are
lots of examples to be found be reading the past answers in this
newsgroup by searching Dejanews [1].

[1] <URL:http://www.dejanews.com>

-- 
brian d foy                              <URL:http://computerdog.com>                       
unsolicited commercial email is not appreciated


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

Date: 11 Mar 1997 12:02:28 GMT
From: Alain.Deckers@man.ac.uk (A. Deckers)
Subject: Re: Autostart perl program
Message-Id: <slrn5iaiel.8au.Alain.Deckers@nessie.mcc.ac.uk>

In <857351423.16174@dejanews.com>,
	rlgolden@ngeorgia.com <rlgolden@ngeorgia.com> wrote:
>How do I tell a perl program to run at a certain time, even if I am not
>online?  Please email an answer.

Use crontab. If you're on a Unix system, read man crontab. If you're on a
Windoze system, you should be able to find crontab ports, perhaps on
TUCOWS <URL:http://www.tucows.com/>.

[followup set to comp.unix.questions]

-- 
Alain.Deckers@man.ac.uk          <URL:http://www.man.ac.uk/%7Embzalgd/>


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

Date: Tue, 11 Mar 1997 11:34:18 +0100
From: Bertrand Le Guen <b.leguen@ctr.renault.fr>
Subject: dupe checking and compressing in string
Message-Id: <3325352A.167E@ctr.renault.fr>

hi !

Could someone tell me how (or where to find the way to do it)
to easily check a string for duplicate caracters and simplify it to only
one occurence.
in fact if
$LINE="========AAAAAABBBBBBcccdddeeee******";
i would like as result to get
$LINE="=ABcde*";

i've take a look at the perlop man page and at the FAQ and didn't get
any easy way to do it !

thank's

-- 
Bertrand Le Guen
CAD/CAM & SGI/Unix Admin 
Web Master (Intranet)
mailto:b.leguen@ctr.renault.fr


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

Date: Tue, 11 Mar 1997 11:04:23 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: dupe checking and compressing in string
Message-Id: <adelton.858078263@aisa.fi.muni.cz>

Bertrand Le Guen <b.leguen@ctr.renault.fr> writes:

> hi !
> 
> Could someone tell me how (or where to find the way to do it)
> to easily check a string for duplicate caracters and simplify it to only
> one occurence.
> in fact if
> $LINE="========AAAAAABBBBBBcccdddeeee******";
> i would like as result to get
> $LINE="=ABcde*";
> 
> i've take a look at the perlop man page and at the FAQ and didn't get
> any easy way to do it !

It is in the perlop man page ;-)

$ perl
$LINE="========AAAAAABBBBBBcccdddeeee******";
$LINE =~ tr/\000-\377//s;
print $LINE, "\n";

prints

=ABcde*

Hope this helps.

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

Date: Tue, 11 Mar 1997 12:48:12 +0100
From: Mikael =?iso-8859-1?Q?Nystr=F6m?= <mikael.nystrom@sebank.se>
Subject: Re: dupe checking and compressing in string
Message-Id: <3325467C.6FF4@sebank.se>

Bertrand Le Guen wrote:
> 
> hi !
> 
> Could someone tell me how (or where to find the way to do it)
> to easily check a string for duplicate caracters and simplify it to only
> one occurence.
> in fact if
> $LINE="========AAAAAABBBBBBcccdddeeee******";
> i would like as result to get
> $LINE="=ABcde*";
> 
> i've take a look at the perlop man page and at the FAQ and didn't get
> any easy way to do it !
> 
> thank's
> 
> --
> Bertrand Le Guen
> CAD/CAM & SGI/Unix Admin
> Web Master (Intranet)
> mailto:b.leguen@ctr.renault.fr

Hi!

I have just read about three chapters of the so far great book
'Mastering Regular Expressions' but I guess this might do the work.

$LINE=~s/(.)\1+/$1/g;

//Micke


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

Date: Tue, 11 Mar 1997 07:14:46 GMT
From: mjh@elsabio.demon.co.uk (Mark J Hewitt)
Subject: Efficient multiple regexp searching
Message-Id: <332503db.1283104@news.demon.co.uk>

I frequently want to search through build logs for my company's products.
These are long (say 20MB), and I want to produce reports from them.  There
are many lines I am not interested in, some which I just want to see
unchanged, and others that contain useful information (name of project,
platform, failed file compiles, date/time etc.) .  These are not very
regular strings - blame our SCM supplier for that - so I was using the
following scheme:

A matcher definition is a list of data structures.  The first element is a
regexp, second is a list of kash keys matching '(...)' submatches in the
regexp, and there is a 'next state' value and some indication of how severe
a problem  this line might correspond to.  For each line in the logfile, I
loop through this for the first match.  So far so god - but all these
regexps get recompiled every time, so it is slow.  There are about 120 such
definitions.

My second approach is to use these matcher definitions to write a perl
routine will all loops expanded and all regexps literally represented, and
eval that instead.  This is much faster, but I'd like to do better.

I seem to recall some discussions in this general area over a year ago, but
I can't seem to locate them (via dejanews)  now.

So what I'm looking for is any other ideas, or perhaps experience of doing
this.  Can you offer some sooths?
-- 
Mark J. Hewitt        at home         mjh@elsabio.demon.co.uk


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

Date: 11 Mar 1997 12:06:45 -0000
From: abw@peritas.com (Andy Wardley)
Subject: Re: Field Separators
Message-Id: <5g3hsl$p9s@aoxomoxoa.peritas.com>

>I heard Tom Fawcett (fawcett@nynexst.com) babbling:
>:=> 
>:=> use English;
>:=> $INPUT_RECORD_SEPARATOR = '","';

Michael McMillan <muse@news.vivanet.com> wrote:
>Why not just use 
>
>		$\ = "\"\,\"";


Because $\ is the output record seperator.  $/ is the input seperator,
aliased to $INPUT_RECORD_SEPERATOR when you "use English;".

If you single quote '","' rather than double quote "\"\,\"" you don't
need to escape all those quote characters.

Thus:

   use English;
   $INPUT_RECORD_SEPERATOR = '","';

Is equivalent to:

   $/ = "\"\,\"";

but altogther readable, if that's your thing.


A

-- 
Andy Wardley <abw@peritas.com>  **NEW** http://www.peritas.com/~abw 
A responsible and professional individual who has no need for silly 
comments, inane banter or bizarre "in-jokes" in his signature file.  


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

Date: Tue, 11 Mar 1997 08:10:00 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: flock() problem
Message-Id: <adelton.858067800@aisa.fi.muni.cz>

yili@cse.bridgeport.edu, yli@eccubed.com writes:

> I also have a lock problem with perl
> 
> in one program, I write:
> open (FH, "/path/file/);
> flock(FH, $LOCK_EX);
> sleep(100);
> flock(FH, $LOCK_UN);
> close(FH);
> 
> in another program, I write
> open (FH, ">> /path/file/);
> flock(FH, $LOCK_EX);
> print FH "TEST LINE\n";
> flock(FH, $LOCK_UN);
> close(FH);
> 
> the file will still be written "TESTLINE" althought the firt program's
> process is alive; I also tested the returned value of those flock()s,
> they are 0's. Do you know how I can get it work?

Aren't you trying this on a NFS mounted filesystem with no lockd
support? The return value of 0 makes me think that.

When I tried the piece of code on my home, it also failed, while in
local /tmp it worked just fine.

Or maybe your system doesn't support flock at all.

Hope this helps.

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

Date: Tue, 11 Mar 1997 08:11:22 +0000
From: Paul Cunnell <pcunnell@csfp.co.uk>
To: Michael Stearns <mstearns@darkwing.uoregon.edu>
Subject: Re: Getting Started with Sockets
Message-Id: <332513AA.72A5@csfp.co.uk>

Michael Stearns wrote:
> 
> I am trying to understand sockets and I am having an immediate problem:
> 
> When I do something like this:
> 
> #!/usr/local/bin/perl
> require 5.002;
> use socket;
> $text="Foo\n";
> print " - $text/n";
> 
> I get:
> 
> Can't locate socket.pm in @INC at script2 line 3.

Try:
use Socket; # module names are case-sensitive
#  ^^^

> 
> Could someone explain how I need to set up the socket stuff on my system
> so the script can see it?

If you have a normal perl5.002 installation, (as the 'require 5.002;'
statement seems to hint) then it should all 'just work'
Don't forget to look at the FAQ for some Socket examples.

> 
> Also, I am following an example on p.265 of ORA's "CGI Programming" and
> I am having a similar problem. Is this script out of date for Perl 5? Is
> there a good discussion somewhere of using modules (I am assuming that
> "socket" is some kind of external module)?

% perldoc perlmod
% perldoc Socket

> 
> P.S. Is there a separate newsgroup for Perl CGIs?

news://comp.infosystems.www.authoring.cgi

-- 
Paul Cunnell CSFB RDG (pcunnell@csfp.co.uk) +44 171 888 2946


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

Date: Tue, 11 Mar 1997 04:33:26 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: How to delete a file? Or/and By date.
Message-Id: <comdog-1103970433260001@nntp.netcruiser>

In article <3324DEB5.4194@tiac.net>, Scott Tilton <sbt@tiac.net> wrote:

> Ok, I have searched in the few Perl 5 books that I have on how to do the
> following:

the Blue Camel [1] covers everything you need to know to solve this 
problem :)  chapter three describes the functions available in Perl.
you can also reference the perlfunc manpage.

look at the following functions to see how you can use them to 
accomplish your task :)
 
> I need to be able to search in a directory for any file with the .ord

opendir() 
readdir()
closedir()

> extension and delete them by date, or time.  I need to be able to delete
> them if they are older than the current date, or if possible if the file
> is older than like 3-4 hours or so.

file test operators, p. 85 of the Camel
localtime()
unlink()


[1]
Programming Perl, Larry Wall, Tom Christensen, & Randal L. Schwartz, ISBN
1-56592-149-6.

-- 
brian d foy                              <URL:http://computerdog.com>                       
unsolicited commercial email is not appreciated


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

Date: Tue, 11 Mar 1997 11:39:16 GMT
From: mcclure@dimensional.com (Lisa McClure)
Subject: Re: Looking for Interactive Training CD-ROM for Perl
Message-Id: <33254431.820504@news.dimensional.com>


>The book is titled, 'Perl 5, Interactive Course' at
>http://www.wait.com/ezone.

Correction:  http://www.waite.com/ezone

Sorry for the error.

Lisa McClure


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

Date: 11 Mar 1997 07:49:17 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Looking for Interactive Training CD-ROM for Perl
Message-Id: <5g3kcd$pq3@panix.com>

In <33249448.3875289@news.dimensional.com> mcclure@dimensional.com (Lisa McClure) writes:

>>I just saw at Barnes & Noble (big bookstore chain) a new series of
>>books called "Interactive <insert language here>". It has a CD and
>>gives you access to their website where you can take online tests and
>>if you pass all of them, you get a certificate.  Check 'em out.
>>

>The book is titled, 'Perl 5, Interactive Course' at
>http://www.wait.com/ezone.
                
Should be:

 http://www.waite.com/ezone

-- 
Clay Irving                                        See the happy moron,
clay@panix.com                                     He doesn't give a damn,
http://www.panix.com/~clay                         I wish I were a moron,
                                                   My God! Perhaps I am!


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

Date: Tue, 11 Mar 1997 04:27:53 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Numeric Output, format help.
Message-Id: <comdog-1103970427530001@nntp.netcruiser>

In article <3324DFD6.1DF2@tiac.net>, Scott Tilton <sbt@tiac.net> wrote:

> In Perl, my output for a total is a price.  On certain calculations, the
> output looks like $00, or $0.0.  I would like to make the output for
> this variable $price to always have 2 digits after the decimal point. 

sounds like a job for sprintf.  see the perlfunc man page or chapter 3
page 222 of the Blue Camel [1] for details.  :)

[1]
Programming Perl, Larry Wall, Tom Christensen, & Randal L. Schwartz, ISBN
1-56592-149-6.

-- 
brian d foy                              <URL:http://computerdog.com>                       
unsolicited commercial email is not appreciated


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

Date: 11 Mar 1997 13:39:54 GMT
From: roberto@eurocontrol.fr (Ollivier Robert)
Subject: Re: perl religion (was: Re: Which one is the best (pattern matching))
Message-Id: <5g3nba$nne$1@polaris.eurocontrol.fr>

In article <slrn5hs1qu.634.erisson@kallisti.sw-tech.com>,
E. <erisson@kallisti.sw-tech.com> wrote:
> >     bless $you;
> 
> my ($child);

confess "your sins";

-- 
Ollivier ROBERT   -=- Eurocontrol EEC/TS -=-   Ollivier.Robert@eurocontrol.fr
Usenet Canal Historique


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

Date: 11 Mar 1997 12:47:18 GMT
From: "Petri Bdckstrvm" <...petri.backstrom@icl.fi>
Subject: Re: Perl running on a VMSserver...
Message-Id: <01bc2e19$c758b1b0$6d19c08d@ghoti>

Alan Willis <a.willis@tay.ac.uk> wrote in article
<3323D86D.723B@tay.ac.uk>...
> hope someone out there can help me. I am looking for a way of returning
> the name of the current VMS node under Perl into a simple scalar
> variable. Obviously I cannot use something like
> 
>         $node=chop(`hostname`);
> 
> 'cos that command (Unix-based) don't exist under VMS.

If you are running Digital's "UCX" a.k.a. DEC TCP/IP Services
for OpenVMS (formerly known as VMS/ULTRIX Connection), try
the DCL (Digital Command Language) commands

    write sys$output f$trnlnm( "ucx$inet_host" )
    write sys$output f$trnlnm( "ucx$inet_domain" )

or

    ucx show communication

(and parse the "Local host:" and "Domain:" fields in the output).

Comments:

    "write sys$output" writes to "STDOUT"

    "f$trnlmn()" is a DCL "lexical function" that takes a VMS logical name
    and translates it (i.e., returns the value of the logical name).

    "ucx" is the control/configuration program for the UCX product.

    If you have a different TCP/IP product than Digital's UCX, then the
    above logical names or DCL commands do not apply (as for a different
    product the approach would be [or could be, if the product "emulates"  
      UCX] different). 

    On the one VMS system I have access to, there also appears to be a
    logical name "sys$net_services_3" that contains the host.domain
    names (but I don't know - or care ;-) - who/what defined it or if 
    or how or when the number at the end varies.

    FWIW, this was on OpenVMS/Alpha V7.1 with UCX V4.1 ECO4.

regards,
 ...petri.backstrom@icl.fi
    ICL Data Oy
    Finland



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

Date: Tue, 11 Mar 1997 05:00:10 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: PLEASE HELP!
Message-Id: <comdog-1103970500100001@nntp.netcruiser>


[posted and emailed to appropriate posters]

In article <0db2g5.uo.ln@localhost>, tadmc@flash.net (Tad McClellan) wrote:

> Al Medur (medal44@ix.netcom.com) wrote:

> : IF name$ = "bigdave" THEN name$ = "<img src="bigdave.gif">"
>                                     ^^^^^^^^^^^           ^^^
> except for your having those _two_ strings there with some
> other stuff that is not a string in between them.
> 
> $name = "<img src="\bigdave.gif\">" if $name eq "bigdave"; 
>                    ^           ^ escape the quotes

of course Tad meant:

   $name = "<img src=\"bigdave.gif\">"
                     ^^
but there is the much more readable solution of qq, as

   $name = qq|<img src="bigdave.gif">|;

which you can read about on p. 41 of the Blue Camel [1].  for some
reason qq() and q() didn't make it into the index. *shrug*


[1]
Programming Perl, Larry Wall, Tom Christensen, & Randal L. Schwartz, ISBN
1-56592-149-6.

-- 
brian d foy                              <URL:http://computerdog.com>                       
unsolicited commercial email is not appreciated


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

Date: 11 Mar 1997 13:40:49 GMT
From: gwhassan@Coho.Stanford.EDU (Greg Hassan)
Subject: Re: Please Respond
Message-Id: <5g3nd1$irr@nntp.Stanford.EDU>

Scott Green (mogreen@ix.netcom.com) wrote:
: Would somebody please look at this and tell me what is wrong?

: #! /usr/local/bin/perl

: if ($ENV{'HTTP_REFERER'} ne 'www.mydomain.com')


I would think you might want to do a search for as the
referer usually returns the full url like http://blah.bal.bl/

do like $env{refer} =~ /www.domain.com/...

--
========================================
              Greg Hassan
        The Independent Solution
 for High-End Web Development contact:
          gwhassan@prodigy.net	
  http://www.cs.buffalo.edu/~gwhassan/
========================================


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

Date: Tue, 11 Mar 1997 14:43:32 +0100
From: Weiping Li <li@rus.uni-stuttgart.de>
Subject: Problem by compiling a socket routine
Message-Id: <33256184.16D2@rus.uni-stuttgart.de>

Hi experts,

Has anybody a idea to this output by compiling a socket program:

Undefined subroutine &main::INTEL called at
/usr/local/lib/perl5/sys/socket.ph line 102.

I am using perl5 on Solaris.

thanks

Weiping Li


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

Date: Tue, 11 Mar 1997 08:30:23 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Reading an HTML file using P
Message-Id: <adelton.858069023@aisa.fi.muni.cz>

California Man <jeep@rahul.net> writes:

> I read somewhere here before that the way you read an HTML file
> from the web was to use get('$urlname');
> 
> I tried this, but get() gives me an error both in perl 4 and perl5.
> 
> A) why do I get an error?

Because you probably did not use LWP::Simple; before the get command.
Get is not a built-in function, it is imported for your use in perl,
when you load (with use) proper module.

> B) How do I read a file from the web via PERL?

Just so:

use LWP::Simple;
$content = get("http://...");
__END__

Hope this helps;

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

Date: Tue, 11 Mar 1997 05:06:31 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Reading an HTML file using P
Message-Id: <comdog-1103970506310001@nntp.netcruiser>

In article <5g2vts$f1a@samba.rahul.net>, California Man <jeep@rahul.net> wrote:

> I read somewhere here before that the way you read an HTML file
> from the web was to use get('$urlname');
> 
> I tried this, but get() gives me an error both in perl 4 and perl5.

are you using the LWP module?  the get() function is not available to
you unless you use LWP.  see the LWP documentation (available at your
favorite CPAN [1]).  there are plenty of examples.  you might also
search the past threads in this newsgroup through Dejanews [2].


[1]
CPAN - Comprehensie Perl Archive Network.  find one through
<URL:http://www.yahoo.com>.  follow the path to a listing of
modules.

[2]
<URL:http://www.dejanews.com>

-- 
brian d foy                              <URL:http://computerdog.com>                       
unsolicited commercial email is not appreciated


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

Date: Tue, 11 Mar 1997 05:10:45 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Reading an HTML file using P
Message-Id: <comdog-1103970510450001@nntp.netcruiser>

In article <5g2vts$f1a@samba.rahul.net>, California Man <jeep@rahul.net> wrote:

> I read somewhere here before that the way you read an HTML file
> from the web was to use get('$urlname');
                              ^^^^^^^^^^ what's with the single quotes?

if you are already using the LWP module, you can

   get($urlname);

no need for any sort of quotes in that case. this is true for functions
in general.  you'll also save yourself the headache of dealing with 
a URI::URL reference by omitting the quotes. 

sorry that i missed that in my first answer :(

-- 
brian d foy                              <URL:http://computerdog.com>                       
unsolicited commercial email is not appreciated


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

Date: 11 Mar 1997 11:12:51 GMT
From: Alain.Deckers@man.ac.uk (A. Deckers)
Subject: Re: Reading an HTML file using P
Message-Id: <slrn5iafhk.2ka.Alain.Deckers@nessie.mcc.ac.uk>

In <comdog-1103970506310001@nntp.netcruiser>,
	brian d foy <comdog@computerdog.com> wrote:

>CPAN - Comprehensie Perl Archive Network.  find one through
><URL:http://www.yahoo.com>.  follow the path to a listing of
>modules.

Don't forget <URL:http://www.perl.com/CPAN/>, which will automatically
redirect you to a CPAN site near you.

-- 
Alain.Deckers@man.ac.uk          <URL:http://www.man.ac.uk/%7Embzalgd/>


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

Date: Tue, 11 Mar 1997 03:06:00 -0600
From: tsun@fs.com (Sun Tong)
Subject: RFC821Header Decoder
Message-Id: <cUSapFSFTlInternetMailC-970311093005Z-10@email.fs.com>

Hi,

I am a newbie to perl. I want to begin my first perl program with this
"RFC821Header Decoder". Program desciption followed.

I don't have a copy of module list, and don't know if it has been
implemented. Will you please kindly help me with it?

I'll be really grateful if you can offer any help.

Best Regards

Sun Tong


======
# Mail time Tracer

# Mail with RFC821 has standard message passing format:
# Received: from to.site by from.site id id####; time(18 Nov 96 19:53
EST)
# ^^^^^^^^^ ^^^^         ^^           ^^       ^

# This program will read a normal email message
# and produce (from the header) a SDF file
# according to above keywords (show as ^^).

# The main difficulty is that the message maybe over 1 line. E.g.:
#  Received: from infotech.ts.wm.edu by greyhawk.ts.wm.edu (AIX 3.2/UCB
#  5.64/4.03)
#            id AA06938; Thu, 27 Feb 1997 19:30:49 -0500
======



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

Date: Tue, 11 Mar 1997 08:21:47 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Scope?
Message-Id: <adelton.858068507@aisa.fi.muni.cz>

jwilleke@ix.netcom.com (Jonathan C. Willeke) writes:

> According to the Camel book and the man pages, lexically scoped
> variables declared with my are not visible to to routines called in
> the current block.  However, check out this bit of code:
> 
>     #!/usr/bin/perl -w
>     my $a = 1234;
>     print "called from main, \$a: $a\n";
>     scopeTest();
> 
>     sub scopeTest() {
>         print "called from scopeTest, \$a: $a\n";
>     }
> 
> Here's the resulting output:
> 
>     called from main, $a: 1234
>     called from scopeTest, $a: 1234
> 
> Am I misunderstanding the docs. on this?

I tried this:

#!/usr/bin/perl -w
{
my $a = 1234;
print "called from main, \$a: $a\n";
scopeTest();
}

sub scopeTest() {
print "called from scopeTest, \$a: $a\n";
}

and the result

called from main, $a: 1234
called from scopeTest, $a: 

In your example, both the initialization and the use within scopeTest
are in the same block. In my example, they are not. In yours, the
function call is in fact a call inside a block. You can do
a C-like static variables using my on the out-most level in the file.

Hope this helps.

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

Date: 11 Mar 1997 10:54:27 +0100
From: Olivier Dehon <dehon_olivier@jpmorgan.com>
Subject: Re: Scope?
Message-Id: <njz4teiah4c.fsf@jpmorgan.com>

jwilleke@ix.netcom.com (Jonathan C. Willeke) writes:

> 
> According to the Camel book and the man pages, lexically scoped
> variables declared with my are not visible to to routines called in
> the current block.  However, check out this bit of code:
> 
>     #!/usr/bin/perl -w
>     my $a = 1234;
>     print "called from main, \$a: $a\n";
>     scopeTest();
> 
>     sub scopeTest() {
>         print "called from scopeTest, \$a: $a\n";
>     }
> 
> Here's the resulting output:
> 
>     called from main, $a: 1234
>     called from scopeTest, $a: 1234
> 
> Am I misunderstanding the docs. on this?
> Jon Willeke <jwilleke@ix.netcom.com>

There is a point you missed in this example:

the $a variable has file scope, so it is seen from within the scopeTest sub.
A scope can be a pair of braces, a file or an eval string !!!

Hope this helps.

Olivier Dehon


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

Date: Tue, 11 Mar 1997 09:24:44 +0100
From: Per Kistler <kistlerp@ezinfo.ethz.ch>
To: Trevor Clout <tc@space.net.au>
Subject: Re: Shadow passwords and perl
Message-Id: <332516CC.2781@ezinfo.ethz.ch>

Hi Trevor 

If one could read the shadow password entry, it would be 
absolutely useless to have shadow files. Only root can read
them, and the login program must run as root in some way
to access that file. And that is only a matter of permissions
not of a particular programming language.

Bye, Per.
-- 
Per Kistler, Zuerich, Switzerland. (Unix/Perl/C++)
>>>>>>>>>>>>kistlerp@ezinfo.ethz.ch<<<<<<<<<<<<<
----------------------------------------------------------------------


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

Date: Tue, 11 Mar 1997 08:26:08 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: So easy they do not explain pattern match.
Message-Id: <adelton.858068768@aisa.fi.muni.cz>

soccer@microserve.net (Geoffrey Hebert) writes:

> Searching for an easy answer.  It must be easy, because the book did
> not explain what was meant.
> 
> Perhaps if I were born into UNIX I would obviously know what is meant
> below.  
> 
> What do these mean -
> s/^/< /
> $var=~s/\^/\n/          

I hope you meant

s/^/< /;
$var=~s/\^/\n/;

The first one replaces beginning of the string by two letter string "< ".
The second one, with ^ escaped, replaces the first letter ^ in the
string with the new-line character.

My Camel book mentions this (page 62).

Hope this helps.

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

Date: 11 Mar 1997 12:54:04 GMT
From: "D G Jones" <D.G.Jones@scuna.dircon.co.uk>
Subject: Win32 GNU emacs perl debugging
Message-Id: <01bc2e1b$5aeb5c60$330101c8@scuna.dircon.co.uk>

Is it possible to get the GNU emacs (for Win32) perldb stuff to work under
Windows 95? (I'm about to try NT this morning, but it'd be great if it
worked with '95 too.) My own reading would indicate that pipe limitations
on '95 would cause things to break. I have set up the Registry key for
cmd32.exe as well. Still no dice.
It will run the debugger but not split the window and follow the source
code. I'm running perl 5.003_7 BTW.

Any ideas? 

Kind regards

Derek Jones


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

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

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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


------------------------------
End of Perl-Users Digest V8 Issue 87
************************************

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