[7178] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 803 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 1 04:22:27 1997

Date: Fri, 1 Aug 97 01:00:36 -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           Fri, 1 Aug 1997     Volume: 8 Number: 803

Today's topics:
     Re: [Q] Pattern matching syntax <terjebr@pvv.ntnu.no>
     Arrays and the  value they return... (Michael Ching)
     Comm.pl doesn't work, need a VTLS front-end (Sami Sandqvist)
     Re: Communication between parent and child <xrcc0494@dcaca037.ca.boeing.com>
     Re: Dynamic memory allocation/deallocation xewj@odin.sunquest.com
     Re: file locking - how does it act? (Ilya Zakharevich)
     Re: file locking - how does it act? <clark@s3i.com>
     Re: function pointer dereferencing (Chris Nandor)
     Re: Installing Perl under NT with IIS <serginho@alpha.hydra.com.br>
     Re: Is it possible? (brian d foy)
     joining lines in a file (Lydia S. Y. Scharon)
     Re: joining lines in a file <terjebr@pvv.ntnu.no>
     Looking for Sybperl sample programs for DBlib and/or CT <treasury.rroberts@capital.ge.com>
     pack'ing for an ioctl (John Harres)
     printf vs. print sprintf (Bart Lateur)
     printing <dev@sgi.net>
     Re: Q: PORTing Sybperl to mSQLperl (Nigel Reed)
     resolving the csh ~user directory in perl <mark.redar@barra.com>
     Re: security holes in perl 5.00401 @_@ <rra@stanford.edu>
     Re: SEMI-URGENT: How to connect to MS-SQL from Perl on  (Justin Burke)
     Splitting a filename <daniel.gueguen@elantiel.fr>
     swatch for NT? <Bryan.Ard@maryville.com>
     Re: SybPerl memory leak? <ericp@cnet.com>
     Webster dictionary <terjebr@pvv.ntnu.no>
     Re: where to go for html and SSI questions (Matthew D. Healy)
     wwwboard works, but wwwadmin doesn't <richie@2die4.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 31 Jul 1997 02:38:33 +0200
From: Terje Br}ten <terjebr@pvv.ntnu.no>
Subject: Re: [Q] Pattern matching syntax
Message-Id: <kbgvi1sqcmu.fsf@otto.pvv.ntnu.no>

Adam Grayson <dyrewolf@worldnet.att.net> writes:

> I want to run a pattern matching function on an array variable, the name
> of which is @cover[$i]. Not sure if that is correct to start with. Can I
> run /@cover[$i]/ to search for that string in a text line? 
I am not sure what your question is. If you have an array in perl
named @cover, the elment no. $i in that array can be obtained
by the expression $cover[$i].
If you want to search for the string @cover[i] in $_ you may use:

  /\@cover\[\$i\]/

If you want to search for a string $str in your array @cover you may
use:

  grep ($_ eq $str, @cover)

or

  grep (/^$str$/, @cover)

> 
> Another question: can "&" be used as a regular ASCII character, say to
> break up a text line that has the strings connected by an ampersand?
Sure, but you have to be careful to use single quotes around the &
char in your code, or put a \ in front of it.

-- 
******************************************************************************
Terje Breten                             |   "For God sent not his Son into
The Norwegian Institute of Technology  --+--  the world to condemn the world;
Faculty of Physics and Mathematics       |    but that the world through him
E-mail: terjebr@pvv.ntnu.no              |    might be saved" John 3:17
******************************************************************************


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

Date: Thu, 31 Jul 1997 22:07:36 GMT
From: MChing@POBoxes.com (Michael Ching)
Subject: Arrays and the  value they return...
Message-Id: <33e10bcc.825036@194.6.201.102>

I know that @array either a string of all the elements space
separated, or the number of elements. When I pass @array to a
subroutine, it just gives  me the count, I want it to give me each one
as  an element of @_;  Pretty much I need to determine which is going
to be used.  thanks.


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

Date: 31 Jul 1997 06:44:08 GMT
From: samiss@assari.cc.tut.fi (Sami Sandqvist)
Subject: Comm.pl doesn't work, need a VTLS front-end
Message-Id: <slrn45u0d2f.eh6.samiss@assari.cc.tut.fi>

I am trying to write a Perl script to use a VTLS library database with
telnet. The FAQ pointed me to Comm.pl for expect-like functionality, but
it seems to be written in perl4 and even the example programs don't run.
I have some experience with Perl and I don't think I broke the examples. I
only changed the hostname, username and password(for the simple telnet
client example). I am using perl 5.004. What now?

