[16132] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3543 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 3 22:15:58 2000

Date: Mon, 3 Jul 2000 08:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <962636713-v9-i3543@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 3 Jul 2000     Volume: 9 Number: 3543

Today's topics:
    Re: ***Do not use this code!*** Re: Perl Help Please! <Magic@mattnet.freeserve.co.uk>
    Re: [Q] Anybody socket-to-socket Perl on PC to mainfram <sb@muccpu1.muc.sdm.de>
    Re: Archives in perl?? <Roger.Tillmann@extern.rwso.de>
    Re: Archives in perl?? <Roger.Tillmann@extern.rwso.de>
        C-like struct in Perl <Hans.X.Eriksson@etx.ericsson.se>
    Re: C-like struct in Perl (Eric Bohlman)
    Re: C-like struct in Perl <srevilak@cs.umb.edu>
    Re: C-like struct in Perl <kenneth.lee@alfacomtech.com>
    Re: C-like struct in Perl (Tad McClellan)
    Re: CGI and cookies snakedjip@yahoo.com
    Re: check for valid e-mail address <mike.solomon@eps.ltd.uk>
    Re: check for valid e-mail address <care227@attglobal.net>
        Compile Perl into a stand-alone executable robb4444@my-deja.com
    Re: DANGEROUS CODE ABOVE (was Re: Perl Help Please!) <Magic@mattnet.freeserve.co.uk>
    Re: Dereferencing a two dimensional array? <shanen@my-deja.com>
    Re: Find out if ran from a shtml? (David Efflandt)
        help with win32::eventlog <cmai@pec.com>
        help with win32::eventlog <cmai@pec.com>
    Re: How to change Solaris user password alexyuen2092@my-deja.com
    Re: how to get text enclosed by matching () ? (Bart Lateur)
    Re: How to open redirect and open new browser at same t <jfisher@epotec.com>
        My "replace a word in an HTML file" problem (CGI) <Magic@mattnet.freeserve.co.uk>
        OO::Closures <nick_willson@my-deja.com>
    Re: Password Security <tlehto@my-deja.com>
        Please Point me in the right direction <nowhere@domain.com>
    Re: Please Point me in the right direction <care227@attglobal.net>
    Re: PPM not work on ActivePerl 5.6 for NT ? <a.bruno.SII@ifrance.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 03 Jul 2000 12:29:42 +0100
From: Magic <Magic@mattnet.freeserve.co.uk>
Subject: Re: ***Do not use this code!*** Re: Perl Help Please!
Message-Id: <10u0mscuu2nsn9anhmjj53il0ebv8k1bid@4ax.com>

On Sun, 02 Jul 2000 21:01:20 GMT, bart.lateur@skynet.be (Bart Lateur)
wrote:

> Stuff
> like this is always done by anonymous gits, with silly nicknames
like
> "Magic". These don't post here, or they wouldn't be anonymous any
more.

My nickname was given to me by members of another group
(alt.audio.minidisc) because of the helpful way in which I answered
their queries. I post my location in my sig and my website contains
some information about me should anyone really be interested. I have
no worries about admitting who I am as I am not doing anything
illegal.

My real name is Matthew Charman, and in the blues band I play in I am
known as "Magic" Matt Charman. 

I resent the implication that having a nickname makes you a hacker. I
could easily imply that anyone named Bart had spikey yellow hair and a
bad attitude, but I doubt it would ring true.


Magic        ==|:o)
-- 
Location : Portsmouth, England, UK
Homepage : http://www.mattnet.freeserve.co.uk
EMail : mailto:Magic@mattnet.freeserve.co.uk


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

Date: 3 Jul 2000 12:51:01 GMT
From: Steffen Beyer <sb@muccpu1.muc.sdm.de>
Subject: Re: [Q] Anybody socket-to-socket Perl on PC to mainframe (OS/390) CICS?
Message-Id: <8jq27l$j5g$2@solti3.sdm.de>

In article <greplsoiahs6angb1pth6bmqcprbiem65b@4ax.com>, Stef <mitiste@charlie.iit.edu> wrote:

> 	The title says it pretty much all: I have been asked to do
> some socket-to-socket communication, with Perl on PC on one hand - to
> mainframe CICS socket on the other hand. Anybody having ever dealt
> with the mainframe sockets side?		

