[8205] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1823 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 6 15:14:01 1998

Date: Fri, 6 Feb 98 12:00:25 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 6 Feb 1998     Volume: 8 Number: 1823

Today's topics:
    Re: Array and Split? <keefner@kinetic.com>
    Re: best way of doing sort|uniq (sort -u) in perl <jdporter@min.net>
        Building a valid string <davidh@wwwpromote.com>
        Error Message: Can't call method ???? (Albert W. Dorrington)
    Re: flocking questions! <dboorstein@shopcfn.com>
    Re: flocking questions! <cnewell@ableweb.com>
        formmail and PGP? (Mike Artobello)
    Re: gethostbyaddr example please (Mike Stok)
    Re: gethostbyaddr example please <xxTony.Curtis@vcpc.univie.ac.at>
        Help please: parten searching using a wildcard like sta (Sylvain Juneau)
    Re: How do I post to cgi from PERL script? <doug@weboneinc.com>
    Re: How write to a file using "format" & "write" ? <doug@weboneinc.com>
        Laola for VMS (Word viewer and converter) (Patrick MOREAU, CENA Athis, Tel: 01.69.57.64.40)
    Re: Looking for simple FTP server (Mats Persson)
    Re: netscape.hst regex (Clay Irving)
    Re: Newbie question re: Sorting (Mick Farmer)
        pattern with a star in it (Sylvain Juneau)
    Re: perl pointer puzzle <dboorstein@shopcfn.com>
        PERL Programming Workshop <dlm00@tecknow.com>
    Re: Perl, Tcl and Expect? (Matthew H. Gerlach)
        Saving variables? (Burt Lewis)
    Re: Saving variables? <dgoddard@us.oracle.com>
        Script runs, but not as batch <3.14@Math.MIT.edu>
    Re: Script runs, but not as batch (Mike Stok)
    Re: Script runs, but not as batch (Richard Bellavance)
    Re: searching by file creation/modification date? (Michael Wang)
        secure perl mpach@post.cz
    Re: secure perl <mike@ns.minivend.com>
    Re: solution for multiline comments??? (Sitaram Chamarty)
    Re: Syntax-coloring editor for NT <Peter.Kruse@psychologie.uni-regensburg.de>
    Re: The perl institute still alive ? (Chip Salzenberg)
        The Specified module can not be found. <stuartg.pcrsys@minorplanet.com>
        Upload file whit CGI.pm??? <EI952942@uqac.uquebec.ca>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 06 Feb 1998 19:51:05 GMT
From: "Craig A. Keefner" <keefner@kinetic.com>
To: MARTIN@RADIOGAGA.HARZ.DE
Subject: Re: Array and Split?
Message-Id: <34DB6850.1FFF112E@kinetic.com>

Martin Vorlaender wrote:

> This is where (at least one of) your problems are: see the line break after
> VALUE="510-602R ?
> Use the chomp() function to get rid of trailing newlines when reading your
> data; else the substr( .., -9) will chop off the wrong part (and the
> s/\.*\s*$// will not work).

I took the code and duplicated it exactly on my Sun and you're
right, it works perfect.  I went ahead and used a chomp to eliminate the
trailing dots. Now I'm going to try and figure out how I can eliminate the
reading into a tmp file and reading it back to the array. Thank you very much
Martin!

open(JUSTDO, "|prtfind.exe /s $year>/tmp/$$.file");
close(JUSTDO);
unless (open(MYFILE, "/tmp/$$.file")) {
    die ("cannot open file");
}
@array=<MYFILE>;
chomp(@array);

for $i (0..$#array) {
  $partno[$i] = substr( $array[$i], -9 );
  $text = substr( $array[$i], 1, -9 );
  $text =~ s/\.*\s*$//; # strip off trailing "..."
  $label{$partno[$i]} = $text;
}

use CGI;
   $query2 = new CGI;
   print $query2->start_html("GET SUB PART");
   print $query2->startform('POST',"testmake.pl/1");
   print $query2->radio_group('group_name', \@partno, '-', 1, \%label);
   print $query2->submit('submit','Enter');
   print $query2->endform;
   exit(0);





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

Date: Fri, 06 Feb 1998 11:30:18 -0500
From: John Porter <jdporter@min.net>
Subject: Re: best way of doing sort|uniq (sort -u) in perl
Message-Id: <34DB3A9A.6BF8@min.net>

Tony Nugent wrote:
> 
> I have a perl array, @RAWDATA.
> I really need to do a "sort | uniq" ...

First, remember that the unix 'uniq' program requires duplicates
to be consecutive in the list, which is why 'sort' has to come
first.  We have no such restriction in Perl.  It's easier to
sort second -- or not to sort at all, if we don't really need
the items ordered.

sub uniq {
  my %u;
  @u{@_} = ();
  keys %u;
}

@data = sort &uniq( @RAWDATA );

hth,
John Porter


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

Date: Fri, 06 Feb 1998 12:21:26 -0600
From: David Hasbrouck <davidh@wwwpromote.com>
To: davidh@wwwpromote.com
Subject: Building a valid string
Message-Id: <886788273.523239437@dejanews.com>

I have a strange data issue that I just can not determine how to display
the string correctly (which is passed via commandline).  I believe it has
something to do with the & sign and section as the data (&section is what
I am trying to build on).

Here is the code:

   if ($filesection ne "" && $filesection ne "NULL")
   {
      if ($atleastone == 1) {
         $thecommandline .= "\&";  }
      $thecommandline .= $filesection . "=" . $formsection;
      $atleastone = 1;
   }

$filesection = "section"
$formsection = "Business"
$atleastone = means more than one item on line
$thecommandline = the http/cgi commandline I am sending

What happens when this is ran is that the &sect piece is converted into
the double SS character ('ion=Business	not sure if it will display)

If I change $filesection to "fection", it will display as &fection (but
this does me no good).

I assume &sect must be some function call.

Is there a way to build this string correctly?

Hope I explained this correctly...

Thanks!

David Hasbrouck

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


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

Date: 6 Feb 1998 14:25:32 -0500
From: awdorrin@mail.delcoelect.com (Albert W. Dorrington)
Subject: Error Message: Can't call method ????
Message-Id: <6bfo3c$1r9@ws051eng.ictest.delcoelect.com>


Hi All,

	I've written a perl program running under perl 5.004_01
which gives the following error message when executed:

Can't call method "SASIS_" without a package or object reference
at psv2sas.pl line 120.

The offending code is:

#
`sas "SASIS_$$.sas"`;
# 

It seems that Perl is getting confused by my syntax and I am
not quite sure why.

All I am attempting to do is execute sas with a filename I have
created within my perl program.

Earlier I've created the file with the statement:

open ( TMP, ">SASIS_$$.sas");

which should create a filename similar to: SASIS_12345.sas
where $$ is the current process ID.

Any ideas on what I am doing wrong?

- Al

-- 
Al Dorrington                                      
FIRMS & Web Admin, Oracle DBA                     Phone: 765-451-9655 
IC-DELCO CIM, Delphi Delco Electronics Systems    Fax:   765-451-8230 


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

Date: Fri, 06 Feb 1998 10:59:20 -0500
From: Dan Boorstein <dboorstein@shopcfn.com>
To: gedavis3@vt.edu
Subject: Re: flocking questions!
Message-Id: <34DB3358.E6532B43@shopcfn.com>

Jerry Davis wrote:
> 

*cut*

> 
> Playing around I removed the flock line from shortflock.pl.  So the
> longflock script flocks the file, but the shortflock does not.  Now this
> script does not work.  Although the longflock is flocking, shortflock does
> not "see" it and just get's to the print line right away.

flock is an advisory for *cooperating* processes. that is, those that
also use flock. if you remove a flock then your are no longer
cooperating and can open the file at will.

*cut*

> *The problem is script2 has the unmodified file loaded in memory, and when
> the flock breaks it will modify the file destroying any changes script1 has
> made.

only if you have loaded it into memory via I/O. i believe your
filehandle is still pointed at the beginning of the file, so when you
begin reading you will see any modifications that have occurred. try
the following test variation to see for your self.

--longflock.pl--

open(FILE, ">file.txt") || die $!;
flock(FILE,2);
sleep(10);
print FILE 'new text';
close(FILE);

--shortflock.pl--

open(FILE, "file.txt") || die $!;
flock(FILE,2);
while(<FILE>) {
  print;
}
close(FILE);


--
dan boorstein <dboorstein@shopcfn.com>


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

Date: Fri, 06 Feb 1998 14:19:09 -0500
From: Chris <cnewell@ableweb.com>
Subject: Re: flocking questions!
Message-Id: <34DB622D.7D00CC81@ableweb.com>

Hello...

As long as we're on the subject....
Is there a way to flock a dbm file? I have a web site that uses dbms extensively
and this
would be an issue for me..

Thanks,
Chris
cnewell@ableweb.com





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

Date: 6 Feb 1998 11:41:22 -0800
From: marto@ccnet.com (Mike Artobello)
Subject: formmail and PGP?
Message-Id: <6bfp12$4a9$1@ccnet3.ccnet.com>

I'm looking for a version of Matt Wright's formmail that supports PGP. I 
hate to reinvent the wheel, so if anyone has one can you either post it 
here or email it to me.

Thanks in advance.

-- 
Regards,

Mike
____________________________ 
Mike Artobello (Concord, CA) 
 
email: marto@ccnet.com               
WWW:   http://www.ccnet.com/~marto


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

Date: 6 Feb 1998 11:02:43 -0500
From: mike@stok.co.uk (Mike Stok)
Subject: Re: gethostbyaddr example please
Message-Id: <6bfc73$6e1$1@stok.co.uk>

In article <Pine.GSO.3.95q.980206154051.22549A-100000@highgate>,
AFL  <sa346@city.ac.uk> wrote:
>I'm trying to use gethostbyaddr() and am having real problems, I just
>can't fathom-out what perl expects.  Anyone got an example? 

The examples at the beginning of the Socket module's documentation
include:

           $iaddr = gethostbyname('hishost.com');
           [...]
           ($port, $iaddr) = sockaddr_in(getpeername(Socket_Handle));
           $peer_host = gethostbyaddr($iaddr, AF_INET);

$iaddr is a packed address, in the debugger:

  DB<1> $packed = pack 'C*', 206, 119, 234, 142

  DB<2> @l = gethostbyaddr $packed, 2

  DB<3> X l
@l = (
   0  'p13.ts8.newyo.NY.tiac.com'
   1  ''
   2  2
   3  4
   4  'Nwj'
)

using the Socket module is a good way of wrapping up details such as the
value of AF_INET and the layout of structures which may vary from system
to system.

perldoc is the command which should be installed with recent perls which
lets you view module documentation.

Hope this helps,

Mike
-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: 06 Feb 1998 17:21:18 +0100
From: Remove xx to reply <xxTony.Curtis@vcpc.univie.ac.at>
To: sa346@city.ac.uk
Subject: Re: gethostbyaddr example please
Message-Id: <7xlnvoembl.fsf@beavis.vcpc.univie.ac.at>

Re: gethostbyaddr example please, AFL <sa346@city.ac.uk>
said:

AFL> I'm trying to use gethostbyaddr() and am having real
AFL> problems, I just can't fathom-out what perl expects.
AFL> Anyone got an example?

    use Socket;

    # pack the x.x.x.x address
    $paddr = pack("C4", split(/\./, $ip));

    # look it up
    ($name,$aliases,$addrtype,$length,@addrs) =
        gethostbyaddr($paddr, AF_INET);

What exactly do you want to do with the answer?

Maybe there's already a higher-level solution in CPAN
somewhere...

    http://www.perl.com/CPAN/

e.g.

    IO::Socket::INET ??

tony


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

Date: Fri, 06 Feb 1998 18:51:47 GMT
From: sjuneau@microtec.net (Sylvain Juneau)
Subject: Help please: parten searching using a wildcard like star
Message-Id: <34dc5b43.23619424@news.cmc.ec.gc.ca>

I have this file :

emask   A700*P		
imask   *P	 	dbim      2   Y   food/cis dbadd
imask   *C		dbim      2   Y   food/cis dbadd


I have another file. I open that file and I want to search in it:

A700*P   then *P  then *C.

My question is how do I search through this file using a wildcard?

I assume you use a pattern matching  but how???


Thank you very much

Sylvain

e-mail sjuneau@microtec.net


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

Date: Fri, 06 Feb 1998 13:05:14 -0500
From: Douglas Clifton <doug@weboneinc.com>
Subject: Re: How do I post to cgi from PERL script?
Message-Id: <34DB50D9.1ABEA564@weboneinc.com>

Jay White wrote:
> 
> How do I do the equivalent of an HTML post to a cgi script on another server
> from my PERL cgi?
> 
> I want my PERL script to do this:
>  <form method="POST" action="http://www.otherdomain.com/cgi-bin/script.cgi">
>  <input type="hidden" name="reqtype" value="secure">
>  <input type="hidden" name="account" value="7588105">

A form requires the interaction of a user, try using a Location
header instead:

print "Location:
http://www.xyz.com/cgi-bin/script.cgi?reqtype=secure&account=7588105\n\n";
-- 
Douglas Clifton
Unix/C/Perl/CGI/HTML Programmer
doug@weboneinc.com

===================
Web One Inc.
Website Development
Phone: 888-699-WEB1
Phone: 616-552-9999
Fax:   616-552-9920
sales@weboneinc.com
www.weboneinc.com
===================


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

Date: Fri, 06 Feb 1998 12:49:39 -0500
From: Douglas Clifton <doug@weboneinc.com>
Subject: Re: How write to a file using "format" & "write" ?
Message-Id: <34DB4D33.68B83E8A@weboneinc.com>

Joey Garcia wrote:
> 
> I want to mail a formatted report and I am using the "format" and
> "write" command, but that outputs the data to the STDOUT.  How can I
> have it write to a file for emailing?  Please be specific, thanks!

Any relation to Jerry? ;-)

Try:

$~ = "MyFormat";	# select your format
write FILE;		# write to FILE rather than STDOUT

or

format FILE = 		# write format to FILE
 ...
 .
write;

or

use FileHandle;
FILE->format_name("MyFormat");
write FILE;

or...	# as usuall there are an infinite number of ways of doing
something in Perl

-- 
Douglas Clifton
Unix/C/Perl/CGI/HTML Programmer
doug@weboneinc.com

===================
Web One Inc.
Website Development
Phone: 888-699-WEB1
Phone: 616-552-9999
Fax:   616-552-9920
sales@weboneinc.com
www.weboneinc.com
===================


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

Date: 6 Feb 98 17:17:24 +0100
From: pmoreau@cenaath.cena.dgac.fr (Patrick MOREAU, CENA Athis, Tel: 01.69.57.64.40)
Subject: Laola for VMS (Word viewer and converter)
Message-Id: <1998Feb6.171724.1@sable>

Laola is now available for OpenVMS VAX & Alpha. Laola is a set of nice perl
scripts letting you analyze, convert and view a Microsoft Word ) file.