Sami
-- 
    "What is the sound of Perl?  Is it not the sound of a wall that
     people have stopped banging their heads against?"
		--Larry Wall in <1992Aug26.184221.29627@netlabs.com>


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

Date: Thu, 31 Jul 1997 20:36:41 GMT
From: "robert c. combs" <xrcc0494@dcaca037.ca.boeing.com>
Subject: Re: Communication between parent and child
Message-Id: <33E0F759.7FB4@dcaca037.ca.boeing.com>

Doug Seay wrote:
> 
Sun Jian wrote:
>
> Hi,
>
>   I have a parent process who creates a child process.
> In my program, there is a variable $flag. When the value
> of $flag is changed in the child process, it seems that
> the parent process doesn't know and it still sees $flag
> with its original value. I would like to know what is the
> easiest method for the parent and the child to 'share' the
> variable so that when it's changed in either process, the
> other process is able to see the change immediately.
 
Fortunately, the easiest way may be the best way (in this case).
If you create a shared memory segment to put $flag into, before you 
call fork, the child process will use the shared memory segment
without any extra work.

I do this in C/C++ quite a bit, Unfortunately I don't have a perl
example handy, but perl does use the standard shared memory 
routines (right???). And should look SOMETHING like the following
C++ example:

// create the shared memory segment for logins
if ( (shmid=shmget(KEY, sizeof(login), IPC_CREAT|0666)) < 0) {
   cerr << "errormsg" << endl;
   exit(1);
} else {
   lp = (login *)shmat(shmid, 0, 0);
}


do something with lp here.....


switch (fork()) {

   // the child process goes here
   case 0: 
      // go do child stuff with shared memory lp
      childdo(lp);

      exit(0);
      break;  // redunant I know

    // an error goes here
    case -1:
       cerr << "Uunable to fork" << endl;
       break;

    // parent always goes here
    default:
       break;
} // end fork


after you're all done be sure to clean up...

// clean up shared memory
shmdt(lp);
shmctl(shmid, IPC_RMID, 0);


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

Date: 31 Jul 1997 22:39:29 GMT
From: xewj@odin.sunquest.com
Subject: Re: Dynamic memory allocation/deallocation
Message-Id: <5rr471$s11$1@iggy.sunquest.com>

