[6500] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 125 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Mar 16 01:17:20 1997

Date: Sat, 15 Mar 97 22:00:18 -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           Sat, 15 Mar 1997     Volume: 8 Number: 125

Today's topics:
     .nsconfig , dbm and perl ttsg@ttsg.com
     Re: Extracting Day of Week (Michael Fuhr)
     Re: Extracting Day of Week (Michael Fuhr)
     HELP: delete and chmod file with perl <jalbertl@ere.umontreal.ca>
     Howard Stern... <blabbo@geocities.com>
     Re: Is globbing still useful? (Andrew M. Langmead)
     Looking for Perl/C++ API for use with embedded Perl (Ken Fox)
     NetWare: 'send'? (Dirk Treusch)
     Perl 5 manual (Dragos Alexandru)
     Perl for Windows NT <jont@uunet.pipex.com>
     Re: PERL on Windows NT <...petri.backstrom@icl.fi>
     Re: Q: Good Perl Book (Paul B. Brown)
     reading in directory & filenames from a log file <rod@neep.demon.co.uk>
     Reg. expression question <mattdb@syntrillium.com>
     select statement in perl <prozario@easyway.net>
     Server won't run Perl scripts (Alan Hathcock)
     Re: What's wrong with "an email" (was: How to spam - le <philip@weather.demon.co.uk>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Sat, 15 Mar 1997 21:32:04 -0600
From: ttsg@ttsg.com
Subject: .nsconfig , dbm and perl
Message-Id: <858482730.20204@dejanews.com>

Hi,

Wondering if anyone has ever gotten perl to write dbm files that can be
used by a .nsconfig file.  They seem to talk about a file format that ends
in .id and only using database name not file name.....

(And, if you have a web based editor for it, it would make my day
something special... I've been fighting a DPT 3334UW2 SCSI controller and
spent too much time on that)

Thanks, Tuc/TTSG

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: 15 Mar 1997 12:33:01 -0700
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: Extracting Day of Week
Message-Id: <5gethd$dlp@nova.dimensional.com>

  [cc to author]

Monte Ohrt <monte@ispi.net> writes:

>If I know the MM/DD/YYYY, what is the easiest way to get the weekday?
>I know I can translate this into timelocal(), and then get the
>weekday back with localtime(), but is there an easier, more
>efficient way?

Check out the Date:: modules on CPAN.
-- 
Michael Fuhr
http://www.dimensional.com/~mfuhr/


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

Date: 15 Mar 1997 13:09:43 -0700
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: Extracting Day of Week
Message-Id: <5gevm7$f27@nova.dimensional.com>

nvp@shore.net (Nathan V. Patwardhan) writes:

>Monte Ohrt (monte@ispi.net) wrote:
>: If I know the MM/DD/YYYY, what is the easiest way to get the weekday?
>: I know I can translate this into timelocal(), and then get the
>: weekday back with localtime(), but is there an easier, more
>: efficient way?

>Here's a slightly hackish way to do it:

>Using localtime(), grab the $wday value, and pass it into week_day,
>which contains %days where each key (a weekday) is mapped to an integer.
>Then foreach() %days, and compare $wday (passed in as $day_name) against
>$day.

[ reinvented wheel omitted ]

Here's a slightly unhackish way to do it:

    use Date::Manip;
    $day_of_week = &UnixDate($date, "%a");

Where $date is MM/DD/YYYY or one of numerous other accepted formats.
-- 
Michael Fuhr
http://www.dimensional.com/~mfuhr/


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

Date: Sat, 15 Mar 1997 15:44:26 +0000
From: george <jalbertl@ere.umontreal.ca>
Subject: HELP: delete and chmod file with perl
Message-Id: <332AC3D9.25B7@ere.umontreal.ca>

I need some help...

How I should do to make my perl script to delete a file (like the rm 
command) and how I could make my script to chmod a file.

Thanks in advance,

George.


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