We do FTP connections via Perl (Net::FTP) from Unix workstations and
WIn NT 4.0 PCs to OS/390 and BS2000 mainframes around here.

Does that help you, by any chance?

Regards,
-- 
    Steffen Beyer <sb@engelschall.com>
    http://www.engelschall.com/u/sb/whoami/ (Who am I)
    http://www.engelschall.com/u/sb/gallery/ (Fotos Brasil, USA, ...)
    http://www.engelschall.com/u/sb/download/ (Free Perl and C Software)


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

Date: Mon, 03 Jul 2000 11:59:53 +0200
From: Roger Tillmann <Roger.Tillmann@extern.rwso.de>
Subject: Re: Archives in perl??
Message-Id: <39606419.F404F784@extern.rwso.de>

> Have you looked into Archive::Tar and Compress::Zlib?

I knew I had seen this somewhere - but I searched on friday for that and
didn't find it any more.

Thanx

Roger

*searching again*



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

Date: Mon, 03 Jul 2000 13:40:48 +0200
From: Roger Tillmann <Roger.Tillmann@extern.rwso.de>
Subject: Re: Archives in perl??
Message-Id: <39607BC0.6CF97682@extern.rwso.de>



Roger Tillmann schrieb:

> > Have you looked into Archive::Tar and Compress::Zlib?
>

