[6349] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 971 Volume: 7

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 19 01:18:40 1997

Date: Tue, 18 Feb 97 22:00:22 -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           Tue, 18 Feb 1997     Volume: 7 Number: 971

Today's topics:
     Re: [Q] Perl in win3.11? (Mike Stok)
     Re: [Q] Perl in win3.11? (Ilya Zakharevich)
     Re: ANNOUNCE: GIFgraph 0.9 <mgjv@comdyn.com.au>
     Re: Bug? Passing Empty Array To Subroutine <jesse@ginger.sig.bsh.com>
     Bulletin board in CGI/perl <hyzhang@scripps.edu>
     dbmopen() dbmclose() using CGI variables <blue@visinet.ca>
     ezone course errors - warning dcon@eden.com
     Re: filehandles in recursive calls <jesse@ginger.sig.bsh.com>
     flock(2) Question (John Boekhout)
     Re: glob behavior with nonexistent directories (glob is <jesse@ginger.sig.bsh.com>
     Re: Help please with text wrap <jesse@ginger.sig.bsh.com>
     Re: HELP! Difficult regexp matter! <jesse@ginger.sig.bsh.com>
     Re: HELP: How to speed up Perl scripts ? <jesse@ginger.sig.bsh.com>
     Re: How do I update @INC so I can use my module? <jesse@ginger.sig.bsh.com>
     Re: how to create file based on date/time (Tad McClellan)
     How to read a vt100 screen? (Chris Sidi)
     Re: Need help with variable manipulation <jesse@ginger.sig.bsh.com>
     Re: PERL / OLE (David Grove)
     Re: Problems with -l (Dave Thomas)
     Public Domain - Date Graphic Script <jsteven@sirris.com>
     Re: regexp's in XEmacs vs. Perl <ajc@bing.wattle.id.au>
     Re: s/// Quesiton <jesse@ginger.sig.bsh.com>
     Re: script to encrypt STDIN <rootbeer@teleport.com>
     Segmentation Fault when using undef <stats9@mail.idt.net>
     Re: Send OK message, then process other stuff w/perl? <jesse@ginger.sig.bsh.com>
     Re: Sending results to two frames at once <jesse@ginger.sig.bsh.com>
     Simple DBM question <signal@netjam.net>
     Re: Substitute with function <jesse@ginger.sig.bsh.com>
     Re: system call problems (Mike Stok)
     Re: UNIX-based perl: backgrounding and file descriptors <jesse@ginger.sig.bsh.com>
     Re: Variable Interpolation In Associative Array? <jesse@ginger.sig.bsh.com>
     Re: Why doesn't gethostbyaddr return a value? <rootbeer@teleport.com>
     Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)

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

Date: 19 Feb 1997 03:16:20 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: [Q] Perl in win3.11?
Message-Id: <5edra4$j68@news-central.tiac.net>

In article <m1g1ytsnic.fsf@nauplius.psc.sc.edu>,
Dean Pentcheff  <dean@tbone.biol.sc.edu> wrote:

>reposted from a posting of some time ago.  The key recommendation I'd
>make is to make sure you get a Perl 5, not a Perl 4.  Perl 4 is
>thoroughly obsolete and is not supported by any of the Perl Luminaries
>in the Perl newsgroups.  
>
>Besides, Perl 5 is more fun.

But at least perl 4.036 is stable and fast to start ;-)  All those trouble
making developers are busily making sure that %OVERLOAD != use overload
and perl != CGI.  I like perl 4, warts 'n' all, but I don't glow in the
dark :-(

Seriously though, perl 5.xxx is probably better for most things on
balance, but if you have a stack of perl 4.036 cgi scripts that get hit
tens of thousands of times a day you might want to benchmark things before
blindly upgrading.  If you stick with perl 4.xxx then help gets thinner as
time goes on...

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@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: 19 Feb 1997 02:23:28 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: [Q] Perl in win3.11?
Message-Id: <5edo70$p9t$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Dean Pentcheff 
<dean@tbone.biol.sc.edu>],
who wrote in article <m1g1ytsnic.fsf@nauplius.psc.sc.edu>:
> Following is a repost of a posting I've reposted from a posting I

[....]