Date: Sat, 15 Mar 1997 23:06:02 -0600
From: Blabbo <blabbo@geocities.com>
Subject: Howard Stern...
Message-Id: <332B7FBA.40AB@geocities.com>

HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!
HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD STERN RULES!!!HOWARD
STERN RULES!!!


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

Date: Sun, 16 Mar 1997 05:41:25 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Is globbing still useful?
Message-Id: <E74Ft1.J9C@world.std.com>

Mike Nakagawa <mikenak@best.com> writes:
>require "file1.pl"
>$string = "file1";
>&$string;          # this runs file1, since when can you run a scalar?
>#end whatever.pl

>In perl 4, trying to do this involved putting "file1" into a glob, 
>then using the glob in another context.

As others have said, this syntax for subroutines was legal in previous
versions of perl as well. (take a look at "sub" in the perl manpage)
In perl 5, it has been expanded to include scalars arrays and hashes
as well.

This construct is refered to as "soft references" and details about
them can be found in the perlref man page. And yes, soft references do
handle a lot of the constructs that people used typeglobs
for. (Actually, if they were clever, they used typeglobs. If they were
stupid, they used eval. I say this because I have a lot of old code
that I wrote stupidly.) Soft references actually do this a lot better
than typeglobs used to because they don't affect (Excuse me while I
take a look at Message-ID: <4sr78s$q64@csnews.cs.colorado.edu> to make
sure I'm using the right word. Ok, I'm back.) don't affect other
entries in the symbol table (scalars, arrays, hashes, or filehandles)
that use the same identifier.

Basically, it seems that typeglobs were a backdoor into perl's symbol
table to allow people to do things that weren't allowed for in the
language. When lots of people used typeglobs for lots of different,
useful, and important things, (efficient list passing, multilevel data
structures, choosing variables or subroutines by name) better language
constructs were added to support these capabilities.


>I guess the question I have is of what use is globbing in Perl 5?

Backwards compatibility? 

(I'm not even going to try to support the "needed for filehandles"
argument. If filehandles need to be passed to subroutines, they should
be scalars returned from the FileHandle module.)
-- 
Andrew Langmead


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

Date: 16 Mar 1997 01:03:20 GMT
From: fox@pt0204.pto.ford.com (Ken Fox)
Subject: Looking for Perl/C++ API for use with embedded Perl
Message-Id: <5gfgso$drg1@eccws1.dearborn.ford.com>

I'm using Perl as an embedded interpreter for building hybrid Perl/C++
applications.  I'd really like to easily tap into Perl functionality from
C++ for doing the stuff Perl is good at:

  * Hashes
  * Regular expressions
  * Closures
  * String handling
  * File/Network IO

The XS routines are great for automatically generating bindings from C++
classes into Perl, but don't help much for generating Perl bindings for
use from C++.  (BTW, if you use XS you should take a look at SWIG.)  The
perlguts man pages are very helpful, but the API is a bit too coupled
with the interpreter for use throughout a large C++ application.  I'd
like something above the guts layer that also works well with the C++ type
system.

Actually, I've already built a small prototype to do stuff like this, but
it's not complete and before I invest a significant amount of design
effort into this, I'd like to see what others have done.  Maybe we can
pool some of our efforts.

Here's a bit of a demo of what I'm doing.

#include <stdio.h>
#include "perl-glue.hh"

struct myClass
{
    public:
	int x, y;

    public:
	myClass(int x_, int y_) { x = x_; y = y_; }
};

