[10038] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3631 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 3 22:05:37 1998

Date: Thu, 3 Sep 98 19:00:19 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 3 Sep 1998     Volume: 8 Number: 3631

Today's topics:
    Re: comp.lang.perl.windows.misc (Dustin Puryear)
    Re: Copying multiple dimension hashes. <rick.delaney@shaw.wave.ca>
    Re: does there exist some sort of 'prettyprint'? (Mike Wescott)
        file copying <sales@madm.com>
    Re: Forum addons ie: bad words filter (Alastair)
    Re: How do I create a directory only if it doesn't exis (Gabor)
    Re: How to remove the file's extention using perl (Gabor)
    Re: In search of Intellegint Life... HELP!! <dgris@rand.dimensional.com>
    Re: Is perl millennium compliant ? (Andre L.)
    Re: Is perl millennium compliant ? <dean2@mail.biol.sc.edu>
    Re: loosing variable values in a large program (Alastair)
        ndbm problem <davis@nod.lvl.pri.bms.com>
        object refs and memory handling <sztaylor@alaska.net>
        online perldoc gateway help... buckybeaver73@yahoo.com
    Re: opening web-page with perl (Neil McIver)
    Re: Perl documentation (Jonathan Stowe)
    Re: PerlScript: reading/writing files? <fitzpat@hevanet.com>
        Problem with Apache httpsd w/mod_perl (Alan E. Derhaag)
        reading line from database <dan@fearsome.net>
    Re: sockets (Jonathan Stowe)
        SSL encryption <dunz@tingley.net>
    Re: Tom Phoenix: ANSWERS WANTED! <gnat@frii.com>
        Update:  Random Passwords <sneaker@sneex.fccj.org>
    Re: win32, dbi, and msql <metcher@spider.herston.uq.edu.au>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Fri, 04 Sep 1998 00:26:07 GMT
From: *NO*dpuryear*SPAM*@usa.net (Dustin Puryear)
Subject: Re: comp.lang.perl.windows.misc
Message-Id: <35eecbee.6157764@news.surfree.com>

On 26 Aug 1998 18:24:44 GMT, gbacon@cs.uah.edu (Greg Bacon) wrote:

>I don't believe that there is nearly the proportion of such rude Unix
>users.  Regardless of the proportion for Mac users, they're very small
>in number compared to Unix and Win32.
>
>When you consider that Win32 people are mostly rude or clueless (usually
>both) and that there are lots of them, we lose doubly.  I'd be more than

Whatever.

Regards, Dustin

======================================================
Dustin Puryear, student, Louisiana State University
------------------------------------------------------
dpuryear@usa.net * ICQ 6644253
Help Crack Government Encryption: www.distributed.net
======================================================


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

Date: Thu, 03 Sep 1998 21:34:40 GMT
From: Rick Delaney <rick.delaney@shaw.wave.ca>
Subject: Re: Copying multiple dimension hashes.
Message-Id: <35EF0CF7.25FBF27@shaw.wave.ca>

[posted & mailed]

Michael Bowler wrote:
> 
> Can someone please tell me why copying a single dimension hash 
> actually creates a new one, whereas copying a multi-dimensional hash 
> copies by reference.  Does perl have a method to perform actual copies 
> of hash trees or do I have to write my own recursive routine?
> 

Both data structures actually get copied the same way.  When you do

    %hash2 = %hash1

you are creating a new hash with copies of the keys and values of
%hash1.  The difference is that with a "multi-dimensional" hash, the
values are references, either to real or anonymous hashes.  So even
though you now have two different hashes, their values refer to the same
data structures.

> $hash1{'one'}{'i'} = 1;
> $hash1{'one'}{'ii'} = 2;
> %hash2 = %hash1;
 ...
> $hash1{'one'}{'i'} = 3;
> print "Secondary hash1 key/vals: one-$hash1{'one'}{'i'} 
>    two-$hash1{'one'}{'ii'}\n";
> print "Secondary hash2 key/vals: one-$hash2{'one'}{'i'}
>    two-$hash2{'one'}{'ii'}\n";
> ==============================================================
 ...
> Secondary hash1 key/vals: one-3 two-2
> Secondary hash2 key/vals: one-3 two-2    <---Copied the 3 into hash2.

In this case, the 3 was not copied into %hash2, but rather into the
anonymous hash referred to by both $hash1{'one'} and $hash2{'one'}.