I've added 3 dcl scripts to convert and view easily Word files. Two of them are
suited for use as Web Word viewers, called by a browser (tested with Mosaic and
Netscape).

You can find the kit at url:

  http://www2.cenaath.cena.dgac.fr/ftp/vms/laola011.zip

I was tired to launch Softwindows, and WIN under Softwin and Word under WIN
each time I needed to view a word file sent into a mail. Laola is a nice
workaround. 

I don't know if we'll have one day the ability to execute NT Alpha binaries
under OpenVMS (or Intel binaries via FX!32). I was told that it was made
sometimes ago, using the WIN32 DLLs (Bristol) and a modified image loader, but
Microsoft don't agree for licencing reasons (with Softwindows, you pay a WIN
3.1 licence). Compaq, if you read this group, please give us this pleasure !!

You need at least Perl version 4 to run laola. I have source and VMS binaries
of Perl 5.003 at my site:

  http://www2.cenaath.cena.dgac.fr/ftp/vms/PERL5003_AXP_EXE_V62.ZIP
  http://www2.cenaath.cena.dgac.fr/ftp/vms/PERL5003_VAX_EXE_V552.ZIP
  http://www2.cenaath.cena.dgac.fr/ftp/vms/PERL5_003.ZIP

Enjoy !!

Patrick  
-- 
===============================================================================
pmoreau@cena.dgac.fr  (CENA)     ______      ___   _           (Patrick MOREAU)
moreau_p@decus.decus.fr(DECUS)  / /   /     / /|  /|
CENA/Athis-Mons FRANCE         / /___/     / / | / |   __   __   __   __  
BP 205                        / /         / /  |/  |  |  | |__| |__  |__| |  |
94542 ORLY AEROGARE CEDEX    / /   ::    / /       |  |__| | \  |__  |  | |__|
Web Page: http://www2.cenaath.cena.dgac.fr/~pmoreau/
===============================================================================


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