> Put the following in your autoexec.bat (carefully noting the slash
> directions in the text that follows):
> 
>         set path=...your...existing...path...;c:\perl\bin
>         set perllib_prefix=f:/perllib c:/perl
> 
> (I assume your perl destination is drive "c:", otherwise modify the
> "c:"s above appropriately, but don't change the "f:").

As I mentioned it in another post today, unless you install sh.exe
from sh_dos.zip, and set PERL_SH_DIR according to the docs, you are
not going to have backticks and pipes working.

Ilya


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

Date: Wed, 19 Feb 1997 12:49:08 +1100
From: Martien Verbruggen <mgjv@comdyn.com.au>
Subject: Re: ANNOUNCE: GIFgraph 0.9
Message-Id: <330A5C14.7012@comdyn.com.au>

Larry W. Virden wrote:

> What's the status of the requirement from Unisys to pay licese fees
> for software which creates GIFs?  There was a lot of hoopla about this
> on Compuserve a few yrs ago, and since that time I have seen notes from
> the author of xv, the author of the GD perl package, etc. referring to
> problems with such software.

As far as I know, the use of LZW compression stuff is allowed without
licensing fees for non commercial products. I have requested the up to
date info from Unisys, and will let you know.

-- 
Martien Verbruggen

Webmaster www.tradingpost.com.au
Commercial Dynamics Pty Ltd, N.S.W., Australia


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

Date: 18 Feb 1997 21:59:57 -0500
From: Jesse Glick <jesse@ginger.sig.bsh.com>
Subject: Re: Bug? Passing Empty Array To Subroutine
Message-Id: <4o67zpmrf6.fsf@ginger.sig.bsh.com>

dave@fast.thomases.com (Dave Thomas) writes:

> There is also a difference between foo($array[0]) and foo($array[0]+1) -
> the first case extends the array, the second complains about $array[0] being
> undefined.
> 
> Interesting...

As far as I am aware: foo($array[0]) aliases $_[0] within &foo to $array[0],
so it must exist in case that alias is written to. Therefore, the array is
created & pre-extended. foo($array[0]+1) passes in a "fresh" scalar calculated
by the addition; no aliasing is required (or possible) so the array is
untouched, and a dummy value--"undef"--is used to add, which will give a
warning though be treated as zero.

This all appears to be leftover Perl 4 crap. Intuitiveness is not much of a
criterion, it seems, for a few things like this...

-- 
Jesse "Da Juice" Glick
mailto:jglick@sig.bsh.com
617-867-1017


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

Date: Tue, 18 Feb 1997 21:27:39 -0800
From: Hongyu Zhang <hyzhang@scripps.edu>
Subject: Bulletin board in CGI/perl
Message-Id: <330A8F4B.41C67EA6@scripps.edu>

Dear netters,

I am going to creat a WWW bulletin board for our group, which, as I
know, in most cases is implemented in CGI/perl. Not to reinvent the
wheel, I'll be grateful to get your guys' help on the relevant
text/code.


Best regard !

Henry
----------------------------------------------------------------------
Hongyu Zhang (Henry), Ph.D.           | Tel: (619) 784-8831 (working)
Department of Molecular Biology, TPC5 | Tel: (619) 455-8297 (home)
The Scripps Research Institute        | Fax: (619) 784-8895
10550 North Torrey Pines Road         | Email: hyzhang@scripps.edu
La Jolla, California 92037            | URL:  http://www.scripps.edu/
						skolnick/HENRY/hom.htm
-----------------------------------------------------------------------------


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

Date: Tue, 18 Feb 1997 23:38:36 -0500
From: Tony D'Andrade <blue@visinet.ca>
Subject: dbmopen() dbmclose() using CGI variables
Message-Id: <Pine.LNX.3.91.970218232744.20409B-100000@ceylon.visinet.ca>


Hi,  I am having problems passing data to dbmopen() dbmclose() in a cgi 
script.  If I run the script from the command line and substitute the 
data from the form with locally defined data, the script works.  Below 
are both scripts.  Script A works but Script B does not generate the db file.

Any Suggestions ?

###################################### Script A #########################################

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

use DB_File;
use strict;

my $key="username";
my $fname="Joe";
my $lname="Blow";

@datafields (
		"KEY",
		"FIRSTNAME",
		"LASTNAME",
	    );
@datavalues (
		$key,
		$fname,
		$lastname
	    );

dbmopen(%database,"userdata",0666);
for($count=1; $count<=@datafields; $count++)
 $database{datafields[$count-1].$datavalues[0] = $datavalues[$count-1];
dbmclose(%database);

###################################### Script B #######################################

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

use CGI;
use DB_File;
use strict;

my($query) = new CGI;

my($key) = $query->param('Uname');
my($fname) = $query->param('FName');
my($lname) = $query->param('LName');

@datafields (   
                "KEY",
                "FIRSTNAME",
                "LASTNAME",
            );
@datavalues (   
                $key,
                $fname,
                $lastname
            );

# Everything is ok up to here in this script.
# The next statements do not seem to work.

dbmopen(%database,"userdata",0666);
for($count=1; $count<=@datafields; $count++)
 $database{datafields[$count-1].$datavalues[0] = $datavalues[$count-1];
dbmclose(%database);



**********************************************
Tony D'Andrade       	Phone:	(416)488-5352
Network Integration  	Fax:	(416)488-7562	
VisiNet Internet Svcs.	Pager:	(416)426-1244
Toronto, Ontario     	e-mail:	ajd@visinet.ca
**********************************************



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

Date: Wed, 19 Feb 1997 05:14:30 GMT
From: dcon@eden.com
Subject: ezone course errors - warning
Message-Id: <330692fc.108302@news.eden.com>


I apologize if this issue has been previously addressed...


The ezone perl5 course has many many errors.  I have emailed the
webmaster numerous times ( >5), and have received many reassuring
replies, and many problems resolved, yet many more persist.   The
ezone folks claim to have expunged all errors, but that simply is not
so.  The 'midterm exam' questions run out of sync with the answers,
e.g.  (see snippet)  The idea is cool, the course fun, and
informative.  If you don't mind tons of errors in the online, and
printed version, it may be the way to go.  If you want precision and
stability in your perl education, beware.

Cheers,

-Doug Conley  -dcon@eden.com


<quote>

6.Which expression will return an array consisting of @b appended to
@a?
             a. -B
             b. -b
             c. -M
             d. -s

   7.What sorting subroutine could you use to sort a list of files by
modification times?
             a. (@a, @b)
             b. push(@a, @b)
             c. unshift(@a, @b)
             d. $a[$#a] = @b

<end quote>


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

Date: 18 Feb 1997 22:41:06 -0500
From: Jesse Glick <jesse@ginger.sig.bsh.com>
Subject: Re: filehandles in recursive calls
Message-Id: <4opvxxlay5.fsf@ginger.sig.bsh.com>


{ # Some kind of block
  local(*FILE);
  open FILE, ...;
}

This should work even if it enters itself recursively. B.T.W., consider using
"FileHandle"s; they would have made a solution much more apparent: just use

{
  my $fh=new FileHandle ...;
}

-- 
Jesse "Da Juice" Glick
mailto:jglick@sig.bsh.com
617-867-1017


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

Date: Wed, 19 Feb 1997 04:09:02 GMT
From: boekhout@azww.com (John Boekhout)
Subject: flock(2) Question
Message-Id: <5edu0q$9og@uruguay.earthlink.net>

Thanks to those of you who helped me with my file locking
question.  The answer was to use flock.  But I've still got
a problem I'm hoping you can help me with.

I've made the changes to use flock as follows:

    open(HANDLE,$path);
    if (!flock(HANDLE,2) {  #get exclusive lock
        &error("couldn't get lock");
        }

The problem is that the error path is being taken, as
flock() is returning a 0 (false).  The Perl home page which
has the definition of built-in functions says flock()
returns TRUE if it succeeded and FALSE if it failed.
This does not appear to be the case.  (I'm very certain
that open file call was successful.)

Any help would be appreciated.
John Boekhout
boekhout@azww.com



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

Date: 18 Feb 1997 22:55:10 -0500
From: Jesse Glick <jesse@ginger.sig.bsh.com>
Subject: Re: glob behavior with nonexistent directories (glob is not find)
Message-Id: <4oohdhlaap.fsf@ginger.sig.bsh.com>


Glob is pretty weak, not to mention very slow and insecure. Just use opendir,
readdir and brethren, and do the matching yourself whenever glob gives you
problems; you're much better off doing it right.

-- 
Jesse "Da Juice" Glick
mailto:jglick@sig.bsh.com
617-867-1017


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

Date: 18 Feb 1997 23:14:15 -0500
From: Jesse Glick <jesse@ginger.sig.bsh.com>
Subject: Re: Help please with text wrap
Message-Id: <4olo8ll9ew.fsf@ginger.sig.bsh.com>


use Text::Wrap; # See CPAN
my $wrapped=wrap("\t", '', $unwrapped);

-- 
Jesse "Da Juice" Glick
mailto:jglick@sig.bsh.com
617-867-1017


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

Date: 18 Feb 1997 22:13:09 -0500
From: Jesse Glick <jesse@ginger.sig.bsh.com>
Subject: Re: HELP! Difficult regexp matter!
Message-Id: <4o20admqt6.fsf@ginger.sig.bsh.com>

Tom Phoenix <rootbeer@teleport.com> writes:

> 
> On 31 Jan 1997, Oussik Oganessian wrote:
> 
> > I have faced a non-trivial problem, when trying to convert some files to
> > LaTeX format.  There are a number of chars which must be replaced with
> > expressions respectivelly.  E.g.: 
> > $ -> \$
> > \ -> $\backslash$
> > and so on...
> > 
> > Previously I used to translate these with s/// sequentially, but the
> > above example hampers that, since $ or \ on the right side of the first
> > substitution will be replaced by the second substitution. 

You could do something like:

my %trans=('$' => '\$', ...);
my $keys_rx=join '|', map {quotemeta $_} keys %trans;
s/($keys_rx)/$trans{$1}/go;

This assumes that the keys ("from" strings) have no overlapping match
relationships, i.e. you do not have both 'a' and 'and' as keys. If you do, you
need to order them, harder to match (e.g. 'and') first.

Give it a try...

-- 
Jesse "Da Juice" Glick
mailto:jglick@sig.bsh.com
617-867-1017


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

Date: 18 Feb 1997 22:19:41 -0500
From: Jesse Glick <jesse@ginger.sig.bsh.com>
Subject: Re: HELP: How to speed up Perl scripts ?
Message-Id: <4oybcllbxu.fsf@ginger.sig.bsh.com>


Look on CPAN for the compiler (module "B::*"). It's alpha, though, and not
exactly simple to use.

-- 
Jesse "Da Juice" Glick
mailto:jglick@sig.bsh.com
617-867-1017


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

Date: 18 Feb 1997 22:25:04 -0500
From: Jesse Glick <jesse@ginger.sig.bsh.com>
Subject: Re: How do I update @INC so I can use my module?
Message-Id: <4ovi7plbov.fsf@ginger.sig.bsh.com>

torng@ux2.cso.uiuc.edu (Ming-Hwa Torng  - csc) writes:

> 
> I want to install my own module so I can do "use my_module" from the pm file 
> in my local directory.

See lib.pm.

-- 
Jesse "Da Juice" Glick
mailto:jglick@sig.bsh.com
617-867-1017


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

Date: Tue, 18 Feb 1997 20:14:17 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: how to create file based on date/time
Message-Id: <plnde5.1l4.ln@localhost>

calderongv@net-quest.com wrote:
: I'm trying to create an dynamic archive file of a text file based on the
: current date and time... am quite new to perl/cgi...
                              ^^^^^^^^^^^^^^^^^^^^^

: i want the cgi to archive a portion of a chat file once it reaches a
: certain size... create the new filename based on the current date and
: time (mmddhhmm.txt) and reduce the remaining file size...

: this sub just won't create the file... nor will it reduce the $chat_file
: size... am running the cgi at the telnet prompt, other cgi's work, the
: entire cgi runs without errors, and without creating the file too...

[snip]

: any suggestions would be much appreciated?  (am new at this... but love
: it!)

: # Create filename based on mmddhhmm
: $ndate = '$date_command +"%m%d%I%M"'; chop($ndate);
           ^                         ^
           ^                         ^
Those should be _backwards_ single quotes...


:    }
: }

: Thanks, Steven
: Webmaster for Many Paths
  ^^^^^^^^^

"Webmaster" _and_ "quite new to perl/cgi" ???


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: Wed, 19 Feb 1997 05:27:01 GMT
From: gt6161c@prism.gatech.edu (Chris Sidi)
Subject: How to read a vt100 screen?
Message-Id: <5ee2t6$meq@smash.gatech.edu>

Hi,

I'm reading the vt100/xterm output of programs like vi, elm or ytalk.

I want to somehow read a line off the screen (e.g. Make sure column
59-65 on row 1 reads "ELM 2.4"). How can I do this?  I've glanced at
the Curses and Term modules but it looked like they generate term
output or read user input.

Also, how can I know what rows/cols of the vt100/xterm screen the user
has highlighted with their mouse?  Pine or Tin have surprised me by
"knowing" where I clicked my mouse in a xterm and going to that
message.

My end goal is a regression testing tool for our products that have a
vt100 interface. (I co-op at Northern Telecom).

-Chris (on a HP-UX system with perl 5.003)


P.S. I made a small script to timestamp and log each character to a
file.  I use it by saying "ytalk tchrist | term_rec ytalk.log":

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

$timestamp_log = shift(@ARGV);
open(TS_LOG, ">$timestamp_log") || 
 die "Can't open $timestamp_log: $!\n";

$old_time = time;

while ( read(STDIN, $char, 1) ) {
        $new_time = time;
        $delta = $new_time - $old_time;
        $old_time = $new_time;

        syswrite(STDOUT, $char, 1); #print seemed to buffer until a

				    #newline
        chomp $char;
        print TS_LOG "$delta:$char\n";
}


P.P.S. Here is my playback script:
#!/usr/local/bin/perl -w

while (<>) {
        ($target_delta, $char) = split(':', $_, 2);

        sleep $target_delta;
        chomp $char unless ($char eq "\n");
        syswrite(STDOUT, $char, 1); 	#print seemed to buffer until
a 		
					#newline
} 



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

Date: 18 Feb 1997 22:16:35 -0500
From: Jesse Glick <jesse@ginger.sig.bsh.com>
Subject: Re: Need help with variable manipulation
Message-Id: <4ozpx1lc30.fsf@ginger.sig.bsh.com>

"D. M. Johnson" <ez045864@peseta.ucdavis.edu> writes:

> 
> Hi all.  Two questions:
> 
> 1) If $name = randal, how can I reverse this.  I need to get
>    $name = ladnar (Assuming I don't know how many characters are
>    in the name.)

join '', reverse split //, $name

> 2) I need to spell check a word.  If I store "dog" into $word, how
>    can I spell check $word?

With GNU Ispell and some effort: this would be nontrivial.

-- 
Jesse "Da Juice" Glick
mailto:jglick@sig.bsh.com
617-867-1017


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

Date: 19 Feb 97 04:56:55 GMT
From: pete@dave-world.net (David Grove)
Subject: Re: PERL / OLE
Message-Id: <330a8817.0@nt.dave-world.net>

In article <01bc1dfe$b77925c0$6c55b5cf@default>, brian@shepmark.com 
says...
>
>Does Perl come with OLE set up? or are there OLE extensions? 
Yes

>Where would I find the OLE extensions and is their a web site with info
>pertaining to this?
Any recent book on PERL. I have 4 CD's from books with the most recent NT 
PERL that include full OLE support. I'm now working on a project in EXCEL 
using PERL, using OLE from one of those CD's.

>Any help would be greatly appreciated!
>
>Thanks in advance!!

You're welcome.

Invest a little in a book on PERL 5, and you'll get it okay.

Pete (David Grove)
pete@dave-world.net



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

Date: 19 Feb 1997 04:39:34 GMT
From: dave@fast.thomases.com (Dave Thomas)
Subject: Re: Problems with -l
Message-Id: <slrn5gl0r5.fo3.dave@fast.thomases.com>

On 18 Feb 1997 19:27:37 GMT, Peter Scott <pjscott@euclid.jpl.nasa.gov> wrote:
> I'm confused.  Maybe I don't understand the ramifications of -l.
> Running the following script:
> 
> #!/usr/local/bin/perl -wnl
> if (/,/)  {
>     print "foo";
> } else {
>     print "bar";
> }
> 
> produces:
> 
> euclid% echo "cat,dog" | /tmp/foo
> bar,bar,euclid% 

> Under debugger
> foo

Any chance the Perl in /usr/local/bin isn't the same as your default Perl? I
get "foo\n" both times. If nothing else, you should be getting a newline
after each print statement, which your don't seem to be.


 _________________________________________________________________________
| Dave Thomas - Dave@Thomases.com - Unix and systems consultancy - Dallas |
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

Date: Tue, 18 Feb 1997 20:50:59 -0800
From: "James Steven" <jsteven@sirris.com>
Subject: Public Domain - Date Graphic Script
Message-Id: <jsteven-1802972050590001@blv-pm100-ip23.halcyon.com>

Dear Perl Friends,
				With the help of a select few of you I was able to make my first decent
perl/www script. Although this script is very specific, I thought that some
of you might find it useful (but you will need to customize it for it to
work on your web-site).

					This script collects todays date a spits out a table (or whatever) with
the date in three seperate images: Month1 Day1Day2. For example, if today
was the February 18. The output would be:

<table border=0 width=xx cellpadding=0 cellspacing=0><tr>
<td><img src="1.gif" width=xx height=xx alt="Site Name Here: February"></td>
<td><img src="1.gif" width=xx height=xx alt="1"></td>
<td><img src="8.gif" width=xx height=xx alt="8"></td>
</tr></table>

To see this script in action visit: www.sirris.com

Note:

Month name files needed (January, February, etc.): 0-11.gif
First day files needed (1,2,3, blank): 1-3.gif and a blank b.gif
Second day files needed (1,2,3): 0-9.gif

I would aperciate any comments!

---------------------------------------
James Steven - jsteven@sirris.com
Sirris Web-Site: http://www.sirris.com/
---------------------------------------

SCRIPT:

#!/usr/local/bin/perl
# Date Graphic Display
# Copyright (c) 1997, Sirris (tm), All Rights Reserved
# * You may alter and use this script of copyright remains *

@Months =
('January','February','March','April','May','June','July','August','Septembe
r','October','November','December');

($Month_Day,$Month) = (localtime)[3,4]; 

if ($Month_Day < 10) {
    $Month_Day = "b$Month_Day"; 
}

($One, $Two) = unpack "AA", $Month_Day;

$Month_Link = "1month/$Month";
$Month_Alt = "$Months[$Month]";
$One_Link = "2day/$One";
$Two_Link = "3day/$Two";

print "Content-type: text/html\n\n";

print<<"MARK";
<table border=0 width=xx cellpadding=0 cellspacing=0><tr>
<td><img src="$Month_Link.gif" width=xx height=xx alt="Site Name Here:
$Month_Alt"></td>
<td><img src="$One_Link.gif" width=xx height=xx alt="$One"></td>
<td><img src="$Two_Link.gif" width=xx height=xx alt="$Two"></td>
</tr></table>
MARK




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

Date: 19 Feb 1997 03:35:21 GMT
From: Andrew J Cosgriff <ajc@bing.wattle.id.au>
Subject: Re: regexp's in XEmacs vs. Perl
Message-Id: <ruig1ytxybu.fsf@goaway.cc.monash.edu.au>

"Randal" == Randal Schwartz <merlyn@stonehenge.com> writes:

C> You mean you can edit files with Emacs? :-)

Randal> Yeah, you know, like when you're posting news or replying to
Randal> mail, or passing a document in IRC, or sending
Randal> encrypted/anonymous mail via PGP..  up comes this window with
Randal> a *built-in* editor!  It's so cool! No need to go to a
Randal> separate utility!  It even comes up when you visit a file from
Randal> dired.

Randal> Now if I could just figure out how to handle "talk", I'd never
Randal> even leave my emacs for the entire session!

Haven't you tried "etalk" ? :)

(it's been about 3 or 4 years since I ran it, but it worked pretty
well on Epoch... :)

Andrew.
-- 
 - Andrew J. Cosgriff -                  ajc@bing.wattle.id.au    (PGP/MIME ok)
 +61 3 9905 1165 (bh) 9905 4746 (fax)    http://www-personal.monash.edu.au/~ajc
     I'm mentally OVERDRAWN!  What's that SIGNPOST up ahead?  Where's ROD
                      STERLING when you really need him?


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

Date: 18 Feb 1997 22:59:04 -0500
From: Jesse Glick <jesse@ginger.sig.bsh.com>
Subject: Re: s/// Quesiton
Message-Id: <4on2t1la47.fsf@ginger.sig.bsh.com>

reynolds-j@mindspring.com (Jim Reynolds) writes:

> s/\[link=(.*)\]/<a href="$1">$1<\/a>/ig;

s/\[link=(.*?)\]/<a href="$1">$1<\/a>/ig

Non-greedy matching, RTF-perlre(1)-M.

-- 
Jesse "Da Juice" Glick
mailto:jglick@sig.bsh.com
617-867-1017


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

Date: Tue, 18 Feb 1997 19:27:35 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Brian Wort <brian@wort.com>
Subject: Re: script to encrypt STDIN
Message-Id: <Pine.GSO.3.95q.970218191553.10877I-100000@julie.teleport.com>

On Tue, 18 Feb 1997, Brian Wort wrote:

> I would like to create an online form to automate the encryption of a
> STDIN text string and return the result in a web page. 
> 
> Do I have to write the STDIN taken from the form to a file before I can
> encrypt it (using crypt) or can this be accomplished from the perl
> script itself? 

Wait -- You're not going to use Perl's built-in crypt function for
encryption, are you? If you want to encrypt something so that you can
decrypt it later, use PGP or something similar. 

Also, I'm not sure that the "STDIN taken from the form" is what you
are thinking it is. 

> I think it would be faster to crypt the text string on the fly rather
> than write to a file, encrypt the file, then read from the file to
> return the resulting encrypted string.

Perhaps, but it would probably produce better security and almost
certainly a smaller encrypted file to encrypt the file as a whole. 

If somebody has a secret worth encrypting, why should the secret data
travel unencrypted over the Internet? That's like hiring a Brinks armored
convertable. :-)  The encryption should happen directly on the user's
presumably-secure machine. 

