[7370] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 995 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 8 12:17:47 1997

Date: Mon, 8 Sep 97 09:00:39 -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           Mon, 8 Sep 1997     Volume: 8 Number: 995

Today's topics:
     Re: "reget" with Net::FTP? <zenin@best.com>
     Re: "reget" with Net::FTP? <gbarr@ti.com>
     -e and unlink not finding files <fishrman@shell.wco.com>
     cannot create file within while loop dellis@frycomm.com
     Re: colletion of neat map uses anywhere? (Re: How to ge <rootbeer@teleport.com>
     Re: Converting strings to numbers (Andrew M. Langmead)
     Re: Datetime datatype in sybperl <mpeppler@mbay.net>
     Flush query string? <dgm@globalnet.co.uk>
     Re: Getting rid of \n in textarea input <bjorn.w.nilsson@edt.ericsson.se>
     Re: Getting rid of \n in textarea input <rootbeer@teleport.com>
     Re: How do I embed C in Perl <rootbeer@teleport.com>
     Re: how do I redirect the output of an existing perl sc <rootbeer@teleport.com>
     Re: Minimizing Memory Needed for Numbers Read from Bina <Brett.W.Denner@lmtas.lmco.com>
     Newcomer to the world of Perl, CGI and HTML ... (James Atkin)
     Open(>>append mode) access time question... <smithpl@engr.engr.sc.edu>
     Re: Pattern matching problem with \n <rootbeer@teleport.com>
     Perl with cygnus <jason.kruse@teldta.com>
     script for UNIX .db file <clearn@cis.co.za>
     Re: security of input in reg exp? (M.J.T. Guy)
     Re: simple Sendmail Question (Newbie) <yanoff@alumni.cs.uwm.edu>
     URL info utility (for your web pages) <Carry.Megens@nym.sc.philips.com>
     Re: utility for managing NIS password, groups and alias <Carry.Megens@nym.sc.philips.com>
     Re: Weighting elements of an array (Greg Bacon)
     what has it got in its ssocketses? <_lloyd_@vwv.com>
     Re: where's gunzip and tar for dos/win? <jont@uunet.pipex.com>
     Re: Wrote new module, need help with system dependencie <zenin@best.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 8 Sep 1997 15:03:22 GMT
From: Zenin <zenin@best.com>
Subject: Re: "reget" with Net::FTP?
Message-Id: <5v143q$oc0$1@nntp2.ba.best.com>

Brett Denner <Brett.W.Denner@lmtas.lmco.com> wrote:
> Is it possible to do a "reget" command with Net::FTP?  

	Yes, it is.  You simply stat the local copy of the file
	you have to get it's current byte count, and then use
	the (badly documented) three argument form of the get
	method using the byte count you get from a local stat
	as the byte offset (plus 1).  -But You have to use a
	filehandle so that it actually appends to the local file:

	open LOCAL, ">>localFile"
		or die $!;
	$Ftp->get ('remoteFile', \*LOCAL, (stat("localFile"))[7] + 1);

	WARNING!!!!!!!!!!!!!!!!
	A number of servers don't support the REST FTP command that
	this form of get() requires!  I know the stock Solaris
	doesn't (no supprise there), and I think it's a problem on many
	other servers as well. -The get() will return undef if this
	is the case, and you'll need to use the Debug flag to check it.

-- 
-Zenin
 zenin@best.com


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

Date: Mon, 08 Sep 1997 10:32:44 -0500
From: Graham Barr <gbarr@ti.com>
Subject: Re: "reget" with Net::FTP?
Message-Id: <34141A9C.7A493C0E@ti.com>

Zenin wrote:
> Brett Denner <Brett.W.Denner@lmtas.lmco.com> wrote:
> > Is it possible to do a "reget" command with Net::FTP?
> 
>         Yes, it is.  You simply stat the local copy of the file
>         you have to get it's current byte count, and then use
>         the (badly documented) three argument form of the get
>         method using the byte count you get from a local stat
>         as the byte offset (plus 1).  -But You have to use a
>         filehandle so that it actually appends to the local file:
> 
>         open LOCAL, ">>localFile"
>                 or die $!;
>         $Ftp->get ('remoteFile', \*LOCAL, (stat("localFile"))[7] + 1);
> 
>         WARNING!!!!!!!!!!!!!!!!
>         A number of servers don't support the REST FTP command that
>         this form of get() requires!  I know the stock Solaris
>         doesn't (no supprise there), and I think it's a problem on many
>         other servers as well. -The get() will return undef if this
>         is the case, and you'll need to use the Debug flag to check it.

Also be warned that this will not necessarily work when
you are transfering files in ASICC mode. unless both
server and client store files in the same way (ie either
both store with CRLF or neither). 

I do not know of any way around this problem as you cannot
tell how the server stores the file.

Regards,
Graham.

-- 
The road to success is lined with many tempting parking spaces.


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

Date: 8 Sep 1997 14:56:19 GMT
From: "Michael A. Watson" <fishrman@shell.wco.com>
Subject: -e and unlink not finding files
Message-Id: <5v13mj$7s3$1@news.wco.com>

I am building a string which contains the path and file name of a file I
wish to delete. I have $maindir which contains the complete path to my
base directory, $path which contains the name of a subdirectory where the
file that I wish to delete exists, and $num.html the file.
The problem is that the following returns a message that the file does not 
exist through a browser, but when run through my shell account it says the
file does exist:
               $filepath = "$maindir/$path/$num.html";
               -e $filepath and print "$filepath file exists!<BR>\n";
               -e $filepath or print "$filepath file doesn't exists!<BR>\n";

If I replace $path with the actual directory name it works, but printing
the old $path and the new hardcoded one reveals no differences.

Unlink also seems to be unable to find the files.

Help.

Mike
fishrman@wco.com
 


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

Date: Mon, 08 Sep 1997 10:52:22 -0600
From: dellis@frycomm.com
Subject: cannot create file within while loop
Message-Id: <873733630.3539@dejanews.com>

I am trying to open and read a mapfile, and for each line read, open an
input file and an output file according to some fields in the line read.
The problem is that the output file is not getting created when I open(and
then close) it unless I stick the open statement outside the while loop.
I have the open OR'd with a die statement, but nothing dies, nothing is
created, and no errors are output at all.

I must have missed a basic rule about opening files at some point, so
could someone please cure my ignorance?

Here is the script so far:

----------------
#!/usr/local/bin/perl

require "getopts.pl";

&Getopts("m:v");

open(MF,"$opt_m");

while (<MF>) {
    chop;
    local($title,$chap,$sect,$lev,$text) =
m/(.+?)\s+(.+?)\s+(.+?)\s+(.+?)\s+\"(.+)\"$/;

    open(IF,"$title/${chap}.sgm") or die "Cannot open input
$title/${chap}.sgm: $!\n";
    open(OF,">/tmp/dclause.tmp") or die "Cannot open output
/tmp/dclause.tmp: $!\n";
}

Thanks for any help. BTW, if I remove everything inside the while loop
except the open of the OF, it still doesn't get created.

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


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

Date: Mon, 8 Sep 1997 08:22:11 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Jahwan Kim <jahwan@supernova.math.lsa.umich.edu>
Subject: Re: colletion of neat map uses anywhere? (Re: How to get keys of array?)
Message-Id: <Pine.GSO.3.96.970908081541.27795C-100000@julie.teleport.com>

On 6 Sep 1997, Jahwan Kim wrote:

>     I'm beginning to wonder, shouldn't all these neat uses of map be
> collected and written up, say in a document of couple of pages?  Maybe
> man perlmap?  Is it out there already? 

There are some cool uses on the Perl Recipes page.

    http://www.5sigma.com/perl/recipes.html

Or you could start a page of your own. Enjoy!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Mon, 8 Sep 1997 14:42:12 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Converting strings to numbers
Message-Id: <EG726D.A0B@world.std.com>

swrholdj@met.rdg.ac.uk (John J Holden) writes:

>Is it possilbe to convert the string into a numeric variable in perl?

Perl converts strings to numbers as needed. One way to be sure that a
scalar is treated as a number, is to perform some sort of numeric
operation on it.

$number = $input + 0;

>If not, how else can I ensure a variable is a valid number?

The FAQ recommends using regular expressions. The appropriate FAQ
entry follows:

>  How do I determine whether a scalar is a number/whole/integer/float?
>
>    Assuming that you don't care about IEEE notations like "NaN" or
>    "Infinity", you probably just want to use a regular expression.
>
>       warn "has nondigits"        if     /\D/;
>       warn "not a whole number"   unless /^\d+$/;
>       warn "not an integer"       unless /^-?\d+$/;  # reject +3
>       warn "not an integer"       unless /^[+-]?\d+$/;
>       warn "not a decimal number" unless /^-?\d+\.?\d*$/;  # rejects .2
>       warn "not a decimal number" unless /^-?(?:\d+(?:\.\d*)?|\.\d+)$/;
>       warn "not a C float"
>           unless /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/;
>
>    Or you could check out http://www.perl.com/CPAN/modules/by-
>    module/String/String-Scanf-1.1.tar.gz instead. The POSIX module (part
>    of the standard Perl distribution) provides the `strtol' and `strtod'
>    for converting strings to double and longs, respectively.
-- 
Andrew Langmead


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

Date: Mon, 08 Sep 1997 07:35:31 -0700
From: Michael Peppler <mpeppler@mbay.net>
To: Per Fredrik Kvarme <perkva@itk.ntnu.no>
Subject: Re: Datetime datatype in sybperl
Message-Id: <34140D33.21C0@mbay.net>

Per Fredrik Kvarme wrote:
> 
> Hello
> 
>         I`m just completing a www database interface using sybperl::DBlib,
> and could use some help. I have a few smalldate attributes I want to
> update and outpui. So, what I need to know is what datatype this field
> becomes when I return it from a query, and how I need to decode and format
> on the way to and from the database. Any help would be very welcoom!

You have two possibilities.

1) Sybperl returns dates as a string ('Sep 8 1997  7:33AM' is what
   I get here, but it is locale dependant).

2) Use the 'UseDateTime' attribute to return the date as a native 
   datetime object. Then when you print the item you get a date string,
   but you can also do arithmetic on the date (ie add/substract days),
   do date comparisons, and split out all the pieces of the date into
   variables, so that you can format your own date string.

Please read the sybperl manual page for more info on this.

Michael
-- 
Michael Peppler       -||-  Data Migrations Inc.
mpeppler@datamig.com  -||-  http://www.mbay.net/~mpeppler


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

Date: 8 Sep 1997 14:53:25 GMT
From: "David Mellors" <dgm@globalnet.co.uk>
Subject: Flush query string?
Message-Id: <01bcbc66$7f106c00$LocalHost@interlink>

Now, I have a HMTL form which is processed by a perl script. The script
appends a file and outputs it to the browser. 

The problem is: When the browsers refresh button is pressed, the script is
run again with the same parameters, resulting in the form details being
appended to the file more than once!

So, tell me.... Is there a way of stopping this? 

Hope you can help

Dave Mellors
dgm@globalnet.co.uk


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

Date: Mon, 08 Sep 1997 17:25:08 +0200
From: Bjvrn Nilsson <bjorn.w.nilsson@edt.ericsson.se>
To: info@backroompr.com
Subject: Re: Getting rid of \n in textarea input
Message-Id: <341418D4.7C17@edt.ericsson.se>

Javier Figueroa wrote:
> 
> Please if anybody can help me I would really appreciate it.
> 
> I need to know how to get rid of carriage returns put in by users in
> textarea so I can put it in one continuous line in my database file.
> 
> I tried
> 
> $FORM{'information'} =~ s/\n/ /g;
> 
> but it does not work, the carriage return is still being displayed in my
> database file.
> 
> Please if you can post an answer or write me email I would greatly
> appreciate it.
> 
> Thank you very much,
> 
> Javier Figueroa
> figue@tld.net
Hi!

Try:

chomp($FORM{'information'});

which "safely" takes away newline from the end of a string, but doesn't
touch the string as such. (Which chop($string) may do, as chop takes
away the last char. in a blind manner.)

/Bjvrn


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

Date: Mon, 8 Sep 1997 08:49:48 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Javier Figueroa <info@backroompr.com>
Subject: Re: Getting rid of \n in textarea input
Message-Id: <Pine.GSO.3.96.970908084655.27795G-100000@julie.teleport.com>

On Mon, 8 Sep 1997, Javier Figueroa wrote:

> I tried
> 
> $FORM{'information'} =~ s/\n/ /g;
> 
> but it does not work, the carriage return is still being displayed in my
> database file. 

If you're printing that data to a file after that transformation, there
should be no \n characters in it. Could there be other control characters
there which are being transformed upon output? Have you set the magical $\
variable to anything interesting? Good luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Mon, 8 Sep 1997 08:37:03 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: dave <over@the.net>
Subject: Re: How do I embed C in Perl
Message-Id: <Pine.GSO.3.96.970908083309.27795E-100000@julie.teleport.com>

On Sat, 6 Sep 1997, dave wrote:

> I think I'm more than confused.  I got the impression that C routines
> must be embedded in the perl installation, rather than being
> selectively "loaded" by a script.  If this is not the case, could you
> point me to where there is specific info on how they are selectively
> loaded?

If your machine supports dynamic loading (and most Unix-type systems do,
these days) you can compile Perl to link in relatively small bits of code
at runtime. If you don't have dynamic loading, it's still possible to link
in custom routines. The docs on MakeMaker should help you to get started
with this. Good luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Mon, 8 Sep 1997 08:32:26 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Peter Tiemann <peter@preview.org>
Subject: Re: how do I redirect the output of an existing perl script
Message-Id: <Pine.GSO.3.96.970908082451.27795D-100000@julie.teleport.com>

On Sat, 6 Sep 1997, Peter Tiemann wrote:

> I try to run a script that is on an external server. I do have execute
> rights only on this script, so I cannot copy or modify it.  So.. it is
> not a perl _function_ call, but a _script_ call, where arguments are
> passed in the environment.  E.g.: 

> http://foreign.server.com/cgi-bin/script?parm1=123+parm2=xxx

I'm not sure why you say that you have "execute rights" to this script.
>From the looks of things, All you have is a URL. A browser, given this
URL, will make a request of a server - but what the server does is not
(AFAIK) something you have any direct control over. It depends upon how
the server (and possibly a script) is set up.

> I guess, at first I have to find out, whether it is possible to call a
> perl script from within my perl script? 

Yes, it's possible.

> Second: is it possible that this script is not on my own server? How do
> I reach the other server? 

Use the LWP module. You can get it from CPAN, and it comes with complete
docs.

> Maybe it's completely wrong to approach this with perl on my server but
> I should write something that runs on my machine. 

Probably so; that would eliminate a lot of net-lag.

Good luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Mon, 08 Sep 1997 09:38:24 -0500
From: Brett Denner <Brett.W.Denner@lmtas.lmco.com>
To: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Minimizing Memory Needed for Numbers Read from Binary Files
Message-Id: <34140DDF.41C6@lmtas.lmco.com>


Tom Phoenix wrote:
> 
> >             $array[$j][$i] = unpack "f", $string;
> 
> > This problem with this is that the binary data are converted to a
> > string representation before being stored in @array,
> 
> Do you mean that you think that the list element is getting both 3.14159
> and '3.14159' assigned to it? Whatever gave you that idea? It may be
> true, but I don't believe it. :-)


I ran a simple test script using four different methods of "loading"
the @array list mentioned above.  The script looks like this:

-------------
open(FH, "< file.bin") or die "Error opening file\n";     # Hi, Tom! ;-)

$PI = 4 * atan2(1,1);
$string = pack "f", $PI;
@array;

for ($j=0; $j < 2000; $j++)
    {
    for ($i=0; $i < 2000; $i++)
        {
        # method of loading array (see below)
        }
    }
-------------

I tried each of the following methods for loading @array, and have
listed estimates of the maximum memory used by Perl for each:

    $array[$j][$i] = '3.1415927';              # 234 Mb 
    $array[$j][$i] = 1;                        #  80 Mb
    $array[$j][$i] = $PI;                      # 184 Mb
    $array[$j][$i] = unpack "f", $string;      #  96 Mb

Note that in the latter three cases, I am essentially assigning a
floating
point number (4 bytes on my IRIX) to a 2000 x 2000 array, which requires
a
minimum of 4 * 2000 * 2000 = 16_000_000 bytes of storage.  These three
methods, however, require 5 to 12 times as much memory to store the
array
as would seem to be necessary.

That seems like a lot of overhead, but maybe its necessary because 
of the inner workings of Perl.  Does anyone have any thoughts?

Thanks,
Brett


 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Brett W. Denner                                    Lockheed Martin TAS
 Brett.W.Denner@lmtas.lmco.com                      P.O. Box
748            
 (817) 935-1144 (voice)                             Fort Worth, TX 76101
 (817) 935-1212 (fax)                               MZ 9333


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

Date: Mon, 08 Sep 1997 14:19:44 GMT
From: James.Atkin@Phase.Com (James Atkin)
Subject: Newcomer to the world of Perl, CGI and HTML ...
Message-Id: <873728384.19637.0.nnrp-06.c2d93022@news.demon.co.uk>

Hi there,

I've just startted in the world of Perl, CGI and HTML.
I am trying to do the following :

I have a Web page with a request for a serial number.
I need the entered serial number to be passed to the next web, and
displayed on the screen.

How do I go about doing this ?  I am currently using FrontPage 97.

Also, I will shortly need to pass another number to a Perl Script.
Firstly how do I pass it, and secondly, how do I access it in the Perl 
Script.

Thanks for any help. It greatfully appreciated.

James.




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

Date: Mon, 08 Sep 1997 12:01:25 -0400
From: Peter Smith <smithpl@engr.engr.sc.edu>
Subject: Open(>>append mode) access time question...
Message-Id: <34142155.338C@engr.engr.sc.edu>

Hello,

I'm writing to a log file to record every hit I receive on a particular
html page.  I'm getting concerned that the increasing size of the log
file may be requiring the cgi perl script to work harder to find the end
of the file.  Is this true?  If my log file becomes larger, will the
time it takes to add one line to that file increase?  Does an append do
a seek for the end of the file?  I'm running IRIX 6.2 with Perl 5.  The
ASCII text file is currently about 500K.

<code snippet>
open(LOG,">>some_file") || die;
print LOG "some_stuff";
close(LOG)
</code snippet>

Thanks.

--Peter--
smithpl@engr.engr.sc.edu


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

Date: Mon, 8 Sep 1997 08:43:58 -0700
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Pattern matching problem with \n
Message-Id: <Pine.GSO.3.96.970908084058.27795F-100000@julie.teleport.com>

On Sat, 6 Sep 1997, Ha_Ha_X wrote:

> >    {
> >	my %map;
> >	BEGIN { 
> >	  %map = (
> >	    n => "\n",
> >	    t => "\t",
> >	  '\\'=> "\\",
> >	) }
> >	$somestring =~ s#\\([nt\\])#$map{$1}#g;
> >    }
> 
> This is a lot better than what I had, but unfortunately it still
> doesn't process an arbitrary number of backslashes correctly.  Four
> backslashes should become two, five backslashes should become three
> (unless followed by n or t), etc.

In what way does this code not do what you describe? 

> ~k.lee (e-mail address in my .sig, not in the headers!)

Did someone (mis-)inform you that would-be spammers read only message 
headers? 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Mon, 08 Sep 1997 09:09:24 -0500
From: Jason Kruse <jason.kruse@teldta.com>
Subject: Perl with cygnus
Message-Id: <34140712.C4D04394@teldta.com>

Ok, I was bored last week, so I tried to get perl running on my NT box
at work.  After a little searching, I found that there were free
development tools available for NT which also were pre-configured to
compile perl easilly.  Here's a listing of the steps I took.

1)  Downloaded beta 18 version, installed, configured environment, and
tested gcc and all other utils.
2)  Transfered perl5.004_02, unpacked in /perl5.004, and followed steps
in README.cygwin32.
3) Multiple problems were found, however all were fixed except the
following:  When making Fcntl.c, the compiler would complain about a bad
defenition in op.h where the defenition for op was detailed:

struct op {
    BASEOP
};

The error was a complaint about bad (, followed by a bad }

I worked on this for a day and couldn't find anything which would cause
this.  I attempted to simply put the define into the struct, no dice.
Pull the struct out of op.h and put it in perl.h, nothing.  At this
point I thought it might possibly be an error on the compiler provided
with cygnus, so I went back to beta 17.1, which is what the
README.cygwin32 lists as being designed for, and got the same errors as
before.

Anyone else have good things to say about this?  Words of wisdom
welcome.

 Jason




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

Date: 8 Sep 1997 15:18:19 GMT
From: Gavin Pollock <clearn@cis.co.za>
Subject: script for UNIX .db file
Message-Id: <5v14vr$bhb@news1.saix.net>

Hi,

I'm looking for a script to read the UNIX file .netscape.db , which 
stores the history of the browser. Does anyone have one lying 
around somewhere?

Thanks
Gavin Pollock

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

Gavin Pollock
2nd year Computer Science
UCT, Cape Town, South Africa


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

Date: 8 Sep 1997 15:20:14 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: security of input in reg exp?
Message-Id: <5v153e$m8r$1@lyra.csx.cam.ac.uk>

Tom Phoenix  <rootbeer@teleport.com> wrote:
>On Thu, 4 Sep 1997, Alex Krohn wrote:
>
>> I want to be able to allow people to put input into a reg expression
>> and was wondering about any security problems.
>
>That's good to worry about security holes. Are you saying you want a user
>of your program to specify the regexp to use?
>
>> if ($item =~ /$userinput/) { blah(); }
>> 
>> I don't want to quote $userinput as I want it to be treated as a reg
>> exp. My question is, can users input ` or | or something similiar
>> (perhaps even close the reg exp with a /) and execute a command?
>
>No; Perl will not treat the contents of $userinput as executable code. 
>Even if it has a slash, that won't end the regexp. (But keep reading.) 

That is correct as far as it goes, but of course a regexp can contain
arbitrary executable code, such as

           /@{[system qw|rm -rf /|]}/

So you should do at least _some_ checking or processing of the user input.
I think that escaping @ and $ would suffice.


Mike Guy


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

Date: Mon, 08 Sep 1997 09:17:52 -0500
From: Scott Yanoff <yanoff@alumni.cs.uwm.edu>
To: rhritz@ix.netcom.com
Subject: Re: simple Sendmail Question (Newbie)
Message-Id: <34140910.22AB@alumni.cs.uwm.edu>


Ronald Hritz wrote:
> 
> I am attempting to send e-mail from an HTML form to a Fax gateway
> through Formmail.pl 1.6. I need to alter the From field to my
> personal e-mail address so the fax server will process the message.
> Currently, the e-mail header is "nobody@mimas.domain.com"
> I've alter the PRINT MAIL From: my email address command in Formmail
> but it doesn't work. Our webmaster says to change the Sendmail command
> using the -f parameter. What would be the correct syntax ?
> 
> Currently the cammand is set as :
> OPEN(MAIL,"|$mailprog -t");

I think one other thing needs to be done in order for sendmail to accept
a new "From" line... I believe that if you are running this via a CGI,
you need to add "nobody" to the list of trusted users that sendmail will
accept "From" changes from.  This is assuming that your web server is
running as user "nobody", of course.  I am sure your webmaster can edit
the necessary configuration files to try this, if they are willing. 
Letting another user be a "trusted" user does open up some security
issues.

-Scott


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

Date: Mon, 8 Sep 1997 15:26:51 GMT
From: Carry Megens <Carry.Megens@nym.sc.philips.com>
Subject: URL info utility (for your web pages)
Message-Id: <3414193B.2229@nym.sc.philips.com>

This is a multi-part message in MIME format.

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

Hello all,

I post this CGI utility (see attachement) here since I think it is very
handy 
for maintaining web pages. 

The utility uses the HEAD method to get size, type, date, time last
modified of any
URL and return is as a GIF image. You can specify the font and the color
used.

Feel free to use, modify, distribute, whatever, but leave my name in
there.
Have fun,

-- 
Carry Megens           Designflow Services  M 2.039        !!!
Philips Semiconductors Consumer IC                        (0o0)
Gerstweg 2             6534 AE Nijmegen                    \U/
Nijmegen               the Netherlands
talkto: +31-24-353 3590
seri  : nymegens@nyhp03
mailto:Carry.Megens@nym.sc.philips.com
http://cicc06.nym.sc.philips.com:8080/~nymegens (intrAnet)

--------------14F2F086317
Content-Type: application/x-perl; name="urlinfo.pl"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="urlinfo.pl"

IyEvdXNlci93d3dkcy9iaW4vcGVybAojIEFkYXB0IGxpbmUgMSB0byB5b3VyIHBlcmwgbG9j
YXRpb24sIHNlZSBhbHNvIHVzZSBmb3IgbW9kdWxlcyBuZWNlc3NhcnkhCiMtLS0tLS0tLS0t
LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t
LS0tLS0tCiMKIyBBdXRob3IgIDogIENhcnJ5IE1lZ2VucyAoQ2FycnkubWVnZW5zQG55bS5z
Yy5waGlsaXBzLmNvbSkKIyAgICAgICAgICAgIChjKSAxOTk3IENhcnJ5IE1lZ2VucwojICAK
IyBEYXRlICAgICA6IEZyaSBTZXAgIDUgMTM6NDg6MzEgTUVURFNUIDE5OTcKIyBGdW5jdGlv
biA6IFJldHVybiBzbWFsbCBHSUYgd2l0aCBpbmZvIChzaXplLCBkYXRlLCB0aW1lIGxhc3Qg
bW9kaWZpZWQsIHR5cGUpIAojICAgICAgICAgICAgb2YgYW55IFVSTCB1c2luZyBIRUFEIG1l
dGhvZAojICAgICAgICAgICAgVGhpcyBpcyBmcmVld2FyZSwgZmVlbCBmcmVlIHRvIHVzZSAs
IG1vZGlmeSwgZGlzdHJpYnV0ZSwgYnV0CiMgICAgICAgICAgICBsZWF2ZSBteSBuYW1lIGlu
IHRoZXJlLgojCiMgVXNlcyAgICAgOiBVdGlsaXR5IG1ha2VzIHVzZSBvZiBzZXZlcmFsIGZy
ZWUgYXZhaWxhYmxlIHBlcmwgbW9kdWxlcy4KIyAgICAgICAgICAgIC0gQ0dJIGFuZCBHRCBv
ZiBMaW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wKCJGb3IgZXhhbXBsZSwgd2l0aCBjb2RlOiIpLCJcbiIsCiAg
ICAgICAgICBwKCc8Zm9udCBzaXplPS0xPicsaSgiJmx0O0EgSFJFRj0kZXhhbXBsZVVSTCZn
dDskZXhhbXBsZVVSTCZsdDsvQSZndDsKICAgICAgICAgICAgICAmbHQ7aW1nJm5ic3A7c3Jj
PSRteXNlbGY/dXJsPSRleGFtcGxlVVJMJmFtcDtpbmZvPXNpemUsZGF0ZSZndDsiKSwgJzwv
Zm9udD4nKSwKICAgICAgICAgIHAoIllvdSB3b3VsZCBnZXQ6IiksICAgIAogICAgICAgICAg
YSh7aHJlZj0+IiRleGFtcGxlVVJMIn0sICIkZXhhbXBsZVVSTCIpLCJcbiIsCiAgICAgICAg
ICBpbWcoe3NyYz0+IiRteXNlbGY/dXJsPSRleGFtcGxlVVJMJmluZm89c2l6ZSxkYXRlIn0p
LCJcbiIsCiAgICAgICAgICBociwiXG4iLAogICAgICAgICAgcCgiWW91IGNhbiB0cnkgeW91
ciBvd24gVVJMIGluIHRoZSBmb3JtIGJlbG93IiksIlxuIiwKICAgICAgICAgIHN0YXJ0X2Zv
cm0sIlxuIiwKICAgICAgICAgICJVUkwgOiAiLCB0ZXh0ZmllbGQoLW5hbWU9Pid1cmwnLCAK
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLXNpemU9PjQwLAogICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAtdmFsdWU9PidodHRwOi8vJyksYnIsIlxuIiwKICAgICAgICAg
ICJJbmZvOiAiLCBjaGVja2JveF9ncm91cCgtbmFtZT0+J2luZm8nLAogICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgIC12YWx1ZXM9Plsnc2l6ZScsJ2RhdGUnLCd0aW1lJywn
dHlwZSddLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC1kZWZhdWx0PT5b
J3NpemUnLCdkYXRlJ10pLGJyLCJcbiIsCiAgICAgICAgICAiQ29sb3IgKFIsRyxCKTogIiwg
dGV4dGZpZWxkKC1uYW1lPT4ncmdiJywgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAtc2l6ZT0+MTEsIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgLW1heGxlbmdodD0+MTEsIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgLXZhbHVlPT4nMjU1LDAsMCcpLGJyLCJcbiIsCiAgICAgICAgICAiRm9udDogIiwgcG9w
dXBfbWVudSgtbmFtZT0+J2ZvbnQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
LXZhbHVlcz0+Wyd0aW55JywgJ3NtYWxsJywgJ21lZGl1bWJvbGQnLCAnbGFyZ2UnXSwKICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgIC1kZWZhdWx0PT4nc21hbGwnKSwiXG4iLCAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgc3VibWl0KCJTaG93IGlu
Zm8iKSwiXG4iLAogICAgICAgICAgZW5kX2Zvcm0sIlxuIiwKICAgICAgICAgIGhyLAogICAg
ICAgICAgYWRkcmVzcygiUmVhY3Rpb25zIHRvIiwgYSh7aHJlZj0+Im1haWx0bzpDYXJyeS5N
ZWdlbnNcQG55bS5zYy5waGlsaXBzLmNvbSJ9LCAiQ2FycnkgTWVnZW5zIiksCiAgICAgICAg
ICAgICAgICAgIGJyLCAiTW9uIFNlcCAgOCAxNjo0MDo1NCBNRVREU1QgMTk5NyIpLAogICAg
ICAgICAgZW5kX2h0bWw7Cn0KZWxzZSAjIE9LIGxldCdzIGRvIHRoZSBqb2IKewogICAkdXJs
ICAgICAgPSBwYXJhbSgndXJsJyk7CiAgICRmb250ICAgICA9IHBhcmFtKCdmb250Jyk7CiAg
ICRyZ2IgICAgICA9IHBhcmFtKCdyZ2InKTsKICAgJGluZm8gICAgID0gam9pbigiLCIsIHBh
cmFtKCdpbmZvJykpOyAKCiAgIEBj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KICAgICAgIHBy
aW50IGhlYWRlciwKICAgICAgICAgICAgIHN0YXJ0X2h0bWwsCiAgICAgICAgICAgICAkcmVz
cG9uc2UtPmVycm9yX2FzX0hUTUwsCiAgICAgICAgICAgICBwKCJDaGVjayB0aGUgVVJMICR1
cmwiKSwKICAgICAgICAgICAgIGVuZF9odG1sOwogICB9Cn0K
--------------14F2F086317--



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

Date: Mon, 8 Sep 1997 15:35:29 GMT
From: Carry Megens <Carry.Megens@nym.sc.philips.com>
To: Michael O'Sullivan <osullm@cork.cig.mot.com>
Subject: Re: utility for managing NIS password, groups and aliases files
Message-Id: <34141B41.73E4@nym.sc.philips.com>

Michael O'Sullivan wrote:
> 
> Hi all,
> 
> I have recently discovered perl and look forward to programming in it.
> 
> My first project involves coming up with a user interface to the
> /etc/{passwd,group,aliases} files.
> 
> I want to be able to maintain these files and keep a record of the
> transactions in an Oracle database.
> 
> Now, one of my colleagues can handle the Oracle side of it.
> 
> Where can I find a few handy scripts to manage the NIS files, e.g.
> creating new accounts, adding users to UNIX groups etc.?
> 
> I'm sure this must have been done already.
> 
> Is perl the best way to do this?
> 
> Thanks in advance, Mike.
> 
> --
>  _/ \_/ \_   Michael O'Sullivan       | 'Phone : +353-21-511204
> / \_/ \_/ \  Motorola Ireland Ltd.    | Fax    : +353-21-357635
> \_/ \_/ \_/  Mahon Industrial Estate  | Email  : osullm@cork.cig.mot.com
> / \ / \ / \  Blackrock, Cork, Ireland.| POST   : QCOR150@email.mot.com

I was looking for something similar and found this:

http://www.rz.uni-frankfurt.de/home/ftp/pub/CPAN/modules/by-module/Net/NISPlus-0.04-alpha.readme

Enjoy,
-- 
Carry Megens           Designflow Services  M 2.039        !!!
Philips Semiconductors Consumer IC                        (0o0)
Gerstweg 2             6534 AE Nijmegen                    \U/
Nijmegen               the Netherlands
talkto: +31-24-353 3590
seri  : nymegens@nyhp03
mailto:Carry.Megens@nym.sc.philips.com
http://cicc06.nym.sc.philips.com:8080/~nymegens


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

Date: 8 Sep 1997 15:57:10 GMT
From: gbacon@adtran.com (Greg Bacon)
To: tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~)
Subject: Re: Weighting elements of an array
Message-Id: <5v178m$dgs$1@info.uah.edu>