If you want to make copies of the entire structure, you will have to
copy the hashes contained in %hash1 as well %hash1 itself.

There may be a module to do this, but if not it shouldn't be too hard.

HTH

-- 
Rick Delaney
rick.delaney@shaw.wave.ca


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

Date: 03 Sep 1998 17:27:05 -0400
From: wescott@cygnus.ColumbiaSC.NCR.COM (Mike Wescott)
Subject: Re: does there exist some sort of 'prettyprint'?
Message-Id: <x4lno0evkm.fsf@cygnus.ColumbiaSC.NCR.COM>

In article <35EECD75.11A6B515@dfki.de> Peter Rullmann writes:
> does there exist a function like print, but which also prints out whole
> datastructures [...]

Look at the Data-Dumper module.

-- 
	-Mike Wescott
	 mike.wescott@ColumbiaSC.NCR.COM


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

Date: Thu, 3 Sep 1998 16:47:15 -0700
From: "Doyle Johnson" <sales@madm.com>
Subject: file copying
Message-Id: <6snaf9$ta$1@nnrp03.primenet.com>

   Hi all,

   First I would like to thank Faisal Nasim for his speedy reply to my last
question.. I have it working fine now... Thanks!

   Now for question number 2:

 I need to be able to copy SPECIFIC files from one directory to another and
set the permissions.... what would be the command and proper syntax to get
this done?

Thanks

Doyle Johnson





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

Date: Thu, 03 Sep 1998 23:55:47 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: Forum addons ie: bad words filter
Message-Id: <slrn6uueqh.59.alastair@calliope.demon.co.uk>