There are modules on CPAN for interfacing to PGP. Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Tue, 18 Feb 1997 22:24:37 -0500
From: Chris Plachta <stats9@mail.idt.net>
Subject: Segmentation Fault when using undef
Message-Id: <330A7275.5503E077@mail.idt.net>

Has anyone out there ever had a seqmentation fault when using
undef?  I am using the undef command to undefine some large hashes
that I reuse in a subroutine.  After the second time trough the 
subroutine, the undef command causes a segmentation fault.  Any 
clues?  Thanks.


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

Date: 18 Feb 1997 22:34:07 -0500
From: Jesse Glick <jesse@ginger.sig.bsh.com>
To: "x.z." <x@apocalypse.org>
Subject: Re: Send OK message, then process other stuff w/perl?
Message-Id: <4osp2tlb9s.fsf@ginger.sig.bsh.com>


$|=1;

-- 
Jesse "Da Juice" Glick
mailto:jglick@sig.bsh.com
617-867-1017


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

Date: 18 Feb 1997 23:55:20 -0500
From: Jesse Glick <jesse@ginger.sig.bsh.com>
Subject: Re: Sending results to two frames at once
Message-Id: <4ok9o5l7if.fsf@ginger.sig.bsh.com>

nvp@shore.net (Nathan V. Patwardhan) writes:

> Send a Target header.  I don't know if you can output to two separate
> frames, tho.  You'll have to try it.  Hope this helps!

Last time I checked, Navigator at least ignored "Window-target" headers in
MIME multipart returns, seemingly the obvious solution. Maybe they fixed that,
you can try yelling at them some.

_Please_ take this stuff to the CGI/HTTP/&c. groups!

-- 
Jesse "Da Juice" Glick
mailto:jglick@sig.bsh.com
617-867-1017


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

Date: Tue, 18 Feb 1997 20:37:15 -0600
From: Brian <signal@netjam.net>
Subject: Simple DBM question
Message-Id: <330A675B.1D128DA@netjam.net>

I have a simple question regarding dbm files.  I need to write some
program that read in some .pag and .dir dbm files.  I am following the
"Learning Perl" book, and the programs don't creat .dir and .pag files,
even though the book says they do.  The dbmopen() seems to just create a
single file that has no extension, although its in dbm format.

This is fine.  But I am stuck with the problem that I have files already
in .pag and .dir format, and I don't know how to read those using
dbmopen().  Did the functionality of dbmopen change since that book was
written?  How can I read in .pag and .dir dbm files?

Brian

-- 

oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
Brian Feeny	    oo  ShreveNet, Inc.	     oo	Phone: (318) 222-2NET
UNIX Administrator  oo  333 Texas St #619    oo	FAX: (318) 221-6612
signal@shreve.net   oo	Shreveport, LA 71101 oo	http://www.shreve.net/
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo


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