[Posted and mailed]

In article <5up9or$rvq$1@news.fm.intel.com>,
	tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~) writes:
: Tom Phoenix (rootbeer@teleport.com) so eloquently and verbosely pontificated:
: >     $commands = [
: > 	# Each one is a weight followed by a coderef
: > 	[ 60 =>	\&cmd1 ],
: > 	[ 30 =>	\&cmd2 ],
: > 	[ 10 => sub { sleep 5 } ],	# Inline if you wish
: >     ];
: 
: hmmm.  thats a pretty interesting way of declaring the array.  i like
: that.

The above $commands isn't an array: it's a reference to an anonymous
array.  The distinction is extremely important.  An array would have
been declared as

    @commands = (
        # Each one is a weight followed by a coderef
        [ 60 => \&cmd1 ],
        [ 30 => \&cmd2 ],
        [ 10 => sub { sleep 5 } ],      # Inline if you wish
    );

List vs. scalar context can result in some painful bites if you aren't
careful.

Hope this helps,
Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: 8 Sep 1997 15:52:44 GMT
From: "Lloyd " <_lloyd_@vwv.com>
Subject: what has it got in its ssocketses?
Message-Id: <01bcbc6f$b7255480$10791fc4@finley>

Hya-All

I was wondering if anybody could help me solve this tricky beast....
I am trying to initialise a Socket which in the end will connect to a
listening POP3 port. (Haven't even got to the binding of the socket or the
connecting etc...). Pretty simple stuff I thought!
A snippet of my script (the only two lines which affect the problem that I
can see) follows:
--
  ($dummy1, $dummy2, $prototype) = getprotobyname("TCP");
  #$prototype contains 6 now if this means anything to you
  socket(SOCKET, 2, 1, $prototype) || do {&error("Socket not
Initialised\n$!");};
--
Anyway - I ran my script on a Solaris box (running perl 5.004) and then on
another Solaris box (running perl 5.004_02) and keep running into the same
error. [I ran the script as root and as me.]
$! contains the text: 'Protocol not supported'. The script terminates at
the &error routine.

Eek, thought I, so I ran it on a linux box (Perl 5.003 with EMBED and
SuidPerl security patches), and the lines work - the socket gets created
and everyone lives happily ever after. The problem is - is that the script
Needs to work on Solaris. 

So please, if anyone has any bright ideas , gimme a buzz :)

Lloyd



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

Date: Mon, 8 Sep 1997 17:01:13 +0100
From: "Jonathan Tracey" <jont@uunet.pipex.com>
Subject: Re: where's gunzip and tar for dos/win?
Message-Id: <5v17gf$f5g$1@soap.uunet.pipex.com>

 You can use winzip to undo the files

Its availible form http://www.winzip.com

Hope this helps

Jon


stephen wrote in article <01bcbc47$9b16e4c0$60f8aecc@direct.ca.direct.ca>...

>Just downloaded the latest Perl for Windows/DOS,
>but it's in a gzipped and tar format:
>
> perl5_00402-bindist04-bc_tar.gz
>
>which utility do I use to gunzip and tar it?
>
>thanks
>stephen




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

Date: 8 Sep 1997 15:07:11 GMT
From: Zenin <zenin@best.com>
Subject: Re: Wrote new module, need help with system dependencies.
Message-Id: <5v14av$oc0$2@nntp2.ba.best.com>

Bart Lateur <bart.mediamind@tornado.be> wrote:
> >But watch out if you want *unsigned* longs or shorts, because those don't
> >have their own pack() formats. You'll need to manually swap the result of
> >a "native" unpack() where appropriate.
> short to ushort (16 bits):
> 	$_ < 0 and $_+=(1<<16);
> long to ulong (32 bits):
> 	$_ < 0 and $_+=(1<<32);

	Isn't this all in POSIX somewere?  Or at least wrapped in another
	simple module?  Sorry, but I'm a programmer so the most math I
	like to do myself is $i++. :^)

-- 
-Zenin
 zenin@best.com


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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

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

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


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

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