'V)ReTK' <socrates@uswest.net> wrote:
>need some help installing two addons to working cgi wwwboard x2
>badwords check & preview (edit msg's before post)
>
>
>begin 666 badword.txt
>M0T1!($-E;G-O<CH@075T;RU$971E8W0@(D)!1"(@5V]R9',-"D-$02!#96YS
>`
[SNIP]
>end
>

This is a joke, right?

-- 

Alastair
work  : alastair@psoft.co.uk
home  : alastair@calliope.demon.co.uk


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

Date: 3 Sep 1998 21:44:45 GMT
From: gabor@vmunix.com (Gabor)
Subject: Re: How do I create a directory only if it doesn't exists
Message-Id: <slrn6uu3fq.h7.gabor@guava.vmunix.com>

In comp.lang.perl.misc, Rolf Rettinger <rolf.rettinger@desy.de> wrote :
# Hi,
# 
# is there any function like sysopen for a file to create a directory only if
# it doesn't exists?

Why don't you try and create it regardless.  mkdir will fail if a directory
or file by that name already exists.  That's the point, isn't it?


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

Date: 3 Sep 1998 21:38:21 GMT
From: gabor@vmunix.com (Gabor)
Subject: Re: How to remove the file's extention using perl
Message-Id: <slrn6uu33s.h7.gabor@guava.vmunix.com>

In comp.lang.perl.misc, wsayegh@lynx.neu.edu <wsayegh@lynx.neu.edu> wrote :
# Well I have a simple PERL question.. I am just learning PERL so please be easy
# on me. OK.. now how could I write a function that removes any extention from
# the file's name. EX:
# 
# index.htm => index

s/\.[^.]+$//;


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

Date: Thu, 03 Sep 1998 22:14:43 GMT
From: Daniel Grisinger <dgris@rand.dimensional.com>
Subject: Re: In search of Intellegint Life... HELP!!
Message-Id: <6sn3k1$1kr$1@rand.dimensional.com>

[posted to comp.lang.perl.misc and mailed to the cited author]

In article <xdDH1.51$k6.330658@news.shore.net>
Scratchie <upsetter@ziplink.net> wrote:

>There's no reason not to put the "1" at the end of your file, and no
>reason (I can think of) to add any code after it at a later date.

Here you go :-).

version 0.001

    package SomeModule;

    sub new {
      return bless {}, shift;
    }
    1

No problems with this.  It compiles and runs fine because
perl doesn't need the trailing semi-colon for the last
statement in a file.  

After time passes and your development is complete you
go back and add documentation to your new module (you
do add documentation, right :-).  Now it looks like this

version 1.000

    package SomeModule;

    sub new {
     return bless {}, shift;
    }

    1

    =pod
    
    Your docs here

    =cut

All of a sudden, attempting to use your module causes
it to blow up because perl sees (1 = pod) which is
clearly invalid.

dgris
-- 
Daniel Grisinger        dgris@perrin.dimensional.com
`C++ gives me the willies.  Physical willies.  I take
 medication for it.'
                    Kurt Starsinic on p6p


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

Date: Thu, 03 Sep 1998 17:46:43 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: Is perl millennium compliant ?
Message-Id: <alecler-0309981746430001@dialup-641.hip.cam.org>

In article <35EEB1F2.34BD@boat.bt.com>, georgelj@boat.bt.com wrote:

> Does snybody knwo if the current releases of perl have been certified
> for millennium compliance ?

We don't know. We're holding our breath till Jan. 1, 2000, and hoping for
the best.

Andre


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

Date: 03 Sep 1998 17:43:43 -0400
From: Dean Pentcheff <dean2@mail.biol.sc.edu>
Subject: Re: Is perl millennium compliant ?
Message-Id: <m3hfyo6fe8.fsf@mail.biol.sc.edu>

Les George <georgelj@boat.bt.com> writes:
> Does snybody knwo if the current releases of perl have been certified
> for millennium compliance ?
> 
> Les George
> BT WebWorld

Hmmm... Let's see:

    #!/usr/bin/perl -w
    use strict;
    my(@date_sequence) = ( 991229, 991230, 991231, 000101 );
    my($previous) = undef;
    for (@date_sequence) {
        if (defined($previous)) {
            if ($_ > $previous) {
                print "OK on $previous vs. $_\n";
            } else {
                print "Bummer.  Y2K failure on $previous vs. $_\n";
            }
        }
        $previous = $_;
    }
    
    
Output:
    
    [whizbang]% perl y2k-chkitout
    OK on 991229 vs. 991230
    OK on 991230 vs. 991231
    Bummer.  Y2K failure on 991231 vs. 65


Guess not.  Pity.

-Dean
-- 
N. Dean Pentcheff                                          <pentcheff@acm.org>
Biological Sciences, Univ. of South Carolina, Columbia SC 29208 (803-777-7068)


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

Date: Thu, 03 Sep 1998 23:54:34 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: loosing variable values in a large program
Message-Id: <slrn6uueo8.59.alastair@calliope.demon.co.uk>

sabhay@my-dejanews.com <sabhay@my-dejanews.com> wrote:
>I am facing a problem of loosing variable values. In a large program a
>variable looses its value in between unless I redifne that variable with new
>name.
>
>Any soultion this problem ?
>
>
>Thanks in advance
>
>
>Abhay

There's something wrong with line 11.

-- 

Alastair
work  : alastair@psoft.co.uk
home  : alastair@calliope.demon.co.uk


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

Date: 03 Sep 1998 10:53:20 -0400
From: Malcolm Davis <davis@nod.lvl.pri.bms.com>
Subject: ndbm problem
Message-Id: <xo2u32p9rj3.fsf@nod.lvl.pri.bms.com>

I am building an application using ndbm and have run into a problem.
When I am running my Perl script which initially fills the database 
it runs fine for a while and then apparently during what should be a
dbm_store call the program seems to go off into an infinite loop.  The
database file's modification time keeps getting updated, but the file's
contents never change.

At first I thought this was a consequence of the file just getting too
large.  So instead of using the deprecated dbmopen I wanted to use the
ndbm64 libraries.  So I copied the NDBM_File subdirectory to
NDBM64_File and appended 64 to all of the dbm_xxx system function
references.  And surprisingly enough everything seems to work fine on
a small scale test.  But still when I start pulling in all of the
data, it runs for a long time seemingly okay and then it hangs.

I do not know whether this is a problem with Perl's tie mechanism or
with SGI's ndbm implementation, or probably most likely with my own
stupidity.  I am trying to side step the Perl issue by rewriting the
initialization program in C, but I'm hoping someone might know an
immediate solution (e.g. needed Perl or SGI patch) or at least have an
idea about how I could track this down.

Thanks,
Malcolm


Here are some of my specifics:

SGI Onyx R4400 processors at IRIX 6.2

Summary of my perl5 (5.0 patchlevel 4 subversion 4) configuration:
  Platform:
    osname=irix, osvers=6.2, archname=IP22-irix
    uname='irix mendel 6.2 03131015 ip22 '
    hint=recommended, useposix=true, d_sigaction=define
    bincompat3=y useperlio=undef d_sfio=undef
  Compiler:
    cc='cc -32', optimize='-O', gccversion=
    cppflags='-32 -D_BSD_TYPES -D_BSD_TIME -I/usr/local/include -DLANGUAGE_C'
    ccflags ='-32 -D_BSD_TYPES -D_BSD_TIME -Olimit 3100 -I/usr/local/include -DLANGUAGE_C'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    voidflags=15, castflags=1, d_casti32=define, d_castneg=undef
    intsize=4, alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='cc -32', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib /lib
    libs=-lm -lc
    libc=/usr/lib/libc.so, so=so
    useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-KPIC', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl): 
  Built under irix
  Compiled at Aug 27 1998 15:30:18
  @INC:
    /usr/local/lib/perl5/IP22-irix/5.00404
    /usr/local/lib/perl5
    /usr/local/lib/perl5/site_perl/IP22-irix
    /usr/local/lib/perl5/site_perl
    .

-- 
Malcolm E. Davis <mailto:davism@bms.com>
H23-07; Bristol-Myers Squibb; P.O.Box 4000; Princeton, NJ 08543-4000
Phone: 609-252-4324   FAX: 609-252-6030
LV H.3812D


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

Date: Thu, 03 Sep 1998 22:11:29 GMT
From: "Simon Taylor" <sztaylor@alaska.net>
Subject: object refs and memory handling
Message-Id: <luEH1.10$Dn6.322552@binary.alaska.net>

Hello,

Question 1:
I'm curious how perl handles re-assignment of object refs?  For example:

$objRef = class->new();
$objRef = $objRef->subReturnsNewInstance();

Is the memory allocated for the orginal instance of class "orphaned" in this
case?  If yes do I need to write a "copy constructor" as in C++, or is there
a different perl-style solution?

Question 2:
I'm developing dynamic web content using perl and want to be able to pass
around a variable (or some container) to collect error messages for
informative recovery (i.e., the end user has an error to report, instead of
"it's broke").  I briefly looked through CPAN and didn't see any specialized
classes, etc. to implement this.  Does anyone have suggestions?

Thanks,

Simon Taylor





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

Date: Thu, 03 Sep 1998 22:42:14 GMT
From: buckybeaver73@yahoo.com
Subject: online perldoc gateway help...
Message-Id: <6sn606$krf$1@nnrp1.dejanews.com>

  Hi all.... I am **trying** to create an online gateway to the perldoc
function. My problem is that I can't get the perldoc to run under a CGI
script. If I write the app and run it from a command line it runs as
expected. If I run it from a browser it won't run. I even copied perldoc into
my cgi-bin directory because it was under /usr/bin/perldoc. Am I missing
other functions that the perldoc uses? Any help is appreciated... BTW, if I
do a man the same way I am doing the perldoc in my script it works fine...

Thanks in advance,
Justin


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Fri, 04 Sep 1998 00:13:37 GMT
From: neil@cjmciver.org (Neil McIver)
Subject: Re: opening web-page with perl
Message-Id: <RgGH1.156$Np1.460066@newsread.com>

In article <35ED71B0.3D5C@iki.fi-SPAM-OFF>, kari.nevalainen@iki.fi-SPAM-OFF says...
>If I would like to open my English homepage to people who does NOT come
>from Finland and open my Finnish homepage to people who do.
>
>How should I program that with Perl?

The best you could do is invoke a server side include that
would inspect the environment variable REMOTE_HOST and see if
it ends with the country id for Finland (fi).  If it does
then the program should proceed to print the Finnish version.
If not, English.  I'm not sure what percentage of domain names 
in Finland end in "fi", so this may not work too well.

If you know of classes of IP addresses that are specific to 
Finland, you could compare those to the var REMOTE_ADDR and do 
the same thing.

Neil




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

Date: Thu, 03 Sep 1998 22:11:23 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Perl documentation
Message-Id: <35ef0ada.2268732@news.btinternet.com>

On Thu, 03 Sep 1998 21:00:02 GMT, David Hawker wrote :

>On Sun, 30 Aug 1998 00:14:58 GMT, Gellyfish@btinternet.com (Jonathan Stowe)
>felt the need to post:
>
>>On Sat, 29 Aug 1998 14:44:33 GMT, David Hawker wrote :
>>
>>>I don't think Windows 3.1 had a built-in search facility. Neither did
>>>MS-DOS. That's how deprived we are (or were).
>>
>>I dunno, I've got Caldera OpenDos 7.01, nee DR-DOS here and the FIND
>
>Win3.1 came with DOS 6, Win95 comes with DOS 7. Was there a FIND function
>in DOS 6?
>

C:\OPENDOS>find /?
FIND R1.47    Find text string
Copyright (c) 1987,1996 Caldera, Inc.  All rights reserved.

FIND [/Help] [options] "search string"
[@][[d:][path]filename[.ext]...]
  /B            change display format
  /C            show only the number of lines that contained "string"
  /F            show only the name of files that contain "string"
  /I            case-insensitive search (default)
  /N            display line numbers
  /P            pause after each page is displayed
  /S            search files in sub-directories
  /U            case-sensitive search (e.g. 'A' does not match 'a')
  /V            display lines not containing "string"

  @             the filename that follows is the name of a file list
  d:            drive which find is to search
  path          directory where search is to begin
  filename.ext  file to be searched (wildcards allowed)

Multiple files may be specified on the command line.
If no files are specified find will read from standard input.

I think that this is similar to the one in DOS 6 but it actually
works.

/J\
-- 
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Thu, 3 Sep 1998 17:55:40 -0700
From: Brad Fitzpatrick <fitzpat@hevanet.com>
To: Matt Kruse <mkruse@rens.com>
Subject: Re: PerlScript: reading/writing files?
Message-Id: <Pine.BSI.3.93.980903175323.21690B-100000@hevanet.com>

I believe it's intentional, just as it is in VBScript and JScript, the
idea being that the authors can use the same Scripting Engine on both the
server side and client side and have it still be "safe".

To overcome that limitation on the server side though, there is some
object like "FileSystemObject"... it's pretty simplistic but it works.

You'll have to search from there.  This is more of an IIS/ASP question I'm
afraid.

On Thu, 3 Sep 1998, Matt Kruse wrote:

> Using the latest PerlScript with IIS4 in ASP, I cannot open files
> for reading or writing.
> 
> I haven't found any documentation on this.
> Is this a known problem/bug? 
> Or is it intentional for some reason?
> 
> --
> Matt Kruse
> mkruse@rens.com
> Renaissance Worldwide
> 
> 



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

Date: 03 Sep 1998 16:41:44 -0400
From: aedmis@rsf.dankaind.com (Alan E. Derhaag)
Subject: Problem with Apache httpsd w/mod_perl
Message-Id: <tzn28h7wtz.fsf@rsf.dankaind.com>

--Multipart_Thu_Sep__3_16:41:44_1998-1
Content-Type: text/plain; charset=US-ASCII

I used the ACAPI method to compile Apache-1.3.1 and mod_perl
(Apache/1.3.1 Ben-SSL/1.20 (Unix) mod_perl/1.15) and all went well
until until `make test'.  The module testing fails immediately and the
server has exited with the following contents to the
t/logs/mod_perl_error_log error log:

Use of uninitialized value at /usr/lib/perl5/Cwd.pm line 117.
   (55 lines of the same above)
readdir(..): No such file or directory at /usr/lib/perl5/Cwd.pm line 120.
[Thu Sep  3 13:18:43 1998] [error] Uncaught exception from user code:
        Uncaught exception from user code:
        pre-load of `/perl/ri.pl' failed, status=404
        require docs/startup.pl called at (eval 2) line 1
        eval 'require \'docs/startup.pl\'
;' called at /var/source/mod_perl-1.15/t//docs/startup.pl line 0
        eval 'require \'docs/startup.pl\'
;' called at /var/source/mod_perl-1.15/t//docs/startup.pl line 0

Require of Perl file `docs/startup.pl' failed, exiting...

I examined the t/net/perl directory and find the file attempting to be
accessed is `uri.pl'.  When I rename this one the next test comes up
with `/perl/write.pl' as the file at fault when the real name is
rwrite.pl.  The script `docs/startup.pl' looks good (included for
reference) and I can't figure out how it is truncating the first
character from the file name.  I can't duplicate the problem when
avoiding the Apache::* stuff in a test script (using Cwd, DirHandle,
etc).

Any idea where I go from here?


--Multipart_Thu_Sep__3_16:41:44_1998-1
Content-Type: application/octet-stream
Content-Disposition: attachment; filename="startup.pl"
Content-Transfer-Encoding: quoted-printable

BEGIN {
    #./blib/lib:./blib/arch
    use ExtUtils::testlib;

    use lib './t/docs';
    require "blib.pl" if -e "./t/docs/blib.pl";
    $Apache::ServerStarting or warn "Server is not starting !?\n";
}

eval {
    require Apache::PerlRunXS;
}; $@ =3D '' if $@;

{
    last;
    Apache::warn("use Apache 'warn' is ok\n");

    my $s =3D Apache->server;

    my($host,$port) =3D map { $s->$_() } qw(server_hostname port);
    $s->log_error("starting server $host on port $port");

    my $admin =3D $s->server_admin;
    $s->warn("report any problems to server_admin $admin");
}

#use HTTP::Status ();
#use Apache::Symbol ();
#Apache::Symbol->make_universal;

$Apache::DoInternalRedirect =3D 1;
$Apache::ERRSV_CAN_BE_HTTP  =3D 1;

#warn "ServerStarting=3D$Apache::ServerStarting\n";
#warn "ServerReStarting=3D$Apache::ServerReStarting\n";

#use Apache::Debug level =3D> 4;
use mod_perl 1.03_01;

if(defined &main::subversion) {
    die "mod_perl.pm is broken\n";
}

if($ENV{PERL_TEST_NEW_READ}) {
    *Apache::READ =3D \&Apache::new_read;
}

$ENV{KeyForPerlSetEnv} eq "OK" or warn "PerlSetEnv is broken\n";

#test Apache::RegistryLoader
{
    use Apache::RegistryLoader ();
    use DirHandle ();
    use strict;
    use diagnostics;
    =

    my $rl =3D Apache::RegistryLoader->new(trans =3D> sub {
	my $uri =3D shift; =

	$Apache::Server::CWD."/t/net${uri}";
    });

    my $d =3D DirHandle->new("t/net/perl");

    for my $file ($d->read) {
	next if $file eq "hooks.pl"; =

	next unless $file =3D~ /\.pl$/;
	Apache->untaint($file);
	my $status =3D $rl->handler("/perl/$file");
	unless($status =3D=3D 200) {
	    die "pre-load of `/perl/$file' failed, status=3D$status\n";
	}
    }
}

#for testing perl mod_include's

$Access::Cnt =3D 0;
sub main::pid { print $$ }
sub main::access { print ++$Access::Cnt }

$ENV{GATEWAY_INTERFACE} =3D~ /^CGI-Perl/ or die "GATEWAY_INTERFACE not se=
t!";

#will be redef'd during tests
sub PerlTransHandler::handler {-1}

#for testing PERL_HANDLER_METHODS
#see httpd.conf and t/docs/LoadClass.pm

use LoadClass ();
sub MyClass::method ($$) {
    my($class, $r) =3D @_;  =

    #warn "$class->method called\n";
    0;
}

sub BaseClass::handler ($$) {
    my($class, $r) =3D @_;  =

    #warn "$class->handler called\n";
    0;
}

{
    package BaseClass;
    #so 5.005-tobe doesn't complain:
    #No such package "BaseClass" in @ISA assignment at ...
}


$MyClass::Object =3D bless {}, "MyClass";
@MyClass::ISA =3D qw(BaseClass);

#testing child init/exit hooks

sub My::child_init {
    my $r =3D shift;
    my $s =3D $r->server;
    my $sa =3D $s->server_admin;
    $s->warn("[notice] child_init for process $$, report any problems to =
$sa\n");
}

sub My::child_exit {
    warn "[notice] child process $$ terminating\n";
}

sub My::restart {
    my $r =3D shift;
    my $s =3D $r->server;
    my $sa =3D $s->server_admin;
    push @HTTP::Status::ISA, "Apache::Symbol";
    HTTP::Status->undef_functions;
}

sub Apache::AuthenTest::handler {
    use Apache::Constants ':common';
    my $r =3D shift;

    $r->custom_response(AUTH_REQUIRED, "/error.txt");

    my($res, $sent_pwd) =3D $r->get_basic_auth_pw;
    return $res if $res; #decline if not Basic

    my $user =3D lc $r->connection->user;
    $r->notes("DoAuthenTest", 1);

    unless($user eq "dougm" and $sent_pwd eq "mod_perl") {
        $r->note_basic_auth_failure;
        return AUTH_REQUIRED;
    }

    return OK;                       =

}

sub My::ProxyTest::handler {
    my $r =3D shift;
    unless ($r->proxyreq and $r->uri =3D~ /proxytest/) {
	#warn sprintf "ProxyTest: proxyreq=3D%d, uri=3D%s\n",
	$r->proxyreq, $r->uri;
    }
    return -1 unless $r->proxyreq;
    return -1 unless $r->uri =3D~ /proxytest/;
    $r->handler("perl-script");
    $r->push_handlers(PerlHandler =3D> sub {
	my $r =3D shift;
	$r->send_http_header("text/plain");
	$r->print("1..1\n");
	$r->print("ok 1\n");
	$r->print("URI=3D`", $r->uri, "'\n");
    });
    return 0;
}

if(Apache->can_stack_handlers) {
    Apache->push_handlers(PerlChildExitHandler =3D> sub {
	warn "[notice] push'd PerlChildExitHandler called, pid=3D$$\n";
    });
}

END {
    warn "[notice] END block called for startup.pl\n";
}

package Destruction;

sub new { bless {} }

sub DESTROY { =

    warn "[notice] Destruction->DESTROY called for \$global_object\n" =

}

#prior to 1.3b1 (and the child_exit hook), this object's DESTROY method w=
ould not be invoked
$global_object =3D Destruction->new;

1;

--Multipart_Thu_Sep__3_16:41:44_1998-1
Content-Type: text/plain; charset=US-ASCII



--Multipart_Thu_Sep__3_16:41:44_1998-1
Content-Type: text/plain; charset=US-ASCII

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
=-  Alan E. Derhaag   Remote programmer for Danka Corporate  -=
=-    Business phone: (425) 643-7126  FAX: (425) 644-2369    -=
=-       alan_derhaag@danka.com  aderhaag@wolfenet.com       -=
=-            http://www.wolfenet.com/~aderhaag/             -=
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

--Multipart_Thu_Sep__3_16:41:44_1998-1--


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

Date: Fri, 4 Sep 1998 01:08:42 +0100
From: "Daniel Adams" <dan@fearsome.net>
Subject: reading line from database
Message-Id: <904867707.14476.0.nnrp-11.c2deb1c5@news.demon.co.uk>

Hi,

I have a text database in the form:

credits|foo|bar\n
credits|foo|bar\n

I am trying to write a subroutine for a script which would select a line
(based upon "\n" seperators) from the file based upon a variable given
previously in the script and print that information to the screen, and make
it available for editing. For example, if $requiredLine was set to "17" in
the script, then the subroutine would go to line 17 in the database and read
in its values. Here is what I have so far, but I would appreciate any
pointers here:

$requiredLine = 17; # or whatever

open(FILE, "$credit_database") || die "Can't open $credit_database: $!";

 if
OCK_EX){ 
      flock(FILE, $LOCK_EX);
 }

while(<FILE>) {
    chop;
    @all = split(/\n/);

    foreach $fileLine (@all) {
        ($credits, $foo, $bar) = split(/|/, $fileLine);
    }
    while ($fileLine eq "$requiredLine") {
        print "$credits, $foo, $bar\n";
    }
    continue {
        # do stuff
    }
}
 
close(FILE);

--

Dan Adams
dan@fearsome.net
http://fearsome.net





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

Date: Thu, 03 Sep 1998 22:11:27 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: sockets
Message-Id: <35ef11d6.4056595@news.btinternet.com>

On Thu, 03 Sep 1998 02:55:47 +0300, Ori Shmolovsky wrote :

>Hello
>
>My name is Ori Shmolovsky and I have a question:
>Is it possible using perl to create a socket to a server lets say
>members.xoom.com and read a file from that server lets say
>/aladdin1/index.html? If yes can you tell me how?
>

You should look at perlfaq8 that covers this sort of stuff - there are
examples in there that will help you on your way.

However in reallity you most probably want to use the module
LWP::Simple available as part of the libwww-perl package from CPAN.

/J\
-- 
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Thu, 03 Sep 1998 23:14:52 GMT
From: Kevin Bynum <dunz@tingley.net>
Subject: SSL encryption
Message-Id: <35EEA9F0.332C@tingley.net>

Does anyone know how to add support for SSL encryption.  I need to
automate a SSL encrypted site for datebase queries.  I am currently
using the LWP library and need to add support for SSL or any info about
accessing a site that is at 'https://dps1.easysabre.com/ezsabre.ctl'
with perl.

Please E-mail me at; 
Dunz@tingley.net
As I am a newbie to perl and web programing in general and do check this
page regulary.


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

Date: 03 Sep 1998 16:36:08 -0600
From: Nathan Torkington <gnat@frii.com>
Subject: Re: Tom Phoenix: ANSWERS WANTED!
Message-Id: <5q4suoako7.fsf@prometheus.frii.com>

nvp@shore.net (Nathan V. Patwardhan) writes:
> It's unfortunate that people read the posting as an attack on Tom's
> character, which it was not.  On one hand, people cannot be honest
> with themselves about the lack of content or depth in a pre-canned
> response, and apparently they cannot be convinced otherwise.  On the
> other hand, Tom is quite personable and largely unflappable.

I agree that it's sometimes stunning to read a day's worth of Tom's
"this is in the FAQ!  HTH!" responses.  I have in the past also
accused him of being too indirect in his answers.

I, like you, appreciate Tom's indefatigable pursuit of the education
of innocents, and I wish I knew the balance to strike between too
oblique and too molly-coddling.

I guess it's time to write that Perl-based newsreader I've been
dreaming of, and tell it to kill any thread where rootbeer says "hope
this helps!"

Hope this hurts!

Nat


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

Date: Thu, 03 Sep 1998 20:15:52 -0400
From: Bill 'Sneex' Jones <sneaker@sneex.fccj.org>
Subject: Update:  Random Passwords
Message-Id: <35EF3138.6D2B7ED2@sneex.fccj.org>

My other passwd code I posted starts generating previously
created patterns within less than 10,000 interations.

The below code hasn't repeated in more than 300,000
interations, which I definitely like better :]