Date: 18 Feb 1997 22:24:14 -0500
From: Jesse Glick <jesse@ginger.sig.bsh.com>
Subject: Re: Substitute with function
Message-Id: <4owws5lbq9.fsf@ginger.sig.bsh.com>

dave@fast.thomases.com (Dave Thomas) writes:

> 
> On Mon, 03 Feb 1997 13:59:30 GMT, Alberto Grazi <grazi@smart.it> wrote:
> > I'd like to perform something like this
> > 
> >   $VAR =~ s/(abc)__(something)__(def)/$1&function($2)$3/eg;
>                                         ^^^^^^^^^^^^^^^^^
> 					
> 					This isn't a valid expression
> 					
> Try something like
> 
>   $VAR =~ s/(abc)__(something)__(def)/"$1" . &function($2) . "$3"/eg;

Or, to be really cryptic (no, this is not arbitrary):

s/.../$1@{[function($2)]}$3/g;

This is nice only if you have a huge mostly-literal string and want a teeny
weensy function call in it...

-- 
Jesse "Da Juice" Glick
mailto:jglick@sig.bsh.com
617-867-1017


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

Date: 19 Feb 1997 03:03:00 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: system call problems
Message-Id: <5edqh4$hva@news-central.tiac.net>

In article <3309CC0C.41C6@ctr.renault.fr>,
Bertrand Le Guen  <b.leguen@ctr.renault.fr> wrote:

>  i'm having some problems with a system call
>
>  system "$filetoexec";
>  wait()

>  $filetoexec is in fact a #!/bin/csh shell script !

You don't need the wait call.  system does all the work for you e.g.

[mike]$ cat try.pl
#!/usr/local/bin/perl

$fileToExec = './test-script';

$! = 0;
print "about to use system...\n";
$return = system $fileToExec;
print "return is $return, errno status is $!\n";

print "about to use fork and exec...\n";
defined ($pid = fork) or die "fork failed ($!)\n";
unless ($pid) {
  exec $fileToExec;
  # exec overwrites this copy of the process, so if we get here it's
  # failed.
  die "exec of $fileToExec failed ($!)\n";
}
$reaped = wait;
print "expected $pid, reaped $reaped, status = $?\n";
[mike]$ cat ./test-script
#!/bin/csh

echo test script.
exit 2
[mike]$ ./try.pl
about to use system...
test script.
return is 512, errno status is 
about to use fork and exec...
test script.
expected 443, reaped 443, status = 512

Notice that the return status is shifted up 8 bits, check the
documentation for wait in your C library to see how to interpret the exit
status returned by wait and in $?

The second esition of Programming Perl by Larry Wall, Tom Christiansen and
Randal Schwartz has several hints and examples to help you handle multiple
child processes if you need to.

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@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: 18 Feb 1997 22:30:16 -0500
From: Jesse Glick <jesse@ginger.sig.bsh.com>
Subject: Re: UNIX-based perl: backgrounding and file descriptors
Message-Id: <4ou3n9lbg7.fsf@ginger.sig.bsh.com>

