[13364] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 774 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 13 05:07:23 1999

Date: Mon, 13 Sep 1999 02:05:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 13 Sep 1999     Volume: 9 Number: 774

Today's topics:
    Re: about dbmopen() <gellyfish@gellyfish.com>
    Re: baffle about flock() please help! (Bill Moseley)
        Can't locate module ppp0:0 <clint@drtech.co.uk>
    Re: Can't locate module ppp0:0 <clint@drtech.co.uk>
    Re: Design Advice needed on Sending Data to Client <madebeer@igc.apc.org>
    Re: extracting text and images from a postgres DB !!! <gellyfish@gellyfish.com>
    Re: How to make clean the text with screen control char <gellyfish@gellyfish.com>
    Re: how to tag a pattern match from a filehandle <gellyfish@gellyfish.com>
    Re: Idea for extracting name from city? <madebeer@igc.apc.org>
    Re: Need date/time validation on user input. (Bill Moseley)
    Re: Operating system problems? <gellyfish@gellyfish.com>
    Re: Perl / C Memory (Alan Curry)
        POP3 module for WINDOWS32i86 kik79@my-deja.com
        POP3 module for WINDOWS32i86 kik79@my-deja.com
        rand questions <scatt@goes.com>
    Re: rand questions (Larry Rosler)
    Re: rand questions <hove@ido.phys.ntnu.no>
        Reading symbolic links (Ron Grunwald-Computer Programmer PGS Tensor Perth)
    Re: running Perl files on Apache 1.3 running under Wind (Bill Moseley)
    Re: running Perl files on Apache 1.3 running under Wind <gellyfish@gellyfish.com>
    Re: Searching by date problem. (Bill Moseley)
    Re: Searching by date problem. (Benjamin Franz)
    Re: Searching by date problem. (Larry Rosler)
    Re: Searching by date problem. <gellyfish@gellyfish.com>
    Re: UseNet <madebeer@igc.apc.org>
        Using DB_File to talk to a Sendmail 8.9.x hash <apollock@bit.net.au>
        where to write perl??? <andy-huang@mindspring.com>
    Re: where to write perl??? <wablief@freemail.nl>
    Re: where to write perl??? (Lars Gregersen)
    Re: where to write perl??? <gellyfish@gellyfish.com>
    Re: WHILE(1) {} <nguyend7@msu.edu>
    Re: win32 disk formatting <clarked@hunterdon.csnet.net>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: 13 Sep 1999 07:37:31 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: about dbmopen()
Message-Id: <7ri9jr$3j6$1@gellyfish.btinternet.com>

On 12 Sep 1999 19:01:01 GMT Handsome wrote:
> Hi, anyone know,
> If I use dnmopen(), I will get list.dbm.db file,
> What's software  I can read list.dbm.db file ?
> 

I'm not aware of any software that does read DBM files - if you need to use
this data in another application you will probably want to create a
suitable file in your Perl program (such as a CSV file) that is understood
by this other application,

Most modern Perl programs will not use dbmopen directly but will use the
tie() mechanism via the modules DB_File, SDBM_File, GDBM_File etc ..

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sun, 12 Sep 1999 21:27:53 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: baffle about flock() please help!
Message-Id: <MPG.12461d25f93601bb989741@nntp1.ba.best.com>

Martien Verbruggen (mgjv@comdyn.com.au) seems to say...
> > That's interesting and something I never caught from the docs... is it
> > because the lock is released when the file is closed anyway?
> 
> Yes.
> 
> And, in fact, explicitly breaking the lock before closing (or at least
> flushing) the file can be harmful. At least on some platforms.

perldoc -f flock
          To avoid the possibility of miscoordination, Perl now
          flushes FILEHANDLE before locking or unlocking it.

Might as well just close() if you can, but that bit of the docs makes it 
sound like what you are talking about may not apply anymore?


-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


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

Date: Mon, 13 Sep 1999 08:16:29 +0100
From: "nntp.netcom.net.uk" <clint@drtech.co.uk>
Subject: Can't locate module ppp0:0
Message-Id: <7ri88g$pg1$1@taliesin.netcom.net.uk>

I have recompiled my kernel (2.2.11) to optimise a box for use as a router.

Only problem, I can't get ppp working.

I included it as a module (CONFIG_PPP=M) but my system seems unable to find
it. My /lib/modules/2.2.11/net directory looks like this :
    8390.o
    bsd_comp.o
    dummy.o
    ne.o
    ne2k-pci.o
    ppp.o
    ppp_deflate.o
    slhc.o
    syncppp.o