Here it is for comment:

#!/usr/bin/perl -w

use strict;
use diagnostics;

# Digit Place...
my $first;
my $second;
my $pw = '';

# General Counters...
my $w = 0;
my $x;
my $y = '';
my $z = '';

# Test Password
$pw =  shift || rand(time); # Or user supplied...

# Program control...
while(1) {
  $first  = (((rand(time)) >> (11 + 1 - 8)) & ~(~0 << 7));
  $second = (((rand(time)) >> (11 + 1 - 8)) & ~(~0 << 7));

  last if ($x++ > (16*((2**31)-1))); # Loop millions...
  # print "$first $second\n";

  next unless chr($first)  =~ /[a-zA-Z0-9]/;
  next unless chr($second) =~ /[a-zA-Z0-9]/;
  $pw = chr($first) . substr(rand(time), 0, 6) . chr($second);

  # crypt w/two letter seed...
  $z = crypt($pw, ("".chr($first).chr($second).""));
  print " - Found match: $z - Total: ++$w" if (index($y, $z) > -1);
  $y .= " " . $z;
  print "\nLooking \@ Plain: $pw, Crypt: $z : Try: $x.";
}

-Sneex- 
__________________________________________________________________
Bill Jones | FCCJ Webmaster | Murphy's Law of Research:
           Enough research will tend to support your theory.


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