main()
{
    wPerlInterpreter perl;

    perl.eval("print 'this is a simple test.\n';");

    wPerlScalar n = perl.eval("10 + 5;");
    printf("perl eval result = %d\n", n.get_integer());
    printf("perl eval result = '%s'\n", n.get_string());
    printf("perl eval result = %f\n", n.get_real());

    wPerlScalar s = "Will hack Perl for food.";
    printf("perl string = '%s'\n", s.get_string());

    s.subst("hack", "design and implement");
    printf("            = '%s'\n", s.get_string());

    s.subst("(\\w+)", "[$1]");
    printf("            = '%s'\n", s.get_string());

    tPerlBitMap<double> hash_of_reals;
    hash_of_reals.set("1", 10.1);
    hash_of_reals.set(2,   10.7);
    hash_of_reals.set(3.0, 10.5);

    printf("hash_of_reals[1] = %f\n", hash_of_reals.get("1"));
    printf("hash_of_reals[2] = %f\n", hash_of_reals.get(2));
    printf("hash_of_reals[3] = %f\n", hash_of_reals.get(3.0));
    printf("hash_of_reals[4] = %f\n", hash_of_reals.get(4));

    tPerlBitMap<int> hash_of_integers;
    hash_of_integers.set("1", 1);
    hash_of_integers.set(2,   10);
    hash_of_integers.set(3.0, 100);

    printf("hash_of_integers[1] = %d\n", hash_of_integers.get("1"));
    printf("hash_of_integers[2] = %d\n", hash_of_integers.get(2));
    printf("hash_of_integers[3] = %d\n", hash_of_integers.get(3.0));
    printf("hash_of_integers[4] = %d\n", hash_of_integers.get(4));

    wPerlScalar f = perl.eval("sub {"
				 "my($h) = @_;"
				 "foreach $k (keys %$h) {"
				    "print 'length(key) = ', length($k), ', value = ', $h->{$k}, '\n';"
				 "}"
			      "}");

    perl.call(f, hash_of_reals);
    perl.call(f, hash_of_integers);

    tPerlHash<myClass> hash_of_objects;
    myClass object(17, 27);

    hash_of_objects.set("v1", object);

    object.x = 170;
    hash_of_objects.set("v2", object);

    object.y = 270;
    hash_of_objects.set("v3", object);

    myClass *object_ref;

    if ((object_ref = hash_of_objects.get("v1")) != 0) {
	printf("hash_of_objects[v1]->x = %d\n", object_ref->x);
	printf("hash_of_objects[v1]->y = %d\n", object_ref->y);
    }

    if ((object_ref = hash_of_objects.get("v2")) != 0) {
	printf("hash_of_objects[v2]->x = %d\n", object_ref->x);
	printf("hash_of_objects[v2]->y = %d\n", object_ref->y);
    }

    if ((object_ref = hash_of_objects.get("v3")) != 0) {
	printf("hash_of_objects[v3]->x = %d\n", object_ref->x);
	printf("hash_of_objects[v3]->y = %d\n", object_ref->y);
    }

    exit(0);
}

Output:

pt0204:~/hacks% ./t
this is a simple test.
perl eval result = 15
perl eval result = '15'
perl eval result = 15.000000
perl string = 'Will hack Perl for food.'
            = 'Will design and implement Perl for food.'
            = '[Will] [design] [and] [implement] [Perl] [for] [food].'
hash_of_reals[1] = 10.100000
hash_of_reals[2] = 10.700000
hash_of_reals[3] = 10.500000
hash_of_reals[4] = 0.000000
hash_of_integers[1] = 1
hash_of_integers[2] = 10
hash_of_integers[3] = 100
hash_of_integers[4] = 0
length(key) = 8, value = 10.5
length(key) = 1, value = 10.1
length(key) = 4, value = 10.7
length(key) = 8, value = 100
length(key) = 1, value = 1
length(key) = 4, value = 10
hash_of_objects[v1]->x = 17
hash_of_objects[v1]->y = 27
hash_of_objects[v2]->x = 170
hash_of_objects[v2]->y = 27
hash_of_objects[v3]->x = 170
hash_of_objects[v3]->y = 270

Yeah, yeah, I know.  My C++ looks a lot like C.  You expected something
else from a guy who is using Perl?  :-)

- Ken

-- 
Ken Fox (kfox@ford.com)                   | My opinions or statements do
                                          | not represent those of, nor are