Date: 6 Feb 1998 18:24:30 GMT
From: matpe@lin.foa.se (Mats Persson)
Subject: Re: Looking for simple FTP server
Message-Id: <6bfkgu$81g$1@mercur.foa.se>

Darryl Caldwell <darrylc@eznet.com> writes:

>I am looking for examples of simple ftp servers written in Perl. Has
>anyone written such and animal? Please email response as well as
>post to this group. TIA

Yes, I have written a simple ftpserver in Perl. It is intended
for a MUD, but the next version (real soon) will be usable
on a Unix system.  The most interesting feature in this server
is the ACL system for protecting files and directories.
It also has a couple of other security features.

ftp://ftp.lysator.liu.se/pub/lpmud/mftpd/mftpd-2.0.tar.gz


----------------------------------------------------------------------
Mats Persson  M.Sc. Research Engineer
National Defence Research Establishment  
Department of Command and Control Warfare Technology
Computer Security Group
Email: matpe@lin.foa.se     Phone: int +46 13 318214
Smail: PO Box 1165, S-581 11 Linkoping, Sweden
--
----------------------------------------------------------------------
Mats Persson  M.Sc. Research Engineer
National Defence Research Establishment  
Department of Command and Control Warfare Technology
Computer Security Group
Email: matpe@lin.foa.se     Phone: int +46 13 318214
Smail: PO Box 1165, S-581 11 Linkoping, Sweden


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

Date: 6 Feb 1998 14:01:17 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: netscape.hst regex
Message-Id: <6bfmlt$lsg@panix.com>

In <34DB2841.16A6D012@nsinet-nospam-.com> Cam Bevis <cbevis@nsinet-nospam-.com> writes:

>I'm trying to parse a netscape.hst file (about:global doesn't work since
>the file is corrupted).

>Its a 4 byte hex string (the date, captured to $1), followed by
>"http://",
>followed by the URL(captured to $2). I think I have a byte
>ordering/hex->decimal->date conversion problem too,
>but I'm not tackling that right now(any pointers would be welcomed,
>though).

>Here's (what seems to be) a record looks like:

>>;d4http://www.databaseamerica.com/image/dba_anim.gif

>...and here's the code I'm trying to use?