My /etc/conf.modules file looks like this :
    alias eth0 ne
    options ne io=0x300
    alias parport_lowlevel parport_pc
    pre-install pcmcia_core /etc/rc.d/init.d/pcmcia start
    alias ppp-compress-21  bsd_comp
    alias ppp-compress-24  ppp_deflate
    alias ppp-compress-26  ppp_deflate

When I connect I get this :
Sep 12 20:38:35 router pppd[2519]: pppd 2.3.7 started by root, uid 0
: - snipped
Sep 12 20:38:52 router chat[2520]: CONNECT
Sep 12 20:38:52 router chat[2520]:  -- got it
Sep 12 20:38:52 router chat[2520]: send (^M)
Sep 12 20:38:52 router chat[2520]: expect (ogin:)
Sep 12 20:38:52 router chat[2520]:  115200/V.34 28800/V42b/SREJ^M
Sep 12 20:38:53 router chat[2520]: ^M
: - snipped
Sep 12 20:38:54 router chat[2520]: PPP session from  194.42.225.133 to
194.42.228.226 beginning...~
Sep 12 20:38:54 router chat[2520]:  -- got it
Sep 12 20:38:54 router chat[2520]: send (^M)
Sep 12 20:38:54 router pppd[2519]: Serial connection established.
Sep 12 20:38:54 router pppd[2519]: Using interface ppp2
Sep 12 20:38:54 router pppd[2519]: Connect: ppp2 <--> /dev/ttyS0
Sep 12 20:39:00 router pppd[2519]: local  IP address 194.42.228.226
Sep 12 20:39:00 router pppd[2519]: remote IP address 194.42.225.133
Sep 12 20:39:04 router modprobe: can't locate module ppp0:0
Sep 12 20:39:04 router modprobe: can't locate module ppp0:1
Sep 12 20:39:04 router modprobe: can't locate module ppp0:2

etc

Any suggestions grealy appreciated

Many thanks

Clint







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

Date: Mon, 13 Sep 1999 08:18:26 +0100
From: "nntp.netcom.net.uk" <clint@drtech.co.uk>
Subject: Re: Can't locate module ppp0:0
Message-Id: <7ri8c5$pin$1@taliesin.netcom.net.uk>

Sory - posted to the wrong group by mistake

Clint




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

Date: Sun, 12 Sep 1999 22:07:33 -0700 (PDT)
From: Michael de Beer <madebeer@igc.apc.org>
Subject: Re: Design Advice needed on Sending Data to Client
Message-Id: <APC&1'0'50775da5'1e1@igc.apc.org>

Caitlyn Hay wrote:
>I have to write a server program that interacts with a client 
>program.  Basically, the client program will submit
>a criteria to the server via a http connection.  Based on this 
>criteria, the server will generate some ASCII formated data, and return 
>it (the ASCII data) back to the client.

Based on my understanding of these requirements, I think you 
should use the exact same tools you would for a standard CGI-script:

  On the server-side, write a CGI script that runs on your favorite 
  webserver, like Apache.  

  On the client-side, use the LWP module to have your client program
  send a GET or POST request to the cgi script at the server and get the
  results. 