In article <33E0A566.385EF00E@hotmail.com>,
Larry D'Anna  <ldanna@hotmail.com> wrote:
>dave wrote:
>
>> I'm keeping a global array of references to hashes.  Each hash is
>> created with its reference pushed on the array.  The hash is then
>> identified by the index of its reference in the array.  This provides
>> an ID that is a simple number.
>> I'm thinking I should periodically clean up the array, removing hashes
>> that are no longer used.  How do I insure the memory is deallocated?
>$array[hash_i_don't_need_anymore] = undef;

Wouldn't that be:
undef \$array[hash_i_don't_need_anymore];
$array[hash_i_don't_need_anymore] = undef;

Someone more experienced in Perl internals needs to make a call here- do
all implementations of perl (cross platform) perform cleanup if you're keeping
references in an array?

Interesting issue...



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

Date: 31 Jul 1997 01:11:47 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: file locking - how does it act?
Message-Id: <5roooj$jp5@agate.berkeley.edu>

In article <EE5DF9.51z@bcstec.ca.boeing.com>,
Charles DeRykus <ced@bcstec.ca.boeing.com> wrote:
> In article <33DECDFF.C8BF50C9@nmia.com>,  <soki@nmia.com> wrote:
>  > Let's say I do something like this...
>  > 
>  > #!/usr/bin/perl
>  > open(FU, "bar");
>  > flock(FU, 2);
>  > @fubar = <FU>;
>  > close(FU);
>  > 
>  > push @fubar, "Hello.\n";
>  > ...
>  > 
>  > Will the file "bar" still be locked until the script finishes?
>  > 
> 
> Yes.

I do not think so.  On some obsolete OSes this may be true indeed.
This is not true with flock() on OS/2 (yes, it is working - at last -
thanks to Rocco Caputo), and probably on any other contemporary design
OS, where locks are resources owned by a process.

This is an uncompatibility, but since it is an improvement (well,
depending of what you want to do, of course!) over the documented
behaviour, I consider this uncompatibility as a good one (if such a
termin existed ;-).

Ilya















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

Date: 30 Jul 1997 17:48:29 -0400
From: Clark Dorman <clark@s3i.com>
Subject: Re: file locking - how does it act?
Message-Id: <dk9i89poy.fsf@s3i.com>


trs@azstarnet.com (Tim  Smith) writes:
> In article <33DECDFF.C8BF50C9@nmia.com>,  <soki@nmia.com> wrote:
> >Will the file "bar" still be locked until the script finishes?
> 
> No.
> 
> If you have access to a Unix machine, read the man page for flock and
> it will give more info.  In short, though, when you close a file the
> lock is dropped automatically, there's no need to unlock it explicitly.
> 
> >Also, how do shared locks work with exclusive locks?  Let's say I have
> >a process with a shared lock on some file.  Then a second process
> >requests an exclusive lock and a third process requests a shared lock. 
> >Will the file lock go to the process requesting an exclusive lock before
> >it goes to the third process?
> 
> The file lock goes to the process requesting a shared lock first.  When
> all the shared locks are dropped, then the exclusive lock can go through.

It would be very nice to have a working example of the granting,
releasing, and sharing of locks of a file.  On the perlfunc page under
flock, it recommends the DB_File page for an example.  It looks quite
interesting, and I would love to try what it says under the Locking
Database section: "Run this repeatedly in the background to watch the
locks granted in proper order."  Unfortunately, I do not have (and
cannot presently install) the Berkeley DB database.

Does anyone have a similar example that works with vanilla-Perl?

-- 
Clark


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

Date: Wed, 30 Jul 1997 08:54:59 -0500
From: pudge@pobox.com (Chris Nandor)
Subject: Re: function pointer dereferencing
Message-Id: <pudge-ya02408000R3007970854590001@news.idt.net>

In article <memo.19970729031836.45313F@horus.cix.co.uk>,
pete@horus.cix.vapethis.co.uk wrote:

# In article <8cn2n6yiw6.fsf@gadget.cscaper.com>, merlyn@stonehenge.com
# (Randal Schwartz) eeeked:
# 
# > Eeek.  It works.  So now we have a do-block that understands
# > return:
# >
# >       $a = sub {
# >               ...;
# >               ...;
# >               return $blah if $cond;
# >               ...;
# >       } -> ();
# >
# > Eeek.  Eeek.
# 
# Excuse me while I start quietly gibbering to myself.
# 
# Trouble is, I can immediately envisage situations where I might actually
# want to /use/ constructs like that.

You mean, aside from Obfuscated Perl contests?

--
Chris Nandor             pudge@pobox.com             http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])


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

Date: 31 Jul 1997 19:58:00 GMT
From: "Sergio Stateri Jr" <serginho@alpha.hydra.com.br>
Subject: Re: Installing Perl under NT with IIS
Message-Id: <01bc9dec$6c7e7200$ca75e7c8@AFXTD_202.Autofax>

Parillo <lparillo@newshost.li.net> escreveu no artigo
<5ri0sc$g0d$1@news01.li.net>...
> Could it be that the default web user does not have permission to the 
> scripts directory?

Hi agauin...The problem was that I didn't have defined the .pl value in
RegEdit :))

Thanks :))

> 
> lparillo at suffolk dot lib dot ny dot us
> 
> Sergio Stateri Jr (serginho@alpha.hydra.com.br) wrote:
> : Hi! I installed Perl 5 under a Win NT WorkStation machine with IIS. I
added
> : the registry entry for .pl files call the /Perl/bin/Perl.exe
interpreter.
> : But...When I try to call a script in the scripts directory of IIS, the
> : server tell me this :
> 
> : HTTP/1.0 403 Access Forbidden (Read Access Denied - This Virtual
Directory
> : does not allow objects to be read.) 
> 
> : Then I try to change the registry, and now the browser call the script,
but
> : it doesn't show anything and never show me the results (it's always
> : running...)
> 
> : Can Anyone send me some help ? Thanks a lot.
> 
> 
> : -- 
> : --------------------------------------------
> : Sergio Stateri Jr
> : Sco Paulo (SP) - Brazil
> : e-mail: serginho@usa.net
> : --------------------------------------------
> 

Regards,




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

Date: Fri, 01 Aug 1997 02:25:48 -0500
From: joe@ (brian d foy)
Subject: Re: Is it possible?
Message-Id: <joe-ya02408000R0108970225480001@news.walrus.com>

In article <870386933.12854@dejanews.com>, dschlot@george.arc.nasa.gov wrote:

> Is it possible for a Perl script to take the input from an html form,
> generate a new html document with the contents of the form, and then add a
> link to the new document on another page? I went to a one day Perl class
> and they had something similar but it was adding a link to the same page
> the form was on instead of a different page.


yes.  i do it almost daily.  there's even going to be a user demonstration
at the Perl Conference about this. :)

with which part of the problem are you having trouble?  if it's a CGI
problem, try comp.infosystems.www.authoring.cgi (second door on the left).

-- 
brian d foy                                         <comdog@computerdog.com>


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

Date: 30 Jul 1997 15:42:35 -0500
From: lss2@clarion.cec.wustl.edu (Lydia S. Y. Scharon)
Subject: joining lines in a file
Message-Id: <5ro8vr$gm8@clarion.cec.wustl.edu>

I have a quick question.  I am trying to a parse a file with a parsing
script that I have written.  But now I have been thrown for a loop.  I
need to search each line and see if it ends with a ".  If it doesn't, then
I need for that line to join with the next line, add a special character,
and do the search again on the newly formed line before continuing on to
the next line. I know how to join a list into a single string, but do i
need to turn this whole file into a list?  I also know how to take STDIN
and do this, but how do you do this to lines in a file? 


Hope that is enough info...

TIA
Lydia  



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

Date: 31 Jul 1997 00:28:10 +0200
From: Terje Br}ten <terjebr@pvv.ntnu.no>
Subject: Re: joining lines in a file
Message-Id: <kbg3eowrx8l.fsf@otto.pvv.ntnu.no>

lss2@clarion.cec.wustl.edu (Lydia S. Y. Scharon) writes:

> I have a quick question.  I am trying to a parse a file with a parsing
> script that I have written.  But now I have been thrown for a loop.  I
> need to search each line and see if it ends with a ".  If it doesn't, then
> I need for that line to join with the next line, add a special character,
> and do the search again on the newly formed line before continuing on to
> the next line. I know how to join a list into a single string, but do i
> need to turn this whole file into a list?  I also know how to take STDIN
> and do this, but how do you do this to lines in a file? 
> 
> 
> Hope that is enough info...
> 

Let us assume you have opened the file and is addressing it
with the filehandle FILE, and that "X" is the special
character that you want to add:

do
{
  $line = "";
  while ($_=<FILE> && m/\"$/)
  {
    $line .= "X$_";
  }

#do something with $line

} until eof(FILE);


Hope this helps.

-- 
******************************************************************************
Terje Breten                             |   "For God sent not his Son into
The Norwegian Institute of Technology  --+--  the world to condemn the world;
Faculty of Physics and Mathematics       |    but that the world through him
E-mail: terjebr@pvv.ntnu.no              |    might be saved" John 3:17
******************************************************************************


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

Date: Wed, 30 Jul 1997 19:32:05 -0400
From: Ron Roberts <treasury.rroberts@capital.ge.com>
Subject: Looking for Sybperl sample programs for DBlib and/or CTlib
Message-Id: <33DFCEF5.3BE5@capital.ge.com>

Where can I find some sample Sybperl::DBlib and/or Sybperl::CTlib
programs?  I am looking for some samples of the basic functions
including sending SQL statements, binding column names to 
program variables, cursors, fetching rows, etc.


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

Date: Thu, 31 Jul 1997 18:06:27 GMT
From: harres@uwyo.edu (John Harres)
Subject: pack'ing for an ioctl
Message-Id: <33e0d1dd.1814262291@news>

The quotactl on Solaris uses ioctl to set its values.  The arguments are:

ioctl( fd, Q_QUOTACTL, qp)

where qp is a pointer to a structure containing:

struct quotctl {
	int op;
	long uid;
	caddr_t addr;
};

and addr is a pointer to a structure of 8 unsigned longs.  (Whew!).

Now, I tried to pack one of these up with:

$dqblk = pack( "LLLLLLLL", 0,0,0,0,0,0,0,0);
$qp = pack( "ilP", $Q_GETQUOTA, $uid, $dqblk );

ioctl FH, $Q_QUOTACTL, $qp;

The ioctl succeeds, but $dqblk is still all 0's.

I'm concerned that I'm not packing up a proper pointer to the $dqblk structure
in $qp.

Suggestions/corrections?

John Harres
harres@uwyo.edu


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

Date: Thu, 31 Jul 1997 10:40:49 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: printf vs. print sprintf
Message-Id: <33e06a21.76565@news.tornado.be>

The POD says that "printf" is equivalent to "print sprintf". Well it
isn't. Try this:

	$\="EOL\n";	
	$_ = "some text";
	print sprintf("<%s>",$_);
	printf "<%s>",$_;

You'll soon see the difference. Yup, the EOL is missing in printf.

Bart.
--
Spam spam spam spam spam spam spam spam,
Lovely Spam!...  Loooooovely Spam!!!
		Monty Python, "The Spam Song"



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

Date: Thu, 31 Jul 1997 13:12:16 -0400
From: Devin Anderson <dev@sgi.net>
Subject: printing
Message-Id: <33E0C770.3389@sgi.net>

I'm trying to print output from a cgi script. The problem is that when
someone types in text in a textarea, there are no newlines so the
printer just runs the line off the side of the page.

What is the best way to format the text so that it won't run off the
page? Use a regular expression to place a newline/carrige return every
79 character? I tried to pipe the output thorugh 'pr', but I can't get
the pr to format it correctly.

Any ideas?

Thanks!!

---								
Devin P. Anderson							
Webmaster, Systems Administrator					
Stargate Industries, Inc.	      
http://www.sgi.net/		
Phone: 412.930.STAR (7827) ext. 241	
F a x: 412.930.7110  					        	

kernel, n.:
        A part of an operating system that preserves the medieval
        traditions of sorcery and black art.

-----PGP PUBLIC KEY AVAILABLE-----


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

Date: 31 Jul 1997 20:43:43 GMT
From: nigelr@convex.com (Nigel Reed)
Subject: Re: Q: PORTing Sybperl to mSQLperl
Message-Id: <5rqtdv$gbi$1@news.rsn.hp.com>

dileep@wlink.com.np wrote:
: In the Dec 96 issue of SysAdmin, I found an article on a web-based
: helpdesk.  The author used Sybase and sybperl.  I would like to port
:  it to mSQL and msqlperl.  The author told me that sybperl is ANSI
: compliant.
: 
: I am new to Perl leave alone msqlperl or sybperl.  So, I request you
: gurus to assist me.  I am enclosing one of the scripts.

msql is 'semi' ansi compliant, ie, it takes a subset of the ansi
standard, therefore Mini SQL. You might be better asking them to
do the port for you. There are some differences that might not be
too easy to figure out.

Regards
Nigel
-- 
Nigel Reed                       Pager: 214 322 6311 Enter area code +number
Consultant  Work: 972 497 4877   Home Email: nigel@nelgin.cmpu.net
HP Convex Division, 3000 Waterview Parkway, Richardson, Tx, 75083


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

Date: Wed, 30 Jul 1997 12:27:11 -0700
From: Mark Redar <mark.redar@barra.com>
Subject: resolving the csh ~user directory in perl
Message-Id: <33DF958F.FA9A0213@barra.com>

Hi,

I'm trying to find a way to resolve the csh user home directory alias
(~user) in perl. Any ideas??

thanks,

mark


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

Date: 30 Jul 1997 18:45:11 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: security holes in perl 5.00401 @_@
Message-Id: <m3yb6ouh94.fsf@windlord.Stanford.EDU>

Gil <mingtian@hotmail.com> writes:

> he sent me one mail that my chat script was the seed calling the hacker
> due to FreeBSD's security hole,

Someone's having a great deal of fun with you.

> please read the following..

[snip standard buffer exploit down to...]

>         execl("/usr/bin/sperl5.00403",
> "/usr/bin/sperl5.00403", buf, NULL);
> }

sperl5.00403 doesn't exist anywhere.  That would be Perl 5.004_03, and
5.004_02 is the latest version (and that's just a limited distribution for
initial testing purposes at this point).

Someone's lying to you.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Thu, 31 Jul 1997 22:22:31 GMT
From: justsup@delta.net (Justin Burke)
Subject: Re: SEMI-URGENT: How to connect to MS-SQL from Perl on Linux?
Message-Id: <33e20f92.4680577@news.deltanet.com>

On 25 Jul 1997 21:52:14 GMT, bjepson@ids.net (Brian Jepson) wrote:

>In article <5raf8g$h48$1@dismay.ucs.indiana.edu>, Brian Wheeler wrote:

>>I need to connect to a MSSQL server from my linux box.  I've tried to use

>If you have web access, you might want to check out an article I did
>on this for the Linux Gazette. It explains how to build Sybperl on
>Linux and includes examples that work with Sybase and MS SQL Server.


The method described above may work great for Linux, but does anyone
know of a way to access MS-SQL from a non-Linux platform?