>open HISTORY, "netscape.hst";
>my $Data = <HISTORY>; # whole file as a single string
>while( $Data =~m|(.{4})http://(.*)|igs)
>   { $mytime= $1; $url= $2;  $mytime=pack("H*", unpack("V*",
>$mytime));$mytime=gmtime $mytime;print "$mytime $url \n"; }


>Has anybody done this before, or can I get a shove in the right
>direction?

Perl Modules are your friend.

Take a look at:

  Netscape::History
  http://www.perl.com/CPAN-local/authors/id/NEILB/
  The Netscape::History module implements an object class for accessing 
  the history database maintained by the Netscape web browser. The history
  database keeps a list of all URLs you have visited, and is used by 
  Netscape to change the color of URLs which you have previously visited, 
  for example. 

pod available at:

  http://reference.perl.com/wrap.cgi?netscape-history

-- 
Clay Irving <clay@panix.com>                  I think, therefore I am. I think? 
http://www.panix.com/~clay/


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

Date: Fri, 6 Feb 1998 17:17:01 GMT
From: mick@picus.dcs.bbk.ac.uk (Mick Farmer)
Subject: Re: Newbie question re: Sorting
Message-Id: <Enyw0E.5JB@mail2.ccs.bbk.ac.uk>

Dear Chris,

the simplest solution is to hand-craft a comparison
subroutine.  You say

	@sorted = sort by_points @unsorted;

and define by_points something like this

	sub by_points {
		my ($na, $pa) = ($a =~ /^(\w+).*(\d+) points/);
		my ($nb, $pb) = ($b =~ /^(\w+).*(\d+) points/);
		$pa <=> $pb or $na cmp $nb;
	}

which you can tweek to give you the desired ordering.

Regards,

Mick


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

Date: Fri, 06 Feb 1998 17:29:12 GMT
From: sjuneau@microtec.net (Sylvain Juneau)
Subject: pattern with a star in it
Message-Id: <34db44a2.17826231@news.cmc.ec.gc.ca>

I have this file :

emask   A700*P		
imask   *P	 	dbim      2   Y   food/cis dbadd
imask   *C		dbim      2   Y   food/cis dbadd


I have another file. I open that file and I want to search in it:

A700*P   then *P  then *C.

My question is how do I search through this file using a wildcard?

I assume you use a pattern matching  but how???


Thank you very much


Sylvain

e-mail sjuneau@microtec.net


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

Date: Fri, 06 Feb 1998 12:50:49 -0500
From: Dan Boorstein <dboorstein@shopcfn.com>
Subject: Re: perl pointer puzzle
Message-Id: <34DB4D79.9B6A5ECE@shopcfn.com>

Andrew M. Langmead wrote:
> 
> Damian Berger <dberger@uwyo.edu> writes:
> 
> >I am trying to do some pointer de-referencing,  but can't get perl to
> >de-reference correctly... here is the script that illustrates my
> >problem.
> 
> > $temp{'var'} = "variable";
[cut]
> The first question, is there a reason to use the symbolic reference
> "$temp{var} = 'variable'"? Look it over again. Symbolic references are
[cut]

hmm, perhaps i am a bit confused. i thought:

  $temp{var} = 'variable'

was an assignment of the string 'variable' to the hash 'temp' at
subscript 'var'. clarifications?

--
dan boorstein <dboorstein@shopcfn.com>


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

Date: 6 Feb 1998 18:42:08 GMT
From: "Dennis Matson" <dlm00@tecknow.com>
Subject: PERL Programming Workshop
Message-Id: <01bd332e$f1ee9960$06ca2ccf@w95-01.cassys.com>

TechKnowledge Corporation (Formerly Amdahl Education) offers a high quality
instructor-led 5 day Perl Programming Workshop in Columbia MD and Boston
MA.  The course outline is below.  If interested, please contact Dennis
Matson at 800-416-4561, reply to author, send email to dlm00@tecknow.com or
visit our web-site at www.tecknow.com.  

Course Name : PERL Programming Workshop 
Duration : 5.00daysTuition : $1775.00
------------------------------------------------------------------------
Audience
Programmers, end users, system administrators, network administrators, CGI
script writers, or anybody who wishes to automate network tasks without
having to learn the minutia of a full blown programming language.
Prerequisites: Some experience with either any programming (preferably C),
or any of the UNIX shells. 
------------------------------------------------------------------------
Objectives
Students will be able to write scripts that: * Manipulate files and
directories * Use the powerful regular expression capabilities of PERL *
Generate awk like reports * Solve problems by using PERL's associative
array capability * Take advantage of PERL's powerful interface to UNIX *
Perform network communications including those tasks accomplished by CGI
programming * Perform many system administrator functions 
------------------------------------------------------------------------
Course Outline
Course Outline:~~1. A PERL Tutorial~~2. I/O in PERL~~3. PERL Operators~~4.
Arrays + Array Functions~~5. Control Flow~~6. Subroutines, Packages, and
Libraries~~7. Accessing System Resources~~8. Odds and Ends~~9. Generating
Reports with PERL~~10. Network Applications: Client/Server~ Applications
Using TCP/IP~~11. Network Applications: WWW Applications~ Using CGI~ 
------------------------------------------------------------------------
Benefits
PERL is a scripting language which allows for rapid prototyping of projects
formerly done with a programming language or a shell. It incorporates all
the functionality of C (including a UNIX system interface), the Shells,
grep, sed, and awk. The topics in the course will aid all computer users -
from end user to programmer to administrator alike. Many in-class labs
support the course material. 




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

Date: Fri, 6 Feb 1998 16:56:12 GMT
From: gerlach@netcom.com (Matthew H. Gerlach)
Subject: Re: Perl, Tcl and Expect?
Message-Id: <gerlachEnyv1p.2tF@netcom.com>


If you are in fact wanting to "talk" to a telnet connection, Net::Telnet
is the right way to go.  However, if you want to "talk" to something else
you can try the expect-like features in Comm.pl or even try Expect.pm.

Matthew

In article <6bf7qt$p7i@flatland.dimensional.com> mfuhr@dimensional.com (Michael Fuhr) writes:
>Cerebus <stop@spamming.me> writes:
>
>>   Can anyone point me in the direction of any information on Expect
>> for Perl?  I'd like to use Perl, but I need to use Expect and from what
>> I can gather that would necessitate my using Tcl (something I'd like
>> to avoid if possible).
>
>Net::Telnet might meet your needs.  It's available on CPAN:
>
>    http://www.perl.com/CPAN/modules/by-module/Net/
>
>The Winter 1997 issue (issue #8) of _The Perl Journal_ has an
>article about Net::Telnet.
>
>-- 
>Michael Fuhr
>http://www.dimensional.com/~mfuhr/




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

Date: 6 Feb 1998 16:44:06 GMT
From: burt@ici.net (Burt Lewis)
Subject: Saving variables?
Message-Id: <6bfekm$ar3$1@bashir.ici.net>

Hi,

I have a form on a page that I would like to be able to have users review 
their entrys and if they want to use what they entered they hit submit to 
accept or press back to change.

What's the most common way to handle something like this?

Any ideas or examples would be appreciated.

Thanks!

Burt Lewis



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

Date: Fri, 06 Feb 1998 11:29:55 -0800
From: Denis Goddard <dgoddard@us.oracle.com>
Subject: Re: Saving variables?
Message-Id: <34DB64B3.D723A913@us.oracle.com>

Burt Lewis wrote:

> I have a form on a page that I would like to be able to have users review
> their entrys and if they want to use what they entered they hit submit to
> accept or press back to change.
>
> What's the most common way to handle something like this?

If the data is a simple hash of key/value pairs (where the values are simply
scalars),
check use of AnyDBM_File.pm

If there is more structured data, check FreezeThaw.pm  (available on CPAN)

-Denis



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

Date: Fri, 06 Feb 1998 11:33:07 -0500
From: Boris 'pi' Piwinger <3.14@Math.MIT.edu>
Subject: Script runs, but not as batch
Message-Id: <34db39d6.0@news.netway.com>

Hi!

I wrote a little script (see below) to cache a news-ticker. It works
as expected (though I started learning Perl yesterday, so it is my
very first). But, when I start it as:

schauder% batch vwd
job 222203 at Fri Feb  6 11:01:16 1998

I receive the following error (by e-mail from root):

>Your "at" job "222203" produced the following output:
>
>Badly placed ()'s.

What is wrong?


Here the script:

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

# Define the used URLs
for( $n =3D 1; $n <=3D 9; ++$n ) {
  @url[$n] =3D "http://www.vwd.de/topnews/TOPNEWS0" . $n . ".html";
}
for( $n =3D 10; $n <=3D 20; ++$n ) {
  @url[$n] =3D "http://www.vwd.de/topnews/TOPNEWS" . $n . ".html";
}


# Find most recent message number
$data =3D `lynx -dump http://www.vwd.de/`;
$data =3D~ m/http.*topnews.*(\d\d)\.html/;
$now =3D $1;

# Save all messages to cache.txt
open(OUT,">.procmail/cache.txt");
for( $n =3D $now + 1; $n <=3D 20; ++$n ) {
  $data =3D `lynx -dump @url[$n]`;
  print(OUT "$data\n----------------------------\n");
}
for( $n =3D 1; $n <=3D $now; ++$n ) {
  $data =3D `lynx -dump @url[$n]`;
  print(OUT "$data\n----------------------------\n");
}
close(OUT);


# Now we have to stay up-to-date
while(1) {
  $data =3D `lynx -dump http://www.vwd.de/`;
  $data =3D~ m/http.*topnews.*(\d\d)\.html/;
  while ($1 !=3D $now) {
    $now =3D $now + 1;
    $now =3D 1 if $now =3D=3D 21;
    $data =3D `lynx -dump @url[$now]`;
    open(OUT,">>.procmail/cache.txt");
    print(OUT "$data\n----------------------------\n");
    close(OUT);
  }=20
  system("sleep 300");
}
---cut---

TIA. pi
--=20
Yogi Berra said:
>It's like deja vu all over again!


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

Date: 6 Feb 1998 11:56:56 -0500
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Script runs, but not as batch
Message-Id: <6bffco$6h2$1@stok.co.uk>

In article <34db39d6.0@news.netway.com>,
Boris 'pi' Piwinger  <3.14@Math.MIT.edu> wrote:

>I wrote a little script (see below) to cache a news-ticker. It works
>as expected (though I started learning Perl yesterday, so it is my
>very first). But, when I start it as:
>
>schauder% batch vwd
>job 222203 at Fri Feb  6 11:01:16 1998
>
>I receive the following error (by e-mail from root):
>
>>Your "at" job "222203" produced the following output:
>>
>>Badly placed ()'s.
>
>What is wrong?

Does batch honour #! lines, if not the devious construct suggested in the
perlrun man page might be useful in place of the #! line:

  eval '(exit $?0)' && eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
  & eval 'exec /usr/bin/perl -S $0 $argv:q'
     if $running_under_some_shell;

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: 6 Feb 1998 12:42:03 -0500
From: charlot@CAM.ORG (Richard Bellavance)
Subject: Re: Script runs, but not as batch
Message-Id: <6bfi1b$ji2@ocean.CAM.ORG>

In article <34db39d6.0@news.netway.com>,
Boris 'pi' Piwinger  <3.14@Math.MIT.edu> wrote:
>
>schauder% batch vwd
>job 222203 at Fri Feb  6 11:01:16 1998
>
>I receive the following error (by e-mail from root):
>
>>Your "at" job "222203" produced the following output:
>>
>>Badly placed ()'s.
>
>What is wrong?
>

You did not read the "batch" man page...  This is not a Perl problem.

Richard.
-- 
Richard Bellavance -- charlot@cam.org -- http://www.cam.org/~charlot/
    "All along this path I tread  /  My heart betrays my weary head
     With nothing but my love to save / From the cradle to the grave"
                                 (Eric Clapton, "From the cradle")


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

Date: 6 Feb 1998 15:39:50 GMT
From: mwang@alhena.ibk.ml.com (Michael Wang)
Subject: Re: searching by file creation/modification date?
Message-Id: <6bfas6$mmj$1@news.ml.com>

Martien Verbruggen <mgjv@comdyn.com.au> wrote:
>
>Yes? What is your point? There still is no creation date in there.
>Maybe you are referring to the ctime? That is not the creation time.
>It's the time of the last change to the i-node, which in some cases is
>equal to the creation time, but certainly not in most.

the time of the last change to the i-node is often considered as
creation time, that is, I think where the c comes from in ctime.

but if you define creation time as the time the file was created,
then that is not ctime. Since chmod operation will alter ctime.
The "true ctime" is not kept by the OS, and hence not available
via perl, or any other languages. 

Question:
How do we modify ctime? touch does not do this.
What other operations that alter ctime?


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

Date: Fri, 06 Feb 1998 09:52:29 -0600
From: mpach@post.cz
Subject: secure perl
Message-Id: <886779542.128450566@dejanews.com>

Hi,

I've been wondering if there's a way to run perl in a "secure mode".
Something like the script would not be allowed to open files, call exec
or system, etc. If this is possible I can easily let users embed some
perl code in their html, which after some parsing would be passed to
perl. The problem is that I don't want to let them do everything that
perl offers, such as displaying /etc/password file etc.

I guess the solution would be to get chrooted into some safe read-only
directory with the perl binary in it, so they can't write to files.. nor
access or run anything else. I am wondering if perl is capable of
eliminating those calls though.

I read through the man pages and didn't find the nifty switch. Please if
anybody can help, email me at the above address.

Thanks,

Miso Pach

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


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

Date: 6 Feb 1998 16:38:52 GMT
From: Mike Heins <mike@ns.minivend.com>
Subject: Re: secure perl
Message-Id: <6bfeas$nhg$1@ocoee.iac.net>

mpach@post.cz wrote:
> Hi,

> I've been wondering if there's a way to run perl in a "secure mode".
> Something like the script would not be allowed to open files, call exec
> or system, etc. If this is possible I can easily let users embed some
> perl code in their html, which after some parsing would be passed to
> perl. The problem is that I don't want to let them do everything that
> perl offers, such as displaying /etc/password file etc.

> I guess the solution would be to get chrooted into some safe read-only
> directory with the perl binary in it, so they can't write to files.. nor
> access or run anything else. I am wondering if perl is capable of
> eliminating those calls though.

> I read through the man pages and didn't find the nifty switch. Please if
> anybody can help, email me at the above address.

It comes with your Perl.

use Safe;

my $compartment = new Safe;

$user_code = 'system "rm -rf /*"'
$compartment->reval($user_code);
if($@) {
	warn "Unh-unh-unh! Not that code.\n\n$@\n";
}

-- 
Regards,
Mike Heins                          http://www.minivend.com/  ___ 
                                    Internet Robotics        |_ _|____
Just because something is           131 Willow Lane, Floor 2  | ||  _ \
obviously happening doesn't         Oxford, OH  45056         | || |_) |
mean something obvious is           <mikeh@minivend.com>     |___|  _ <
happening. --Larry Wall             513.523.7621 FAX 7501        |_| \_\


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

Date: 6 Feb 1998 19:33:58 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: solution for multiline comments???
Message-Id: <slrn6dljml.7a.sitaram@ltusitaram.diac.com>

On Wed, 04 Feb 1998 12:40:16 GMT, Bart Lateur <bart.mediamind@tornado.be> wrote:
>s93bni@csd.uu.se (Bjvrn Nilsson) wrote:
>
>>It seems like I took the "lazyness" part in "Programming Perl" a bit too
>>seriously. Quite a few of the answers suggested using POD, so I took a look
>>at the documentation of that. Indeed it's the solution that I look for. But
>>really, wouldn't a solution like:
>>/******
>>* This is a comment about what is to follow.
>>* This class is a nonsense class that really does nothing but
>>* serving as an example.
>>*******/
>>i.e. a notation like the /* C, C++, Java etc */ commenting be a nice
>>feature in Perl as well?
>
>But it DOES work! (GRIN)
>
>#######
>#  This is a comment about what is to follow.
># This class is a nonsense class that really does nothing but
># serving as an example.
>#######
>
>I just can't see why you dislike inserting the '#', and then you do
>insert '*'

And if you use VIM, it'll do it for you.  You can just keep on typing your
comment - it'll break at your margin, filling in the comment leader on each
successive line.  Even reformat a multi-line comment that has been edited a
bit...just hit "gq}" (if there's a blank line after the block)

And no - it's not off-topic to talk about better ways of editing Perl pgms
:-)


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

Date: 06 Feb 1998 16:31:16 +0100
From: Peter Kruse <Peter.Kruse@psychologie.uni-regensburg.de>
Subject: Re: Syntax-coloring editor for NT
Message-Id: <m3en1g3g3f.fsf@arnulf.de>

In article <01bd3280$505c7080$152010ac@pplis015> "Shawn McMahon"
<smcmahon.nospam@pplsi.com> writes: 

> Anybody know of a 32-bit NT editor that will do syntax-coloring for Perl?
> 
> I know I can program Winedit or AY Pad to do it, but I'd kind of like to
> find something already done.  Maybe a config for either of those programs,
> or an entirely different program.
> 
> I don't care whether it lets me fire up perl.exe or not, just so long as it
> colors the keywords.
> 

emacs? ntemacs! 

ftp://ftp.cs.washington.edu/pub/ntemacs/latest

just a suggestion...

> (Be aware of the anti-spam addition in my email address if you want to
> respond via email.)
> 
> -- 
> 
> Shawn McMahon
> Network Systems Administrator
> Pre-Paid Legal Services, Inc.
> 
-- 
-rw-r--r--   1 pete   users   0 Jan  8 16:40 .signature


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

Date: Fri, 06 Feb 1998 19:03:36 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: The perl institute still alive ?
Message-Id: <6bfmt8$3nc$1@cyprus.atlantic.net>

According to periat@ens.ascom.ch:
>Does any body know if the perl institute is still alive ?
>since a long time i haven't heard anything from it.

It's getting up to speed.  And www.perl.org works fine.
-- 
Chip Salzenberg               - a.k.a. -                <chip@pobox.com>
        "Nice shooting, Zanthar!"  "Thanks, Denise."  // MST3K
           ->  Ask me about Perl training and consulting  <-
    Like Perl?  Want to help out?  The Perl Institute: www.perl.org


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

Date: Fri, 6 Feb 1998 19:01:26 -0000
From: "Stuart Grimshaw" <stuartg.pcrsys@minorplanet.com>
Subject: The Specified module can not be found.
Message-Id: <6bfmlr$2h8$1@svr-c-02.core.theplanet.net>

I keep getting the above error message every time I request a perl script
from my server, (NT W/s running IIS4 beta 2).

The script I am trying is ....

    print "HTTP/1.0 200 OK\n";
    print "Content-type: text/html\n\n";

    print "<HTML><HEAD><TITLE>Test Page</TITLE></HEAD>";
    print "<BODY>";
    print "<H2>Hello, bunghole!</H2>\n";
    print "</BODY></HTML>";

a pretty simple thing to start off with I'm sure you'd agree.

The script works fine if run from a DOS box, so why do I keep getting that
error in my browser?

This is getting really frustrating, and it hasn't been helped by the ego's
of the people on #PERL and #CGI. I'm a Delphi programmer by trade and I have
never known such a reluctance to help people as I have encountered with this
problem.

I really hope you can help me.




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

Date: Fri, 06 Feb 1998 13:57:29 -0500
From: Jean-Francois Leroux <EI952942@uqac.uquebec.ca>
Subject: Upload file whit CGI.pm???
Message-Id: <34DB5D19.446B9B3D@uqac.uquebec.ca>

Is it what I need to upload a file who come from of a <FORM> in a web
page?  If yes, could you send me that source code please!

You'll be very nice if you do it!

Bye!
Jeff.


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

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

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