Ford Motor Company, Powertrain            | endorsed by, Ford Motor Company.
Analytical Powertrain Methods Department  |
Software Development Section              | "Is this some sort of trick
                                          |  question or what?" -- Calvin


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

Date: 15 Mar 1997 14:24:00 +0200
From: dirk@good-news.swb.de (Dirk Treusch)
Subject: NetWare: 'send'?
Message-Id: <6Svj6poPJAB@good-news.swb.de>

Hi,

who else is using the Perl 4 port for NetWare?

There is one problem I just can't solve:

How can I issue an internal console command, e.g. 'send', from within a  
Perl script?
'exec' or 'system' only seem to work on NLMs, not on internal commands.

Any comments are much appreciated.

Regards,

Dirk


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

Date: Sat, 15 Mar 1997 21:26:53 GMT
From: dralex@usa.net (Dragos Alexandru)
Subject: Perl 5 manual
Message-Id: <5gf44s$9e4@absolut.taide.net>

Hi!

   I've been looking for a good perl 5 manual. I would
prefer it in HTML format. If you know where I can find
it, please let me know.

   Please reply at: dralex@usa.net

   Thank you!

Sincerely,
Dragos

   _________________                                   
_/Dragos G. Alexandru\_________________________________
   Bucharest/ROMANIA  E-mail:dralex@hotmail.com        
                             dralex@usa.net            
                             dralex@montero.bli.uci.edu
       Phone/Fax:                                      
    +(401) 210-ALEX   Fidonet:  2:530/100.40           
                                                       
___PGP Public Key: http://members.tripod.com/~pgpkey___



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

Date: 12 Mar 1997 17:10:20 GMT
From: "Jonathan Tracey" <jont@uunet.pipex.com>
Subject: Perl for Windows NT
Message-Id: <01bc2f08$67417c40$9a0082c2@salmon>

Hi
I am very new to Perl and am unsure of where to look for the information I
need.
Can anyone recommend a newsgroup, website or book which details perl
control of applications such as excel.
I wish to write scripts to perform excel functions on files without user
intervention and therefore require the commands for excel.
Any help would be appreciated.

Thanks in advance

Jon Tracey
p.s. Please could you Cc: me any reply Thanks



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

Date: 15 Mar 1997 15:19:41 GMT
From: "Petri Bdckstrvm" <...petri.backstrom@icl.fi>
Subject: Re: PERL on Windows NT
Message-Id: <01bc3153$b11c9be0$6d19c08d@ghoti>

Daniel McManus <mcmanus@ait.fredonia.edu> wrote in article
<01bc30b5$ffc14000$7c17ee8d@mcmanus>...
> Anyone out there using WindowsNT and have PERL running.

I am, and it works fine (or as fine as Perl currently can on Win32 ;-).

> I tried to set up PERL on NT and its not working.  But I'm too baffeled
to
> be able to say what the symptoms are so, if there is anyone out there who
> is doing this please contact me so I can ask you a couple of questions.

I'm not going to contact you directly, but I'll point you to

   the Perl Reference: http://www.panix.com/~clay/perl/