Thanks for any help,

Justin Burke


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

Date: Wed, 30 Jul 1997 23:22:20 GMT
From: "Daniel GUEGUEN" <daniel.gueguen@elantiel.fr>
Subject: Splitting a filename
Message-Id: <01bc9d39$2b055e00$cdcc06c3@dns1.elantiel.fr>

Hello,

I don't find the solution to split a file name :

Example :
$FicName = '<../data/customer.txt';
 ...
($Name,$Extension) = split(/here is the problem.../,$FicName);
$Extension must countain 'txt' and $Name the rest of the string.

Thank's for your help.

Daniel
daniel.gueguen@elantiel.fr




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

Date: Thu, 31 Jul 1997 00:35:35 -0500
From: Bryan Ard <Bryan.Ard@maryville.com>
Subject: swatch for NT?
Message-Id: <01bc9d73$90e66770$9001010a@slwpcx044>

Has anyone seen a port of swatch or swatch++ for NT that will monitor the
event logs?
TIA,
Bryan



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

Date: Wed, 30 Jul 1997 17:02:42 -0700
From: Eric Passmore <ericp@cnet.com>
To: William W Chong <wchong@worldnet.att.net>
Subject: Re: SybPerl memory leak?
Message-Id: <33DFD622.A2A@cnet.com>

William W Chong wrote:
> 
>  I tracked it down to $db->dbnextrow
> and believe it's holding references internally.
> Has anyone else noticed this?  And is there a way
> that I can free that memory inside Sybperl?


If you're using the Syperl package, every time you call dblogin or
dbopen a new Sybperl module is created and the old one doesn't get
destroyed. 

If this is the case, don't call these methods, or use sybutil.pl to
create an open client connection. In my opinion Sybperl isn't designed
to hold connections open. 


> 
> Thanks.
> 
> Will
> wchong@svip.com

-- 
________________________________________
               CNET, Inc.           
             ERIC PASSMORE        
           Software Engineer


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

Date: 30 Jul 1997 23:36:16 +0200
From: Terje Br}ten <terjebr@pvv.ntnu.no>
Subject: Webster dictionary
Message-Id: <kbgafj4rzn3.fsf@otto.pvv.ntnu.no>

Here is a perl program that let you have access to the
online WWWebster dictionary from the unix command line,
without having to start a web browser first.

I hope some of you may find it useful. Enjoy.

----CUT-----START INCLUDED FILE-----CUT----
#!/usr/bin/perl
#
#    Copyright )1997  Terje Breten     E-mail: terjebr@pvv.ntnu.no
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even any implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  This program assumes your terminal can handle the ISO-8859-1 char-set.

require 5.002;
use strict;
use Socket;

my ($more_linebreaks) = 0;
# Set $more_linebreaks to be non-zero if you want to put
# more line breaks (newlines) into the output.

if ($ENV{'WEBSTER_VERBOSE'})
{
    $more_linebreaks = 1;
}

my ($word) = shift;
my ($option) = "";
my ($Book) = "Dictionary";