Just looked at it. It works - but not for me :-(( If I add 12 MB to a 17 MB
archive, it uses 270 MB in RAM :-(( I have to work with archives sized 100
to 5000 MB. Is there some other way? Compressing is NOT !! needed. NTFS
could do that for me.

Roger




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

Date: Mon, 03 Jul 2000 13:01:44 +0200
From: Hans Eriksson <Hans.X.Eriksson@etx.ericsson.se>
Subject: C-like struct in Perl
Message-Id: <39607298.387FE084@etx.ericsson.se>

Hello!

Does anyone know if there is a way to create a C-like struct in Perl?
For instance, is there a way of creating a structure like this?:

struct input {
	char[100] type;
	int query_type;
	}


regards

Hans Eriksson


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

Date: 3 Jul 2000 11:35:06 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: C-like struct in Perl
Message-Id: <8jptpa$mu4$6@slb6.atl.mindspring.net>

Hans Eriksson (Hans.X.Eriksson@etx.ericsson.se) wrote:
: Does anyone know if there is a way to create a C-like struct in Perl?
: For instance, is there a way of creating a structure like this?:
: 
: struct input {
: 	char[100] type;
: 	int query_type;
: 	}

The usual way to create data structures for internal use is to use hashes or 
hash references; take a look at perldsc for some examples.  If you have 
to read or write data structures like yours coming from or going to 
external programs, you probably want to use pack() and unpack(), which 
are documented in perlfunc.



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

Date: Mon, 3 Jul 2000 07:38:00 -0400
From: Steve Revilak <srevilak@cs.umb.edu>
To: Hans Eriksson <Hans.X.Eriksson@etx.ericsson.se>
Subject: Re: C-like struct in Perl
Message-Id: <Pine.GSO.4.05.10007030733300.11110-100000@eris.cs.umb.edu>

On Mon, 3 Jul 2000, Hans Eriksson wrote:

/ Does anyone know if there is a way to create a C-like struct in Perl?
/ For instance, is there a way of creating a structure like this?:

Just use a hash.  Something like:
 
my %struct_input =
	(type       => "the type",
	 query_type => 5);
	

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Steve Revilak
srevilak@cs.umb.edu



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

Date: Mon, 03 Jul 2000 19:38:57 +0800
From: Kenneth Lee <kenneth.lee@alfacomtech.com>
Subject: Re: C-like struct in Perl
Message-Id: <39607B51.54C00777@alfacomtech.com>

see  Class::Struct  module



Hans Eriksson wrote:
> 
> Hello!
> 
> Does anyone know if there is a way to create a C-like struct in Perl?
> For instance, is there a way of creating a structure like this?:
> 
> struct input {
>         char[100] type;
>         int query_type;
>         }
> 
> regards
> 
> Hans Eriksson


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

Date: Mon, 3 Jul 2000 08:38:30 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: C-like struct in Perl
Message-Id: <slrn8m12a6.bp5.tadmc@magna.metronet.com>

On Mon, 03 Jul 2000 13:01:44 +0200, Hans Eriksson <Hans.X.Eriksson@etx.ericsson.se> wrote:


>Does anyone know if there is a way to create a C-like struct in Perl?
                                                       ^^^^^^

   perldoc -q struct


   "How can I make the Perl equivalent of a C structure/C++ 
    class/hash or array of hashes or arrays?"


You are expected to check the Perl FAQ *before* posting to the
Perl newsgroup you know.


>For instance, is there a way of creating a structure like this?:
>
>struct input {
>	char[100] type;


That one would be a string in Perl.


>	int query_type;
>	}

That one would be a number in Perl.

You can store a string or a number in a scalar in Perl, so you
need a data structure that contains 2 scalars:

my %struct = (
   type        =>  'some string',
   query_type  =>  2,
);


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Mon, 03 Jul 2000 13:24:08 GMT
From: snakedjip@yahoo.com
Subject: Re: CGI and cookies
Message-Id: <8jq459$g7i$1@nnrp1.deja.com>

I have just tried Netscape at work, and it gives me the same behavior
as with my friend's PC, e.g. it doesn't work (the cookies are not set).

With IE on the same PC, everything is fine.

So, it's probably not a proxy issue...

Any other ideas ?


In article <slrn8m0dhc.tfv.garcia_suarez@rafael.kazibao.net>,
  garcia_suarez@hotmail.com (Rafael Garcia-Suarez) wrote:
> snakedjip@my-deja.com wrote in comp.lang.perl.misc:
> >I'm experiencing some weird behavior, and i'm looking for ideas to
> >guide me...
> >
> >I have a web site.  I use cookies to check if a user is logged in or
> >not.
> >
> >In development (on my PC) AND in production (at my hosting service),
I
> >have no problem with this setup using my PC as the browser, whether
it
> >be with Netscape or IE.  Cookies are being set, users are being
> >recognized (I turned prompts on for cookies in the browsers).
> >
> >When I go to my friend's PC, the cookies are simply not set.  He had
> >only IE installed, it didn't work, so I installed Netscape, turned on
> >the cookie prompts, and NOTHING.
> >
> >I went to another site that uses cookies, and those sites worked fine
> >on his PC.
> >
> >By the way, he's on ADSL, and his ISP uses some kind of proxy to
limit
> >bandwidth consumption.  Could this be the reason ???????
>
> A proxy can do one of those things :
>   * filtering out Set-Cookie headers in HTTP requests
>   * Changing domain names while transmitting HTTP requests (e.g. to IP
>     addresses)
> Put a simple script that prints %ENV on your web site, and look if all
> variables look normal (esp. HTTP_HOST).
>
> >Here's my code.  This peace of code is run after the user has clicked
> >on submit in the login form, and redirects to the user's profile
page.
> >
> >If anyone has a clue, PLEASE RESPOND :-)
> >
> >Thanks.
> >
> >
> >
> >my $userCookie = $cgi->cookie(-name => 'user',
> >			  -value => $user,
> >			  -path => '/',
> >			  -domain => '<the domain>',
> >			  -secure => 0);
> >my $loggedInCookie = $cgi->cookie(-name => 'loggedin',
> >			      -value => 1,
> >			      -path => '/',
> >			      -domain => '<the domain>',
> >			      -secure => 0,
> >			      -expires => '+3h');
> >print $cgi->redirect(-uri=>$redirUrl, -cookie=>
> >$userCookie,$loggedInCookie]);
>
> And some browsers can't handle set-cookie commands in redirect
requests.
>
> --
> Rafael Garcia-Suarez
>


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


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

Date: Mon, 3 Jul 2000 12:31:33 +0100
From: "mike solomon" <mike.solomon@eps.ltd.uk>
Subject: Re: check for valid e-mail address
Message-Id: <8jptmf$15f5o$1@ID-36965.news.cis.dfn.de>

if you want to criticise my code and tell me there are better ways to do it
a hint as to what the better ways are would be appreciated !




> >
> > this is because the array holds other error messages as well as the
invalid
> > addresses , such as invalid file names
>
> that is special to your particular application and thus not necessary
> for a general solution that you would give out in this forum.  even
> then, there are better ways of doing it.
>
> --
> brian d foy
> CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
> Perl Mongers <URL:http://www.perl.org/>




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

Date: Mon, 03 Jul 2000 10:10:02 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: check for valid e-mail address
Message-Id: <39609EBA.305CA34C@attglobal.net>

mike solomon wrote:
> 
> if you want to criticise my code and tell me there are better ways to do it
> a hint as to what the better ways are would be appreciated !
> 

I think he already did.  From an earlier post in this thread:

d foy=> if it matches the regex it's a bad address?  furthermore,
d foy=> your regex is doomed to fail (like every other regex solution
d foy=> posted, for the same reasons listed in the faq and oft
d foy=> posted to this group).  see RFC::RFC822::Address.

RFC::RFC822::Address being a Perl module used to check for conformity 
to RFC822.  There is, of course, no way to make sure that an addy is 
really _valid_, meaning someone will own that address.  All we can 
check is that it is in a valid format.  

One quick glance at the RFC will show you why your regex is doomed 
to failure in all but the most tightly constrained circumstances.

HTH


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

Date: Mon, 03 Jul 2000 12:23:00 GMT
From: robb4444@my-deja.com
Subject: Compile Perl into a stand-alone executable
Message-Id: <8jq0io$do9$1@nnrp1.deja.com>

I remembered some people asking about compiling Perl scripts in stand-
alone executables. Then check out PerlApp.

http://www.activestate.com/Products/Perl_Dev_Kit/index.html


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


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

Date: Mon, 03 Jul 2000 12:23:34 +0100
From: Magic <Magic@mattnet.freeserve.co.uk>
Subject: Re: DANGEROUS CODE ABOVE (was Re: Perl Help Please!)
Message-Id: <6pt0msso2h71ae25phmbnpiq03fvpqca01@4ax.com>

On Sun, 02 Jul 2000 20:54:10 GMT, bart.lateur@skynet.be (Bart Lateur)
wrote:

> Magic wrote:
> 
> >Strikes me that if Perl can't handle a simple task like that simply
> >then I might just as well use Javascript, at least client-side JS
> >can't delete your site.
> 
> It can delete the user's harddisk. Just look at the Loveletter virus
for
> a simple example.

The LoveLetter virus was VBScript not JavaScript. VBScript is
Microsoft's very open insecure code which allowed far more than that
to be done to your machine. Javascript does not have these loopholes
in security and has the advantage of being far more cross-browser
compatible.

Full details on this virus can be found at (amongst other places)
http://www.datafellows.com/v-descs/love.htm



Magic        ==|:o)
-- 
Location : Portsmouth, England, UK
Homepage : http://www.mattnet.freeserve.co.uk
EMail : mailto:Magic@mattnet.freeserve.co.uk


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

Date: Mon, 03 Jul 2000 10:39:44 GMT
From: Shannon Jacobs <shanen@my-deja.com>
To: shanen@acm.org
Subject: Re: Dereferencing a two dimensional array?
Message-Id: <8jpqhf$9kv$1@nnrp1.deja.com>


> Then might I suggest investing in a good introductory book such as
> "Learning Perl"? The docs are good, but they're intended as a
> reference, not a tutorial. There are some tutorials included, though,
> including 'perldoc perlreftut'. Pull up 'perldoc perltoc'
> and 'perldoc perl' for a good overview of what's available.

I have and, as I already wrote, there is too much. I do have access to
the llama book, but didn't find it particularly helpful. I thumbed
through the Perl recipe book but wasn't impressed enough to fork out
the bucks--about double here in Japan.

I mostly pick up my computer languages easily and relatively painlessly
by looking at some working code and munging it to suit my peculiar
purposes, and somehow the language just sinks in. I can slowly do the
munging in Perl, but it isn't sinking in the way I'd like, and the
style of the language continues to elude me. It appears to call for a
heavy larval period, but I'm too lazy to do that unless I can't help it-
-I'd much rather find the right tool for the job. But remember that
Larry thinks laziness is a virtue.


> > My current feeling about Perl is that I'm using a trench mortar
> > to kill flies.
>
> Heh. Interesting analogy, but Perl is well suited to small problems.
> The problem may be in your approach. I know I did lots of dumb, brute
> force things before I learned enough of Perl to be more elegant. (I
> still use a hammer sometimes, but at least it's a smaller one.)

Don't force it. Use a bigger hammer. That was the motto of the TV
repair classes I was in, back in the tube days.

Someone else brought up the Swiss army chainsaw, but I think it's more
like a pearl-handled Swiss army sledge hammer with notches for all the
programmers it's slain. Or maybe a Swiss army articulated backhoe.


> Hrmph. Well, let it soak a while and then read it over again. You
> seemed to expect $reslist and $results to be the same thing, and I
> just wondered if one name was a typo for the other. If so, 'strict'
> will try to warn you by forcing you to predeclare your variables and
> squawking if only use a variable once.

Not exactly a typo, but different stages of the same information. One
of them had actually been done more directly from one of the input
files and the other was a slice I had taken somewhere else... Anyway,
it's working and I'm cranking out new function points fast enough for
now.

--
Spamnuts--not just for breakfast anymore.  Be sure to crack the shells
before adding soy sauce.


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


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

Date: 3 Jul 2000 14:18:48 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Find out if ran from a shtml?
Message-Id: <slrn8m1858.bnv.efflandt@efflandt.xnet.com>

On Mon, 03 Jul 2000 01:23:33 +0200, Matthias Keller <matti@keller.com> wrote:
>Hi
>
>Is it possible to find out in a perl-script wether it has been run over
>its name or from a shtml ?

DOCUMENT_URI or possibly DOCUMENT_NAME

Run the following as CGI and as SSI to see what env your server has:

#!/usr/bin/perl
use CGI qw/:standard/;
print header,start_html('Environment'),h1("Environment"),p;
foreach (sort keys %ENV) { print "$_ = $ENV{$_}",br; }
print end_html;


-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/  http://cgi-help.virtualave.net/



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

Date: Mon, 3 Jul 2000 09:37:37 -0400
From: "cuong mai" <cmai@pec.com>
Subject: help with win32::eventlog
Message-Id: <8jq4vg$10a$1@bob.news.rcn.net>

Hi,

I tried to use the win32::eventlog from the Activestate Perl version 5.x to
dump my eventlog but it is not clearing the logs from a remote server.  It
will backup remotely just fine and clear locally just fine too.  But when I
tried to do a clear remotely it will not allow me.  Please help.

Thank you,
Cuong Mai




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

Date: Mon, 3 Jul 2000 10:51:02 -0400
From: "cuong mai" <cmai@pec.com>
Subject: help with win32::eventlog
Message-Id: <8jq996$qfh$1@bob.news.rcn.net>

Cannot get the module to do a remote clear eventlog.  Able to do a backup
remotely and clear locally but cannot get it to do a remote clear on a winnt
4.0 with Activestate perl v5.X.

Thank you,
Cuong Mai






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

Date: Mon, 03 Jul 2000 11:58:09 GMT
From: alexyuen2092@my-deja.com
Subject: Re: How to change Solaris user password
Message-Id: <8jpv4b$ck4$1@nnrp1.deja.com>

In article <8jdvb9$gn8$1@orpheus.gellyfish.com>,
  Jonathan Stowe <gellyfish@gellyfish.com> wrote:
> On Wed, 28 Jun 2000 09:15:24 GMT alexyuen2092@my-deja.com wrote:
> >
> > I am working with Netscape Enterprise Server and would like to
> > implement some forms of security with Solaris Build-in security.
> > However, I would like if there's any programs/scripts that allow
user
> > to change their own password in Solaris.
> >
>
> I find the passwd program usually suffices
>
Thanks. Sorry for making confusion. I know I could do that in Solaris
with the "passwd" but how could a remote user make use of the WEB-based
interface (cgi, JSP etc) to change his/her password in the Solaris box.
Any samples scripts/programs in doing so?

Thanks again.

Alex


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


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

Date: Mon, 03 Jul 2000 11:49:43 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: how to get text enclosed by matching () ?
Message-Id: <39636c54.9862333@news.skynet.be>

RonR wrote:

>$a="create table x (a date,b num(2),c char(3)) storage (ini next) tablespace 
>x;";
>($cols) = ($a =~ /(\(.*\))/ );
>
>prints "(a date,b num(2),c char(3)) storage (ini next)" where I wanted
>"(a date,b num(2),c char(3))"

A more parser-like expression would only return what you want.

	/(\(\w+ \w+(?:\(\d+\))?(?:,\w+ \w+(?:\(\d+\))?)*\))/

If you find this daunting, you're right. It consists of twice the same
subregex, repeated because of that comma. More factored:

	$expr = '\w+ \w+(?:\(\d+\))?';
	$a =~ /(\($expr(?:,$expr)*\))/o;

-- 
	Bart.


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

Date: Mon, 03 Jul 2000 10:15:48 GMT
From: James Fisher <jfisher@epotec.com>
Subject: Re: How to open redirect and open new browser at same time?
Message-Id: <39606795.60FB3EFC@epotec.com>

shaohong wrote:
> 
> Hi:
> 
> If we want to use a redirect to send the browser to some other URL, a
> redirect('http://somewhere.else/') method in Perl exists to facilitate this.
> 
> Now my problem is
> First I want to redirect to URL1, at same time I want to open a new browser
> to some other URL2, the URL1 is still existing in the background.
> 
> What technology may I use in Perl? Need your help help!!
> 
> Many thanks.
> 
> shaohong

You want to use client side javascript code for this.  Example...  to
redirect in javascript.  Some event happens..... 
window.location.href='www.yahoo.com';   For the popup search some
javascript sites for window.open...

JF


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

Date: Mon, 03 Jul 2000 15:10:37 +0100
From: Magic <Magic@mattnet.freeserve.co.uk>
Subject: My "replace a word in an HTML file" problem (CGI)
Message-Id: <9971ms8qk1fcn0k5erdfkuqfb6uarlgp94@4ax.com>

Hi all,

	I've managed to knock up some code with the kind help of a few who
took pity on me for being a cluebie. I've commented my code so I hope
it's nice and easy for people to understand what I'm attempting to
achieve.

	The code itself works (miracle!!) but what I would appreciate is
if somebody could look it over and see if I've done enough to prevent
commands etc. being executed (like rm) which could do some damage.
I've attempted to remove any "|" and ".." from the filename, do I need
to do any more?

Many thanks


Code follows...

------------------------------------------------------------------------
# Filename : parsepage.pl
# Version : 0.42
# Author : Matthew Charman
# Date : 3rd July 2000

#! /usr/local/bin/perl

# Home directory for my HTML files
$html_dir = "/usr/home/fut589/public_html";

#Tell browser what is being sent to it
print "Content_Type: text/html\n\n";

# Call the ReadParse function copy-pasted from cgi.pl
&ReadParse;

# Get the word parameter
$myword = $in{'word'};

# Get the file parameter
$myfile  = $in{'file'};

# The file to open is 'the path to HTML files' / 'file parameter'
$file_to_open = "$html_dir/$myfile";

# Get rid of nasty pipe things and ".."
# to stop people executing commands and
# moving up directories.
$_ = $file_to_open;
s/\|//g ;
s/\.\.//g ;
$file_to_open = $_ ;

# Open the file
open(FILE, $file_to_open);

# While end is not reached read a string into $_
while(<FILE>) {
   # Replace any occurences of !MYWORD! with the contents of $myword
   s/\!MYWORD\!/$myword/g ;
   # Ouput the altered string to the browser
   print "$_";
}
# Close the file
close(FILE);

# Exit the program cleanly.
exit(0);


###############################################################################
#
# Copy-pasted from "cgi.pl" as whole library was not needed.
#

sub ReadParse {
  local(*in)=@_ if @_;
  local ($i,$key,$val);

  if ($ENV{'REQUEST_METHOD'} eq "GET") {
    $in=$ENV{'QUERY_STRING'};
  }
  elsif ($ENV{'REQUEST_METHOD'} eq "POST") {
    read(STDIN,$in,$ENV{'CONTENT_LENGTH'});
  }
  
  @in=split(/&/,$in);
  
  foreach $i (0 .. $#in) {
    $in[$i] =~ s/\+/ /g;
    ($key,$val)=split(/=/,$in[$i],2);
    $key =~ s/%(..)/pack("c",hex($1))/ge;
    $val =~ s/%(..)/pack("c",hex($1))/ge;
    $in{$key} .= "\0" if (defined($in{$key}));
    $in{$key} .=$val;
  }
  return length($in);
}

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

Magic        ==|:o)
-- 
Location : Portsmouth, England, UK
Homepage : http://www.mattnet.freeserve.co.uk
EMail : mailto:Magic@mattnet.freeserve.co.uk


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

Date: Mon, 03 Jul 2000 11:13:28 GMT
From: Nick Willson <nick_willson@my-deja.com>
Subject: OO::Closures
Message-Id: <8jpsgh$b1c$1@nnrp1.deja.com>

Seeking help on correct use of OO::Closures.  If I call a non-existent
method, the mistake is silently ignored.  Details below, all help
welcome.

Perl version is 5.005_03
OO::Closures is 1.2

Here is output from test script:

hello was implemented by Base
hello was implemented by Base
goodbye was implemented by Concrete
Done

Here is test script:

#!/usr/bin/perl -w

use Base;
use Concrete;
use English;
use strict;

my $rB = Base::new;
$rB->("hello");

my $rC = Concrete::new;
$rC->("hello");
$rC->("goodbye");
# Ask it to do something it can't:
$rC->("Fifth Amendment");

# but still get here
print("Done\n");
exit 0;

__END__

Here is Base.pm:

package Base;

use English;
use OO::Closures;
use strict;

sub new
{
   my (%Methods, %ISA, $rSelf);
   $rSelf = create_object(\%Methods, \%ISA, !@_);
   my $rConcrete = shift || $rSelf;

   $Methods{hello} =
      sub
      {  print("hello was implemented by ", __PACKAGE__, "\n");
         return $rConcrete;
      };

   # %ISA left alone - inherit nothing

   return $rSelf;
}

return 1;
__END__

Here is Concrete.pm:

package Concrete;

use Base;
use English;
use OO::Closures;
use strict;

sub new
{
   my (%Methods, %ISA, $rSelf);
   $rSelf = create_object(\%Methods, \%ISA, !@_);
   my $rConcrete = shift || $rSelf;

   $Methods{goodbye} =
      sub
      {  print("goodbye was implemented by ", __PACKAGE__, "\n");
         return $rConcrete;
      };

   # Inherit from Base:
   %ISA = (Base => Base::new($rConcrete));

   return $rSelf;
}

return 1;
__END__



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


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

Date: Mon, 03 Jul 2000 10:34:08 GMT
From: Tomi Lehto <tlehto@my-deja.com>
Subject: Re: Password Security
Message-Id: <8jpq70$9if$1@nnrp1.deja.com>

Hi,
You could use the web server authentication. Put the db administration
scripts in a directory that is protected by password, like
 .htaccess/.htpasswd files in Apache (don't know about other servers).
Then, if the user knows username and password, the server provides the
username in REMOTE_USER environment variable that the script can use.
And for subsequent calls to the script the browser gives username and
password to the server automatically.

And, as the regular posters might say, this was not a perl question, but
a CGI question. (I have learnt _something_ by following c.l.p.* ngs
haven't I :)

-Tomi


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


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

Date: Mon, 3 Jul 2000 10:05:34 -0700
From: "mike" <nowhere@domain.com>
Subject: Please Point me in the right direction
Message-Id: <Cb185.648$7c.5196@news1.tor.primus.ca>

I've been using
    open(DATA,"filename.dat");
    while(line$=<DATA>){}
to open an HTML form file and read it line by line.

I want to parse the INPUT, NAME, VALUE tags.
Maybe even dump then into an associative array...
 .
I've searched the perlop and perlfunc and the two books I have for an
exmaples or FAQ on parsing the line itself..

Forexample,
$line=~/input=/; ##-- doesn't help cause I need what's after it.

Maybe I just can't see the solution.

Can someone please point me in the right direction, a sample code, lib, or
to a command I should look up in perlfunc.

Thanks in advance,








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

Date: Mon, 03 Jul 2000 10:14:48 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Please Point me in the right direction
Message-Id: <39609FD8.3F2F81ED@attglobal.net>

mike wrote:
> 
> I've been using

open DATA,"filename.dat" or die "can't open $!\n"; #always test!
     while(<DATA>) # use $_ insted of $line
{
}


> Can someone please point me in the right direction, a sample code, lib, or
> to a command I should look up in perlfunc.

Check out the HTML modules from CPAN and see if they do what 
you need.  HTML::Parser perhaps.

HTH


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

Date: Mon, 3 Jul 2000 14:31:01 +0200
From: "A. BRUNO" <a.bruno.SII@ifrance.com>
Subject: Re: PPM not work on ActivePerl 5.6 for NT ?
Message-Id: <8jq10n$1cso$1@news2atm.raleigh.ibm.com>

Thanks,

But now I have the following message under NT:

Can't locate ExtUtils/MM_Unix.pm in @INC (@INC contains: D:/Perl/lib
D:/Perl/site/lib .) at D:/Perl/lib/ExtUti
ls/MakeMaker.pm line 75.
Compilation failed in require at D:/Perl/lib/ExtUtils/Install.pm line 33.
BEGIN failed--compilation aborted at D:/Perl/lib/ExtUtils/Install.pm line
33.
Compilation failed in require at D:/Perl/site/lib/PPM.pm line 14.
BEGIN failed--compilation aborted at D:/Perl/site/lib/PPM.pm line 14.
Compilation failed in require at D:\Perl\bin\ppm.bat line 21.
BEGIN failed--compilation aborted at D:\Perl\bin\ppm.bat line 21.




--
Aurélien BRUNO

"Stephen Cawood" <cawood@ncompasslabs.com> a écrit dans le message news:
db275.4929$j7.260002@news.bc.tac.net...
> There is a hot fix at:
> http://www.activestate.com/Products/ActivePerl/Download.html
> This might help.
>
> Stephen Cawood
>
> "Aurlien BRUNO" <a.bruno.SII@ifrance.com> wrote in message
> news:8ji4a7$1i36$1@news2atm.raleigh.ibm.com...
> > Good Afternoon,
> >
> > I have the following problem under NT when I use PPM:
> >
> > PPM> verify /upgrade
> > Error verifying HTML-Parser: Could not locate a PPM binary of
> 'HTML-Parser'
> > for this platform
> > Package 'URI' is up to date.
> > Package 'Compress-Zlib' is up to date.
> > Package 'XML-Element' is up to date.
> > Package 'PPM' is up to date.
> > Error verifying libwww-perl: Could not locate a PPM binary of
> 'libwww-perl'
> > for this platform
> > Package 'MIME-Base64' is up to date.
> > Package 'Archive-Tar' is up to date.
> > Package 'libwin32' is up to date.
> > Cannot forceunlink D:\Perl\site\lib\auto\XML\Parser\Expat\Expat.dll:
> > Permission denied at D:/Perl/site/lib/PPM
> > .pm line 617
> > Error verifying XML-Parser: Could not locate a PPM binary of
'XML-Parser'
> > for this platform
> >
> > after exit I can't restart ppm : the next message appears :
> >
> > Can't locate HTML/HeadParser.pm in @INC (@INC contains: D:/Perl/lib
> > D:/Perl/site/lib .) at D:/Perl/site/lib/LW
> > P/Protocol.pm line 47.
> > Compilation failed in require at D:/Perl/site/lib/LWP/UserAgent.pm line
> 103.
> > BEGIN failed--compilation aborted at D:/Perl/site/lib/LWP/UserAgent.pm
> line
> > 103.
> > Compilation failed in require at D:/Perl/site/lib/PPM.pm line 8.
> > BEGIN failed--compilation aborted at D:/Perl/site/lib/PPM.pm line 8.
> > Compilation failed in require at D:\Perl\bin\ppm.bat line 21.
> > BEGIN failed--compilation aborted at D:\Perl\bin\ppm.bat line 21.
> >
> > All files under HTML/ directory are removed :
> >
> > What the problem ?
> >
> > --
> > A. BRUNO
> >
> >
>
>




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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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

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

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


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


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