See the link "Windows 95 and Windows NT" (or go directly to

   http://www.panix.com/~clay/perl/query.cgi?windows+index

and start with

   the Perl for Win32 Frquently Asked Questions (FAQ)

at

   http://www.endcontsw.com/people/evangelo/Perl_for_Win32_FAQ.html

See also what's posted on

   http://www.activeware.com/

Once you've checked the pointers above, and are no longer "too baffeled",
come back with more specific questions (though, I suspect the above
locations will have all the answers to your questions regarding Perl
on Windows NT - even without knowing what your questions are, since
you didn't post them ;-).

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




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

Date: 9 Mar 1997 18:13:57 GMT
From: pbrown@btc.btechnet.com (Paul B. Brown)
To: Sigge Eriksson <sigge.eriksson@usa.net>
Subject: Re: Q: Good Perl Book
Message-Id: <5fuul5$6l7@reader1.news.act.net>

In article <331D39E2.2976@usa.net>,
	Sigge Eriksson <sigge.eriksson@usa.net> writes:
>Anyone know a good book for a Perl beginner?
>
>	/ Sigge Eriksson

Learning Perl by Randal L. Schwartz - A beginner's tutorial. Excellent
for the basics.

Programming Perl by Larry Wall, Tom Christiansen, and Randal L. Schwartz -
In depth into Perl and how it is used.  Excellent for advanced topics and
as a reference.

Both books as published by O'Reilly and Assoc. and are part of the Nutshell
series.

Enjoy . . . .

---------------------------------------------------------------------------
Paul B. Brown                          "Sailing is a state of mind . . . ."
pbrown@btechnet.com                    Unix Systems Administration
---------------------------------------------------------------------------



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

Date: Sun, 16 Mar 1997 05:14:15 +0000
From: Rod Neep <rod@neep.demon.co.uk>
Subject: reading in directory & filenames from a log file
Message-Id: <gbMjPOAnG4KzEwhY@neep.demon.co.uk>

The following snippet from a script reads a log file with lines in the
following format:

(all on one line)
xyz.demon.co.uk - - [02/Mar/1997:12:19:21 +0000] "GET
/fweb/fddc/tourist/index.htm HTTP/1.0" 200 3895

there are several sections to this line, each separated by a space.

The following script works fine to get the 7th section, and if it
contains the string "index" then places the full path and filename into
$docList (later I get it to count the number of each docList, and then
print the results to another file)

This works fine BUT what I want to be able to do is extract ONLY those
which contain "index" in a *certain group of directories*

for example 

/fewb/fddc/index.htm
/fweb/fddc/tourist/index.htm
/fweb/fddc/etc/index.htm

and ignore all others such as /fweb/dean ... etc

How can I change the following (working) section of the script to do
what I need?

Your help would be much appreciated
Thanks

Rod

====================== section of script =========================
open(LOGFILE) or die("Could not open log file.");

#iterate over each line of the logfile
foreach (<LOGFILE>) {
    # parse the entry to extract all the items but only keep item 7
    $fileSpec = (parseLogEntry())[7];
    # put the filename into pattern memory
    $fileSpec =~ m!.+/(.+)!;

    # store the filename into $fileName
    $fileName = $1;
    # some requests don't specify a filename, just a directory.
    # so test to see that the filename is defined
    if (defined($fileName)) {

  # specify the string to be searched for in the filename in item 7
          # for example in /fweb/fddc/tourist/index.htm 
          #                                      V here
        $docList{$fileSpec}++ if $fileName =~ m/^index/i;
    }
}
close(LOGFILE);

====================== end of section of script ===================



-- 
Rod Neep
Cinderford, Gloucestershire, England
E-mail    : rod@neep.demon.co.uk


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

Date: 15 Mar 1997 20:18:03 -0700
From: "Matt Bieber" <mattdb@syntrillium.com>
Subject: Reg. expression question
Message-Id: <01bc31b7$c7b16840$f715a5ce@primenet.primenet.com>

Hi, I seem to be stuck with this one (I'm sure it's easy--I'm still picking
up the basics):

I'm trying to weed out any string that contains anything other than: 

a-zA-Z0-9_, .'s, or @

And isn't formatted ____@____

Obviously, this is for email addresses. What I have is:

if ($entryform{'email'} =~ /[\w\.\@]/) {
&reject;
}   elsif ($entryform{'from'} !~ /[\w\.]@[\w\.]/) {
&reject;
}   else {
#go ahead
}

This may be a long way of trying to do this, but it seems to work fine
except that something like @fred@fred.com gets through, so I tried changing


elsif ($entryform{'from'} !~ /[\w\.]@[\w\.]/)

to

elsif ($entryform{'from'} !~ /\b[\w\.]@[\w\.]\b/)

 ..adding the \b's to anchor the line, but then nothing seems to get
accepted. Can anyone help?
I have Perl 5.003 running on Linux 2.0.0.

Thanks very much,

Matt Bieber
mattdb@syntrillium.com


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

Date: 15 Mar 1997 03:38:11 GMT
From: "Peter Rozario" <prozario@easyway.net>
Subject: select statement in perl
Message-Id: <01bc31bc$1dc20b00$dab2e8cd@prozario.easyway.net>

Can someone please help me with select(2) system call?
Basically, I'm trying to do some socket programming.  I need to
write some info to the socket & and then read a response back.
That part I've managed.  But I need to make my program to be
little more fault tolerant.  I want to use `select`, to abort the
read and write operation to the socket, if it takes more than a
$TIMEOUT value, (say 10 sec).  
     Say my socket handle is calledSOCKET ... 
then how do i fill in the values for select call, which
looks something like select(RBITS,WBITS,EBITS,TIMEOUT).
And when do i call the select function, and the write/read to
the socket.  If timeout does occur, how do i know that?
Thanks in advance, for any suggestions.



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

Date: 16 Mar 1997 05:29:07 GMT
From: bigal1@ix.netcom.com (Alan Hathcock)
Subject: Server won't run Perl scripts
Message-Id: <5gg0f3$t07@news8.gte.net>

I am currently using Netscape FastTrack Server 2.0 and Win95. When I call a cgi 
script from a web page, I get the following message:

This server has encountered an internal error which prevents it from fulfilling 
your request. The most likely cause is a
misconfiguration. Please ask the administrator to look for messages in the 
server's error log. 

When I check the error log in the server, I find the following: 

[15/Mar/1997:23:54:51] failure: for host 127.0.0.1 trying to GET 
/cgi-bin/calendar_3.0/calendar.cgi, send-cgi reports: could not send new 
process (ERROR_BAD_EXE_FORMAT)

[15/Mar/1997:23:54:51] failure: cgi_send:cgi_start_exec 
d:\server\docs\cgi-bin\calendar_3.0\calendar.cgi failed

I have .cgi and .pl associated with Perl.exe under Win95. The first line of the 
script is correct (#!../bin/perl). I've also tried using Perl32.exe. I've tried 
everything I can think of and I always get the same error messages. I'm sure 
it's something simple, but I've been trying to figure this out for days and I'm 
getting nowhere. I would GREATLY appreciate any help anyone could give me.

Alan Hathcock
bigal1@gte.net

P.S.

I'm also running a program called Cold Fusion. It works perfectly when I call 
the Cold Fusion cgi script dbml.exe. Also, if it's not already apparent, I'm 
new at this.




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

Date: Sun, 16 Mar 1997 02:18:49 GMT
From: Philip Eden <philip@weather.demon.co.uk>
Subject: Re: What's wrong with "an email" (was: How to spam - legitimately)
Message-Id: <858478729.18028.0@weather.demon.co.uk>

ross@valnet.es (Ross Howard) wrote:
>Philip Eden <philip@weather.demon.co.uk> wrote:

<snip>

>>Could it be that The Times is now a shameless hussey of a newspaper,
>>populated by sub-literate hacks, pandering to the whim of the
>>paper's proprietor? (Murdoch, R., for anyone who wonders). But
>>then I do write for a competitor.
>
>The one whose style sheet neglects to remind staff writers that
>"hussy" is written without an *e*, it would seem.
>
>(It's the a.u.e. equivalent of Murphy's Law: "The vehemence of your
>bitching about the language proficiency of others is in direct
>proportion to the probability that in so doing you will royally screw
>up and make a right prat of yourself.")
> 
>Ross Howard
> 
>Ross Howard
>
Then it's a good job I an neither vehement nor a bitch. You're a
harsh man Mr Howard. And so is your namesake. 

Philip Eden

Philip Eden

Philip Eden

Philip Eden





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

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

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