die "No word to define. (Use option -? for help.)\n" unless $word;
if ($word =~ s/^-//)
{
    $option = $word;
    $word = shift;
}

if ($option =~ m/^c/i)
{
    print "
This client for the WWWebster dictionary
would not be possible if Merriam-Webster Inc had not
put their dictionary on the web for everyone to use.

The WWWebster dictionary is found at http://www.m-w.com/netdict.htm

Based on Merriam-Webster's Collegiate. Dictionary,
10th Edition published by Merriam-Webster Inc.

";
    exit;
}

if ($option =~ m/\?|^h/i)
{
    my ($prog) = $0;
    $prog =~ s:^.*/::;

    print "
This is a tiny WWW-browser that connect to the WWWebster
dictionary at http://www.m-w.com/

It is based on Merriam-Webster's Collegiate. Dictionary,
10th Edition published by Merriam-Webster Inc.

Syntax: $prog <option>|<word>

<word> is a word to find in the dictionary.

<option> is one of the following:

 -d <word>, 
 -dictionary <word> : Use the dictionary to define <word>. This is
                      the same as to just specify a word with no options.

 -t <word>,
 -thesaurus <word>  : Use the thesaurus to find a <word> instead of 
                      using the dictionary.

 -c, -credit        : Display the credit.

 -?, -help          : Display this help.

 -m, -mail          : Read your mail

If you have set the environment variable WEBSTER_VERBOSE to true
(or anything nonzero) this WWWebster client will insert more
newlines in the output.

";
    exit;
}

if ($option =~ m/^m/i)
{
    exec 'cat $MAIL';
}

if ($option =~ m/^t/i)
{
    $Book = "Thesaurus";
}

die "No word to find. (Use option -? for help.)\n" unless $word;

my (%Quotes)= (
 "quot"   => "\"",
 "amp"    => "\&",
 "shy"    => "-",
 "lt"     => "<",
 "gt"     => ">",
 "copy"   => pack("c",169),
 "deg"    => pack("c",176),
 "Agrave" => pack("c",192),
 "Aacute" => pack("c",193),
 "Acirc"  => pack("c",194),
 "Atilde" => pack("c",195),
 "Auml"   => pack("c",196),
 "Aring"  => pack("c",197),
 "AElig"  => pack("c",198),
 "Ccedil" => pack("c",199),
 "Egrave" => pack("c",200),
 "Eacute" => pack("c",201),
 "Ecirc"  => pack("c",202),
 "Euml"   => pack("c",203),
 "Iacute" => pack("c",205),
 "Icirc"  => pack("c",206),
 "Igrave" => pack("c",204),
 "Iuml"   => pack("c",207),
 "ETH"    => pack("c",208),
 "Ntilde" => pack("c",209),
 "Ograve" => pack("c",210),
 "Oacute" => pack("c",211),
 "Ocirc"  => pack("c",212),
 "Otilde" => pack("c",213),
 "Ouml"   => pack("c",214),
 "Oslash" => pack("c",216),
 "Ugrave" => pack("c",217),
 "Uacute" => pack("c",218),
 "Ucirc"  => pack("c",219),
 "Uuml"   => pack("c",220),
 "Yacute" => pack("c",221),
 "THORN"  => pack("c",222),
 "szlig"  => pack("c",223),
 "agrave" => pack("c",224),
 "aacute" => pack("c",225),
 "acirc"  => pack("c",226),
 "atilde" => pack("c",227),
 "auml"   => pack("c",228),
 "aring"  => pack("c",229),
 "aelig"  => pack("c",230),
 "ccedil" => pack("c",231),
 "egrave" => pack("c",232),
 "eacute" => pack("c",233),
 "ecirc"  => pack("c",234),
 "euml"   => pack("c",235),
 "igrave" => pack("c",236),
 "iacute" => pack("c",237),
 "icirc"  => pack("c",238),
 "iuml"   => pack("c",239),
 "eth"    => pack("c",240),
 "ntilde" => pack("c",241),
 "ograve" => pack("c",242),
 "oacute" => pack("c",243),
 "ocirc"  => pack("c",244),
 "otilde" => pack("c",245),
 "ouml"   => pack("c",246),
 "oslash" => pack("c",248),
 "ugrave" => pack("c",249),
 "uacute" => pack("c",250),
 "ucirc"  => pack("c",251),
 "uuml"   => pack("c",252),
 "yacute" => pack("c",253),
 "thorn"  => pack("c",254),
 "yuml"   => pack("c",255),
	       );

my ($part,$skip,$StartString,$notfound,$hdwd,$idx,$choice,@Options,$list);

&MWOpen("book=$Book&va=$word");

$part = 0;
$skip = 1;
$StartString = "New Search</a>\]";

while (<MW>)
{
    if ($skip != 0)
    {
	next unless m#$StartString#;
	$skip = 0;
	$part++;
    }

    if ($part==1)
    {
	$part=2;
	$notfound=0;
	next;
    }

    if ($part==2)
    {
	if (/<pre>/)
	{
	    $skip = 1;
	    $StartString = "Entry.*:";
	    $part=4;
	    next;
	}

	
	if(/No entries found/)
	{
	    $notfound=1;
	}

	if (/To view an entry in the list/)
	{
	    $part=3;
	    $idx=0;
	    @Options=();
	    print "Choose an entry from this list:\n\n";
	    next;
	}
    }

    if ($part==3)
    {
	if(/<pre>/)
	{
	    m/name=hdwd value=(\w*)/;
	    $hdwd = $1;
	    next;
	}

	if (s/<option[^>]*>//)
	{
	    $idx++;
	    print "$idx - $_";
	    chop;
	    push(@Options,$_);
	    next;
	}

	$part=4;

	m/name=list value=\"([^\"]*)/;
	$list = $1;

	print "\nEnter choice (1-$idx): ";
	$choice = <STDIN>;
	chop $choice;
	if ($choice !~ s/(\d+)/$1/)
	{
	    print "$choice was not a valid choice.\n";
	    close (MW) || die "close: $!";
	    exit;
	}
	if ($choice<1 or $choice>$idx)
	{
	    print "$choice is not in the range 1-$idx.\n";
	    close (MW) || die "close: $!";
	    exit;
	}
	if (!$notfound && $choice == 1 && $idx>1)
	{
	    print "\n\n";
	    $part++;
	    next;
	}

	print "\n";
	close (MW) || die "close: $!";

	&MWOpen( "book=$Book\&hdwd=$hdwd\&jump="
	         . &quote($Options[$choice-1])
		 . "\&list=". &quote($list)
               );

	$part=0;
	$skip = 1;
	$StartString = "New Search</a>\]";

	next;
    }

    if ($part==5)
    {
	s:<sup>(\d+)</sup>:$1 :;
	$part++;
    }

    s/<br>/\n/gi;

    if ($part==6)
    {
	last if m/<br clear=left>/;

	chomp;
	s/^(Text:)/$1\n/;
	s:^<i>(.+?)</i>$:"\n\U$1":gem;
	s#<b>(\s*[^\d\W]\s*)</b>(.*?<b>:)#\n  $1$2#gi;

	if ($more_linebreaks)
	{
	    s/^\s*<b>\s*(\d)/\n$1/gim;
	    s#\((\d+)\)(.*?)<b>:#\n    ($1)$2:#gi;
	    s/\n    \(1\)/(1)/g;
	}
    }

    s/<[^>]*>//g;

    s/\&#(\d+);/pack("c",$1)/eg;
    s/\&([^;]+);/$Quotes{"\L$1"}/eg;

    print;
}

print "\n\n";
close (MW) || die "close: $!";
exit;


sub MWOpen
{
    my ($SendString) = @_;
    my ($WWWebster,$port) = ("www.m-w.com",80);
    my ($URI) = "/cgi-bin/netdict";

    my ($iaddr,$paddr,$proto);

    $iaddr = inet_aton($WWWebster);
    $paddr = sockaddr_in($port, $iaddr);
    $proto   = getprotobyname('tcp');

    socket(MW, PF_INET, SOCK_STREAM, $proto) || die "socket: $!";
    connect(MW, $paddr) || die "connect: $!";

    select((select(MW),$|=1)[0]);

    print MW "POST $URI HTTP/1.0
User-Agent: Terjes webster agent
Host: $WWWebster
Accept: text/html
Content-type: application/x-www-form-urlencoded
Content-Length: " . length($SendString) .
"\n\n$SendString";
}

sub quote
{
    my ($string) = @_;
    $string =~ s/ /\+/g;
    $string =~ s/([^\w\+])/"\"\\\%\\U".unpack("H2",$1)."\""/eeg;
    return $string;
}



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

Date: Wed, 30 Jul 1997 18:26:56 -0500
From: Matthew.Healy@yale.edu (Matthew D. Healy)
Subject: Re: where to go for html and SSI questions
Message-Id: <Matthew.Healy-3007971826560001@pudding.med.yale.edu>

> 
> Try comp.infosystems.www.authoring.cgi (if you are discussing the cgi
interface)
> 

And they will probably also tell you to go elsewhere.  Probably
you should post to comp.infosystems.servers.whatever because SSI
is server-specific...
--------
Matthew.Healy@yale.edu           http://ycmi.med.yale.edu/~healy/
As of 29 Jul 1997, only 885 days until Y2K....
Any person with a phone line can become a town crier with a voice
that resonates farther than it could from any soapbox.
--The US Supreme Court, overturning the Communications Decency Act


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

Date: Wed, 30 Jul 1997 21:43:04 -0400
From: "Richie" <richie@2die4.com>
Subject: wwwboard works, but wwwadmin doesn't
Message-Id: <5roqk4$pt2@news1.infoave.net>

 I've got my wwwboard working, but when I try to access the wwwadmin.cgi
file, I get an error:

404 Not Found
The requested URL /errors/server.html was not found on this server

I have the wwwadmin.cgi file in my cgi bin and it has been chmoded 755, and
so has cgi-lib.pl, which is in the same directory.  Why won't it work? Do I
need to rename the cgi-lib to cgi-lib.cgi?

Please e-mail me all replies,
Richie
nospamrichie@2die4.com
To e-mail me, please remove the 'nospam'







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

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

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