Is there any reason this simple approach would fail?  
If you need a constantly running server for performance issues, mod_perl 
( http://perl.apache.org/ ) might help. 

If you really want a stand-alone server, it may be helpful to search
CPAN ( http://www.cpan.org/ ) for 'server'. It has modules that may get
you more than halfway there. 

To really roll your own, search 'perldoc perlipc' for socket. 

Cheers,
-Michael


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

Date: 13 Sep 1999 07:42:43 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: extracting text and images from a postgres DB !!!
Message-Id: <7ri9tj$3j9$1@gellyfish.btinternet.com>

On Sun, 12 Sep 1999 21:26:29 +0000 Antonio Pires wrote:
> Hi there ...
> 
> I am trying to make a cgi with  perl that will extract data from a
> postgresSQL DB , some fields are text and other fields are gif images
> ... ...so may question is : how can i make a perl cgi script that
> generates a html page using text and images from the data base all at
> the some time ???
> 

You cant do it directly you will either have to write the image file to
disk or you will need to have a separate program that will generate the
image which will be referred to in an IMG tag.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: 13 Sep 1999 08:18:54 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: How to make clean the text with screen control characters.
Message-Id: <7ric1e$3jv$1@gellyfish.btinternet.com>

On Mon, 13 Sep 1999 09:41:02 +0900 Yoon wrote:
> What is the best way of cleaning the messy text with screen control
> characters ? I suppose the screen control characters are curses based.
> 

You will need to identify the characters you want to remove and then
create a regular expression that will match that - you may run into trouble
with things like emboldened or underlined text which might be rendered like:

      N^HN^HN^HNA^HA^HA^HAM^HM^HM^HME^HE^HE^HE

which is slightly (only slightly mind) more difficult to deal with than
simply removing control characters.

If you are unfamiliar with regular expression then you will want to look
at the perlre manpage.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: 13 Sep 1999 07:25:11 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: how to tag a pattern match from a filehandle
Message-Id: <7ri8sn$3i7$1@gellyfish.btinternet.com>

On Sun, 12 Sep 1999 14:56:16 -0400 Tom Kralidis wrote:
> Hi,
> 
> This may seem like a simple question, but I can't seem to figure out how
> to do this.  I have done the same when the filehandle is STDIN, as in:
> 
> while (<>)
> {
>    $east = $1 if (/origin.*easting\s(\d+.\d)/);
>    $north = $1 if (/origin.*northing\s(\d+.\d)/);
>    $lines = $1 if (/lines\s(\d+)/);
> }
> 
> I know the (<>) takes STDIN as 'stuff', but how can I do this if I have
> a file represented by a scalar (eg. $file)?

I assume you mean the contents of the file.

    $east = $1 if ($file =~ /origin.*easting\s(\d+\.\d)/);
    $north = $1 if ($file =~ /origin.*northing\s(\d+\.\d)/);
    $lines = $1 if ($file =~ /lines\s(\d+)/);

Note that I escaped the decimal points in the pattern.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sun, 12 Sep 1999 23:29:55 -0700 (PDT)
From: Michael de Beer <madebeer@igc.apc.org>
Subject: Re: Idea for extracting name from city?
Message-Id: <APC&1'0'50775da7'777@igc.apc.org>

>Below are some sample records to show the problem that I am having:

>Mrs. Joyce Aab Pittsford, NY
>Mrs. Melissa Aab Pittsford, NY
>Mr. Elmer Aamodt Grand Prairie, TX

I think there is probably no perfect way to extract the city names.

However, if you had a list of ALL the cities, or a list of all the names,
you could write a regular expression that would get correctly parse most
of the lines.

Even if you had a list of, for example, 10,000 city -> state pairs
you could make a fairly good heuristic function.  Here is mine, 
although it could be improved.

-Michael

[cut here ] ---------------------------------------------------------------

#!/usr/local/bin/perl5.00404  -w

# setup environment
use strict;
use English;
my (@raw, %states, @clean, @unclean);

# test case
@raw = (  'Mrs. Joyce Aab Pittsford, NY' ,
          'Mrs. Melissa Aab Pittsford, NY',
          'Mr. Elmer Aamodt Grand Prairie, NY',  # ch fr TX -> NY for show
          'Mr. Elmer Aamodt Grand Prairie, TX',  # this one isn't in $states
        );

# create an associative array of pointers to anonymous lists
$states { 'NY' } = [ 'Pittsford' , 'Grand Prairie' ];
$states { 'CA' } = [ 'San Francisco' , 'Los Angeles' ];

# for each person, try out our heuristic.
# if we think we get get a good match, file the person in @clean,
# otherwise, file the person in @unclean

for (@raw) {
 my ($firstpart, $state) = split /\,/;
 $state =~ s/\s+//g;  # clean whitespace after comma from raw data
 warn "not enough parts" and next unless $state; #sanity check

 my $match  = &firstpart_contains_city($firstpart, $states{ $state });
 $match and push @clean, "$match,$state" or push @unclean, $_;
}

# check the results
print join "\n", ("CLEAN", @clean, "\nUNCLEAN",  @unclean,"\n");


sub firstpart_contains_city {
  my ( $foo, $ptrlist ) = (@_);

  # Optimization would be to use 'eval' to create a single regexp that would
  # test all cases for state simultaneously & compile each regexp only once. 
  # However, I'm the wrong kind of lazy, so I'll do it differently.
  for (@$ptrlist) {
     my $city = $_;
     return ( "$1,$2") if $foo =~ m/(.*)\s($city)$/;
  }

  # return nothing if there are not matches
  return (0);
}

exit;

__END__



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

Date: Sun, 12 Sep 1999 21:22:50 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: Need date/time validation on user input.
Message-Id: <MPG.12461bf2d153689f98973f@nntp1.ba.best.com>

Ricky C. Matlak (ricky_c_matlak@mail.northgrum.com) seems to say...
> I have a user entering dates and times, and I must worry about bogus
> entries (i.e. Feb 30th, or say month 99/01/1999), and could use
> something to validate the entries.  Need to account for leap years,

Take a look at Date::Calc and Date::Manip

Date::Manip is big, but it's a lot of fun, too.  People can type in a 
wide range of formats.  Example: 'last tuesday in november' works.  
That's probably overkill for what you need.


-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


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

Date: 13 Sep 1999 07:14:14 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Operating system problems?
Message-Id: <7ri886$3i4$1@gellyfish.btinternet.com>

On Mon, 13 Sep 1999 10:38:44 +1000 elephant wrote:
> Peter Wilford writes ..
>>My question is, is it because I am using Win'98 that I get a load
>>module failurein the NetResource module?  The error seems to be
>>indicating a problem with the 'Hardware Access Layer' (HAL) on the Win
>>NT platform...  Could this be true?  Has anyone else had the same
>>problem?  Any help would be appreciated...
> 
> I can't say what's happening here because I don't know that module .. 
> but I can confirm that I get the same error when trying to use 
> Win32::NetResource on Win98 .. and I get no such error when using it on 
> WinNT
> 

I seem to recall that the module isnt billed to work on Win98.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Mon, 13 Sep 1999 04:47:55 GMT
From: pacman@defiant.cqc.com (Alan Curry)
Subject: Re: Perl / C Memory
Message-Id: <%l%C3.7102$N77.570804@typ11.nn.bcandid.com>

In article <hzUC3.5897$wW2.8602@news.rdc1.ct.home.com>,
Dan Sugalski  <dan@tuatha.sidhe.org> wrote:
>Kai Henningsen <kaih=7OhjZZ$mw-B@khms.westfalen.de> wrote:
>> The way to do that is to not use brk(), but instead use mmap() to get the  
>> memory. Then you can munmap() it again.
>
>Well, OK, you can do that with any OS that implements mmap, but mapping
>files to memory just so you can free it later seems a tad weasly. Plus the

It's not files, it's anonymous mmap. It was made for this

>memory mapped is usually nonswappable (I think) which would tend to chew
>through available RAM pretty quickly...

Where did that FUD come from? Anonymous mmap is swappable, just like brk.

>A better thing to do would be for someone to go ahead and fix the various
>C libraries to hand free'd memory back, but it's been 30 years and
>nobody's done it yet, so I probably shouldn't hold my breath.

They've done it. The solution is anonymous mmap.
-- 
Alan Curry    |Declaration of   | _../\. ./\.._     ____.    ____.
pacman@cqc.com|bigotries (should| [    | |    ]    /    _>  /    _>
--------------+save some time): |  \__/   \__/     \___:    \___:
 Linux,vim,trn,GPL,zsh,qmail,^H | "Screw you guys, I'm going home" -- Cartman


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

Date: Mon, 13 Sep 1999 08:14:07 GMT
From: kik79@my-deja.com
Subject: POP3 module for WINDOWS32i86
Message-Id: <7ribo8$77e$1@nnrp1.deja.com>




Does someone know if there is a POP3 interface
module for windows 32 i86  already compiled?
Where could i find it?



ENRIQUE SANCHEZ


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


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

Date: Mon, 13 Sep 1999 08:14:06 GMT
From: kik79@my-deja.com
Subject: POP3 module for WINDOWS32i86
Message-Id: <7ribo7$77d$1@nnrp1.deja.com>




Does someone know if there is a POP3 interface
module for windows 32 i86  already compiled?
Where could i find it?



ENRIQUE SANCHEZ


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


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

Date: Mon, 13 Sep 1999 01:22:59 -0400
From: Gene Senyszyn <scatt@goes.com>
Subject: rand questions
Message-Id: <37DC8A33.A759B41A@goes.com>

Hi,

I've been searching for a seemingly simple answer to a few questions
using rand().
Is there a way to force rand() to return only integers?

I have an array, and I get the # of items in it, and call rand() using
the # of items as the expression (ie $x = rand $count;)
I then have a print statement that prints the # returned ($x) and the
corresponding position in the array. (print $ARRAY[$x];)

The variable $x gets converted to an integer, however the next random
number can be 4.3333, where the last one was maybe 4.2222, and they both
print the same lines.

Technically, its a random number, but when I print the array item, they
are the same.

Any ways around this?

Thanks in advance,

Gene Senyszyn
scatt@goes.com



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

Date: Mon, 13 Sep 1999 00:38:43 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: rand questions
Message-Id: <MPG.124649dc14041a11989f45@nntp.hpl.hp.com>

In article <37DC8A33.A759B41A@goes.com> on Mon, 13 Sep 1999 01:22:59 -
0400, Gene Senyszyn <scatt@goes.com> says...
> I've been searching for a seemingly simple answer to a few questions
> using rand().
> Is there a way to force rand() to return only integers?

Use the int() function on the result returned by rand().
 
> I have an array, and I get the # of items in it, and call rand() using
> the # of items as the expression (ie $x = rand $count;)
> I then have a print statement that prints the # returned ($x) and the
> corresponding position in the array. (print $ARRAY[$x];)
> 
> The variable $x gets converted to an integer, however the next random
> number can be 4.3333, where the last one was maybe 4.2222, and they both
> print the same lines.
> 
> Technically, its a random number, but when I print the array item, they
> are the same.
> 
> Any ways around this?

If you don't want the same element returned twice, either remove it from 
the array after it is selected (using splice()), or keep a record of 
those elements that have already been selected (using a hash or bit 
vector on their indexes).

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 13 Sep 1999 10:16:31 +0200
From: Joakim Hove <hove@ido.phys.ntnu.no>
Subject: Re: rand questions
Message-Id: <k0nogf7z0o0.fsf@ido.phys.ntnu.no>

Gene Senyszyn <scatt@goes.com> writes:

> I've been searching for a seemingly simple answer to a few questions
> using rand().
> Is there a way to force rand() to return only integers?

Not that I'm aware of, but conversion is simple :

   $random_integer = int rand $maxint;

will return an integer in the interval [0..$maxint-1], which I guess
is what you were after.
 
> The variable $x gets converted to an integer, however the next random
> number can be 4.3333, where the last one was maybe 4.2222, and they both
> print the same lines.

I take it that you consider writing the same array element two times
in a row as some sort of "a bug"? The following little program writes
out all the elements of the array @list in randomised order.

    #!/path/to/perl -w
    
    @list = ('Item1','Item2','Item3','Item4');
    $list_length = @list;
    @index_list = 0..$list_length - 1;

    #
    # We make an extra array @index_list, initially just containing
    # the numbers 0,1,2,...$list_length. Then we randomise this array
    # swapping two and two elements in a random fashion. 
    #
    # If the for - loop below draws two in the first pass we will for
    # instance have the new @index_list = 2,1,0,3.
    #

    for ($i = 0; $i < $list_length; $i++) {
	$index = int rand($list_length);
	$tmp = $index_list[$i];
	$index_list[$i] = $index_list[$index];
	$index_list[$index] = $tmp;
    }
    
    # 
    # Now the @index_list is randomised, and we print out the original
    # list in the order given by the elements in @index_list.
    #

    for ($i = 0; $i < $list_length; $i++) {
	print($list[$index_list[$i]],"\n");
    }
	
I'm sure this can be done in _many_ other, and probably better
ways. But as far as I can see it solves your spesific problem.

HTH - Joakim


-- 
=== Joakim Hove    www.phys.ntnu.no/~hove/     ======================
# Institutt for fysikk  (735) 93637 / 352 GF  |  Skøyensgate 10D    #
# N - 7034 Trondheim    hove@phys.ntnu.no     |  N - 7030 Trondheim #
=====================================================================


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

Date: 13 Sep 1999 08:16:13 GMT
From: rong@news.pgs.com (Ron Grunwald-Computer Programmer PGS Tensor Perth)
Subject: Reading symbolic links
Message-Id: <7ribsd$250$1@news.hstn.tensor.pgs.com>


Hello all Perlers,

I have a simple question to which there is probably a simple answer,
but I couldn't find any answers from the FAQ or the Perl documentation.

I intend to scan through a specified filesystem using the File::Find
module and collect all the symbolic links encountered. The question is,
when a symbolic link is found, how can one determine which file or
directory it is pointing to ?

I was hoping that using lstat() could get me the answer, but I've hit
a dead end instead.

Any suggestions ?


Cheers, Ron.

--------------------------------------------------------------------------
Ron Grunwald               | Usual E-mail         rong@prth.pgs.com
UNIX Programming Section   | Alternate E-mail     r.grunwald@usa.net 
PGS Tensor Pty. Ltd.       | Work Tel.            011 618 9320 9029
 Petroleum Exploration and | IBM Centre, Perth
   Seismic Processing.     |             Western Australia
--------------------------------------------------------------------------



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

Date: Sun, 12 Sep 1999 21:35:44 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: running Perl files on Apache 1.3 running under Windows 95 ?
Message-Id: <MPG.12461effe2e38eda989742@nntp1.ba.best.com>

> From: "Andrew Armstrong" <barm@aarmstrong.fsbusiness.co.uk>
> Does anyone know why Ikeep getting a Forbidden message when trying to run my
> Perl programs ? I am running Apache 1.3 under windows 95 and have Perl 5.005
> installed. I think it may be to do with the httpd.conf file but cannot find
> anything in there that sets restrictions on certain files.Collin Starkweather (collin.starkweather@colorado.edu) seems to say...
> I seem to recall that even on Windows machines, Apache looks for the
> shebang.
> 
> So make sure you have something like
> 
> #!C:\Perl\bin\perl.exe
> 
> at the top of your script.
> 
> Hope this helps!

Not really.  A messed up shebang will cause a 500 error - not Forbidden.

You don't have to use backslashes, either.

I'd be looking more at .htacces and access.conf and I'd look at the 
server error log.  And this has nothing to do with perl.

Collin, it's really hard (at least with Gravity) to reply to your 
message when you post your reply before the original post.


-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


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

Date: 13 Sep 1999 08:22:36 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: running Perl files on Apache 1.3 running under Windows 95 ?
Message-Id: <7ric8c$3k2$1@gellyfish.btinternet.com>

On Mon, 13 Sep 1999 02:32:40 +0100 Andrew Armstrong wrote:
> Does anyone know why Ikeep getting a Forbidden message when trying to run my
> Perl programs ? I am running Apache 1.3 under windows 95 and have Perl 5.005
> installed. I think it may be to do with the httpd.conf file but cannot find
> anything in there that sets restrictions on certain files.
> 

Have you read the section of the Win32 specific FAQ that comes with the
activestate Perl that discusses the configuration of various Web servers
to work with Perl.

If you have read that and still have problems then you might be better off
asking the group comp.infosystems.www.servers.ms-windows as this is an issue
concerning the configuration of the server and not directly to do with Perl.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sun, 12 Sep 1999 21:24:52 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: Searching by date problem.
Message-Id: <MPG.12461c6f9dafbfeb989740@nntp1.ba.best.com>

Adtec (adtec@vic.bigpond.net.au) seems to say...
> I'm finding it difficult to print beyond a certain date when the actual date
> to search for
> may not exist within the source file. ie; a search date could point to a
> Sunday for example, and no work was
> conducted on a Sunday.
> 
> I'm thinking of splitting up the date entered, into three seperated strings
> (day, month and year) and search each string individually using a
> comparitive if statement. ie IF day < day, IF month < month etc..

Yuck.  That's the hard way.

Convert to seconds and compare.

perldoc -f localtime
perldoc Time::Local

-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


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

Date: Mon, 13 Sep 1999 05:32:31 GMT
From: snowhare@long-lake.nihongo.org (Benjamin Franz)
Subject: Re: Searching by date problem.
Message-Id: <P%%C3.761$814.51277@typhoon01.swbell.net>

In article <7rhpa7$ipm$1@m2.c2.telstra-mm.net.au>,
Adtec <adtec@vic.bigpond.net.au> wrote:
>newbie here.
>
>I'm asking the user to enter a date at the prompt, (dd/mm/yy)

I hope you meant dd/mm/yyyy....

>Search a text file for the respective date.
>And print each line beyond that date (until eof)  to a new file.
>
>I'm finding it difficult to print beyond a certain date when the actual date
>to search for
>may not exist within the source file. ie; a search date could point to a
>Sunday for example, and no work was
>conducted on a Sunday.
>
>I'm thinking of splitting up the date entered, into three seperated strings
>(day, month and year) and search each string individually using a
>comparitive if statement. ie IF day < day, IF month < month etc..
>
>surely there must be a library or command(s) of some sort that can do this
>for me......?

Yah. What you want to do is prepend each line with the date formatted 

yyyymmdd Data goes here

then use the Search::Dict module to efficiently find the line you
want to start at.

-- 
Benjamin Franz


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

Date: Mon, 13 Sep 1999 00:31:42 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Searching by date problem.
Message-Id: <MPG.12464835178f56b8989f44@nntp.hpl.hp.com>

In article <P%%C3.761$814.51277@typhoon01.swbell.net> on Mon, 13 Sep 
1999 05:32:31 GMT, Benjamin Franz <snowhare@long-lake.nihongo.org> 
says...
> In article <7rhpa7$ipm$1@m2.c2.telstra-mm.net.au>,
> Adtec <adtec@vic.bigpond.net.au> wrote:
 ...
> >I'm asking the user to enter a date at the prompt, (dd/mm/yy)
> 
> I hope you meant dd/mm/yyyy....

Why, he asked, naively but in all seriousness?

 ...

> Yah. What you want to do is prepend each line with the date formatted 
> 
> yyyymmdd Data goes here

Just because an explicit year designation is needed here for efficient 
sorting or lookup, that is no reason to demand it from the user.

Why add to the confusion between internal and external representations, 
as your 'I hope you neant dd/mm/yyyy....' comment does?  There will be 
no ambiguity in most problem domains.  In those few where there is 
ambiguity, your comment is appropriate, and unambiguous input is 
required.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 13 Sep 1999 08:24:42 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Searching by date problem.
Message-Id: <7ricca$3k5$1@gellyfish.btinternet.com>

On Mon, 13 Sep 1999 12:49:16 +1000 Adtec wrote:
> 
> I'm thinking of splitting up the date entered, into three seperated strings
> (day, month and year) and search each string individually using a
> comparitive if statement. ie IF day < day, IF month < month etc..
> 
> surely there must be a library or command(s) of some sort that can do this
> for me......?
> 

yep.

my ($day,$month,$year) = split /\//, $date;

read about split() in the perlfunc manpage.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sun, 12 Sep 1999 22:20:59 -0700 (PDT)
From: Michael de Beer <madebeer@igc.apc.org>
Subject: Re: UseNet
Message-Id: <APC&1'0'50775da6'53b@igc.apc.org>

Michael Yevdokimov wrote:

> How to read UseNet on the Web? 

http://www.deja.com

>Does anyone knows the url from where I could
>download a Perl script for this subject?

To do a fast search of CPAN, try something like 
perl -MCPAN -e'shell'
cpan> i /NNTP/

http://www.cpan.org/ and its mirrors have:

Search Dejanews and display/download hits that match your query : 

Module          JOHNH/WWW-Search-1.024.tar.gz

To have perl talk to a NNTP news-server:

Distribution    RVA/NNTPClient-0.36.tar.gz
Module          LWP::Protocol::nntp (GAAS/libwww-perl-5.44.tar.gz)
Module          Net::NNTP       (GBARR/libnet-1.0606.tar.gz)

-Michael


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

Date: Mon, 13 Sep 1999 18:15:46 +1000
From: "Andrew Pollock" <apollock@bit.net.au>
Subject: Using DB_File to talk to a Sendmail 8.9.x hash
Message-Id: <37dcb291@news.ausmail.com>

Hi,

I'm trying to read Sendmail 8.9.3's alias hash with DB_File, and I'm not
having much luck. Here's the code I'm using:

use DB_File;

tie %aliases, 'DB_File', "/etc/aliases", "RDONLY", 0640, $DB_HASH || die
"Couldn't do it: $!\n";
foreach (%aliases) {
        print "$_ = %aliases{$_}\n";
}
untie %aliases;

It doesn't fall over, but it doesn't work either...

Just wondering if anyone can help me out.

TIA

Andrew




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

Date: Sun, 12 Sep 1999 21:20:27 -0700
From: "Andy Huang" <andy-huang@mindspring.com>
Subject: where to write perl???
Message-Id: <7rhuad$3jq$1@nntp9.atl.mindspring.net>

when i write C/C++ , i use either Borland or microsoft compiler, but i never
see any compiler for perl, some one told me develop it under win32, but it
is going to be extremely difficult without any editor's help.  Some one tell
me to install linux, but i have tried so many times to install linux and
failed, please tell me a easiet way to develop perl thanx man.




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

Date: Mon, 13 Sep 1999 07:57:43 +0200
From: GiN <wablief@freemail.nl>
Subject: Re: where to write perl???
Message-Id: <37DC9257.5A0DE4CD@freemail.nl>


--------------AF814676D083418466ED5DC3
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Andy Huang wrote:

> when i write C/C++ , i use either Borland or microsoft compiler, but i never
> see any compiler for perl, some one told me develop it under win32, but it
> is going to be extremely difficult without any editor's help.  Some one tell
> me to install linux, but i have tried so many times to install linux and
> failed, please tell me a easiet way to develop perl thanx man.

i personaly use linux to write and use perl
what are you problems when installing linux?

--
#phreak.nl http://www.casema.net/~gin



--------------AF814676D083418466ED5DC3
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Andy Huang wrote:
<blockquote TYPE=CITE>when i write C/C++ , i use either Borland or microsoft
compiler, but i never
<br>see any compiler for perl, some one told me develop it under win32,
but it
<br>is going to be extremely difficult without any editor's help.&nbsp;
Some one tell
<br>me to install linux, but i have tried so many times to install linux
and
<br>failed, please tell me a easiet way to develop perl thanx man.</blockquote>
i personaly use linux to write and use perl
<br>what are you problems when installing linux?
<pre>--&nbsp;
#phreak.nl <A HREF="http://www.casema.net/~gin">http://www.casema.net/~gin</A></pre>
&nbsp;</html>

--------------AF814676D083418466ED5DC3--



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

Date: Mon, 13 Sep 1999 07:10:32 GMT
From: lg@kt.dtu.dk (Lars Gregersen)
Subject: Re: where to write perl???
Message-Id: <37dca1b0.1808635984@news.dtu.dk>

On Sun, 12 Sep 1999 21:20:27 -0700, "Andy Huang"
<andy-huang@mindspring.com> wrote:

>when i write C/C++ , i use either Borland or microsoft compiler, but i never
>see any compiler for perl, some one told me develop it under win32, but it

There _is_ a compiler for Perl, but you probably wont want to try it
right away. Perl is an interpreted language and you need Perl
installed on your computer to run perl programmes.

For windows you will want to look at the distribution you can find at:
www.activestate.com

>is going to be extremely difficult without any editor's help.  Some one tell

It depends on how you define extremely difficult. In the old days you
entered programmes by the use of swtiches.

Mortal programmers do use an editor. This editor do not come with
Perl. The most easy to learn and use editor I have found is Textpad. I
give some URLs below for editors
www.textpad.com
www.editplus.com
www.ultraedit.com

>me to install linux, but i have tried so many times to install linux and
>failed, please tell me a easiet way to develop perl thanx man.

Feel free to install Linux. I have no direct use for it, but like that
I can move my Perl programmes to it should the need arise.


Final comments: You need at least one book about Perl to learn the
language. I suggest "Learning Perl". Perl also comes with a lot of
documentation. It includes a FAQ. Read it!

  Lars


 ------------------------------
Lars Gregersen (lg@kt.dtu.dk)
http://www.gbar.dtu.dk/~matlg


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

Date: 13 Sep 1999 08:33:27 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: where to write perl???
Message-Id: <7ricsn$3k9$1@gellyfish.btinternet.com>

On Sun, 12 Sep 1999 21:20:27 -0700 Andy Huang wrote:
> when i write C/C++ , i use either Borland or microsoft compiler, but i never
> see any compiler for perl, some one told me develop it under win32, but it
> is going to be extremely difficult without any editor's help.  Some one tell
> me to install linux, but i have tried so many times to install linux and
> failed, please tell me a easiet way to develop perl thanx man.
> 

Where does one start ?

First of all you will need to obtain the appropriate Perl for your platform
if you are using Win32 then you should look at <http://www.activestate.com> -
this will install all of the documentation for Perl as HTML files via a
shortcut in the Start Menu - you will need to read this stuff.

Secondly you will need a text editor - Notepad will suffice at a pinch but it
is far from ideal - you should look at :

       <http://www.perl.com/reference/query.cgi?editors>

Thirdly you will need a book - check out:

       <http://www.perl.com/reference/query.cgi?books>

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: 13 Sep 1999 04:49:27 GMT
From: Dan Nguyen <nguyend7@msu.edu>
Subject: Re: WHILE(1) {}
Message-Id: <7rhvon$mhj$2@msunews.cl.msu.edu>

Michael Yevdokimov <flanker@sonnet.ru> wrote:
: How to run a Perl script from a Web browser so it will be working
: independently from me? I have a script which can do a work of a "spy" for
: the files in directory.. Well, I ran it from a Web browser. But when I
: closed it, the script also finished it work. So, how to run it so it will be

I don't fully understand what you want.  But my best guess is you have
a cgi program on a web browser which you don't have telnet access to,
and are checking files in a directory on there.

Anyways.... use fork.



-- 
       Dan Nguyen          | It is with true love as it is with ghosts;
    nguyend7@msu.edu       | everyone talks of it, but few have seen it.
     dnn@debian.org        |               -Maxime De La Rochefoucauld
            25 2F 99 19 6C C9 19 D6  1B 9F F1 E0 E9 10 4C 16


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

Date: Mon, 13 Sep 1999 03:30:17 GMT
From: "David Clarke" <clarked@hunterdon.csnet.net>
Subject: Re: win32 disk formatting
Message-Id: <dd_C3.70$gN.2248569@news.goodnet.com>


Michael Nguyen wrote in message ...
>I'm trying to get an application I am writing to allow a user to format a
>disk in the floppy drive on a win 95/98 .  I thought of using the system
>command 'format a:' but how do I know if the formatting resulted in a
>clean disk (w/o bad sectors)?

open (INPUT, '>c:/input.txt');
# First line, Enter to begin formatting
# Second Line, Disk label (can be just newline for none)
# Third line, N)o to format another
# Fourth line, exit to Command.com
print INPUT <<"END_INPUT";

LABEL
N
EXIT
END_INPUT
close INPUT;
$results = `type c:\input.txt | command.com /c format a:`;
$results =~ m/what_your_looking_for/;
# Yeah, it's ugly, but what do you expect for a Windoze shell?





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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq" from
almanac@ruby.oce.orst.edu. 

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


------------------------------
End of Perl-Users Digest V9 Issue 774
*************************************


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