Christopher M Wolff <christopher.wolff@nb.rockwell.com> writes:

> 
> Two UNIX-based perl questions:
> 
> 1) Can a background process be launched from within perl?
> I tried using fork,exec,and system, but at best they spawn a child
> process which dies when the parent does. In order to get a true
> background process, I call a C-shell that launches the background
> process for me and then exits. I hope to eliminate such ugliness
> if possible.

Ugly, but: system("nohup command... &"); Check nohup(1) to see if you can
emulate the same yourself.

> 2) How can I write to a file descriptor specified by number alone?
> I tried using syswrite, but it doesn't seem to work like the C "write"
> function. I need to do this because a parent process has setup the
> file descriptors 3 and 4 for communication. At the moment I am
> stuck using C for the "write," and I'd like to get rid of this
> platform dependence by doing it all in perl if possible.

Try using FileHandle::new_from_fd. Also look at "fileno" primitive.

-- 
Jesse "Da Juice" Glick
mailto:jglick@sig.bsh.com
617-867-1017


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

Date: 18 Feb 1997 22:05:25 -0500
From: Jesse Glick <jesse@ginger.sig.bsh.com>
Subject: Re: Variable Interpolation In Associative Array?
Message-Id: <4o3eutmr62.fsf@ginger.sig.bsh.com>

simberg@interglobal.org (Rand Simberg) writes:

> IOW, can I use a scalar variable as a key (assuming that the contents
> of the variable are a legitimate key of the array)?  I ask because it
> seems obvious that I should be able to, but it won't return a value
> when I try it.  However, it does return the expected value when I use
> a constant as the key.

Then your variable is not set to the right key!

-- 
Jesse "Da Juice" Glick
mailto:jglick@sig.bsh.com
617-867-1017


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

Date: Tue, 18 Feb 1997 19:13:38 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Matti Hultstrand <matti-hu@dsv.su.se>
Subject: Re: Why doesn't gethostbyaddr return a value?
Message-Id: <Pine.GSO.3.95q.970218191034.10877H-100000@julie.teleport.com>

On Tue, 18 Feb 1997, Matti Hultstrand wrote:

> 	    $hostname = gethostbyaddr($ipaddr, AF_INET); 

Did you remember to define AF_INET? I couldn't see any way in which you
defined it in the code you posted. Try 'use Socket;' near the top of your
script. Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: 8 Jan 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Jan 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.

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 V7 Issue 971
*************************************

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