Date: Fri, 04 Sep 1998 10:32:32 +1000
From: Jaime Metcher <metcher@spider.herston.uq.edu.au>
Subject: Re: win32, dbi, and msql
Message-Id: <35EF351F.69ED05BE@spider.herston.uq.edu.au>

1. You need to get your C compiler happening.
2. You need a "make" that will work.  As mentioned in the Win32 readme
for perl, dmake will do.
3. Many makefiles use shell syntax that won't work under Win95 (also
mentioned in the Win32 readme).

Which step is giving you trouble?

-- 
Jaime Metcher

Dustin Puryear wrote:
> 
>   I would like to use my win32 computer to write scripts that can
> access a mSQL database. I have mSQL running. Unfortunately, I am
> having problems getting the DBI/DBD::mSQL pair to install (like every
> other module under win32).
>   Has anyone successful installed it on win32 using the CPAN
> distribution? In fact, I am consistently having problems getting any
> module to install using the "perl Makefile.PL, make..." routine used
> for installing a perl module. I installed Sprite a number of months
> ago by dumping Sprite.pm into my perl directory. I also had to
> manually move files to get ConfigReader to install.
>   Any and all help is GREATLY appreciate. Email is preferred, but I do
> troll this newsgroup.
> 
> Thanks, Dustin
> 
> ======================================================================
> Dustin Puryear, student and lover, Louisiana State University
> ----------------------------------------------------------------------
> dpuryear@usa.net * ICQ 6644253
> LSU Computer Science student and loving it.
> Help Crack Government Encryption: www.distributed.net
> Eat red meat before it eats you!
> ======================================================================


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

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


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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