[6299] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 922 Volume: 7

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Feb 10 17:59:22 1997

Date: Mon, 10 Feb 97 12:00:24 -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           Mon, 10 Feb 1997     Volume: 7 Number: 922

Today's topics:
     CGI & Oraperl together ?? (Thomas Armstrong Kobrich)
     CGI: System calls <ged@fi.muni.cz>
     Re: Commercial success stories using perl. <rturek@access.digex.net>
     Re: Diffuculty writing carriage-return to file (Eric Harley)
     Re: Diffuculty writing carriage-return to file (Tad McClellan)
     Dynamic Wed Critique Project <TERRANCESMITH@www.concentric.net>
     Re: Dynamic Wed Critique Project (Nathan V. Patwardhan)
     Flow control question <dcrane@ivs.piedmont.net>
     Re: Flow control question (Dave Thomas)
     Hashs, associative arrays, and structures <aroman@nmsu.edu>
     Re: Hashs, associative arrays, and structures (Mike Stok)
     Re: Help!read/write telnet process from perl (Matthew H. Gerlach)
     HELP: variable interpretation?? (Chris E. Jones)
     Re: HELP: variable interpretation?? (Mike Stok)
     Hierarchical Directory Tree <jputnam@nwu.edu>
     Re: Hierarchical Directory Tree (Jan Schipmolder)
     how to change of a given string? luis@ged.com
     Re: Loops in perl (Brian Wheeler)
     OraPerl for Perl4 on Alpha running Oracle 7.3 ??? (Victor Walker)
     Re: Perl 5.003 causes segmentation fault on SGI Irix (I R A Aggie)
     Question about using "system" command (Premkumar Natarajan)
     Re: Review date notifier (Nathan V. Patwardhan)
     SIGCHLD and process ID <meena@gwcom.com>
     Re: SIGCHLD and process ID (Mike Stok)
     Re: SIGPIPE in server script - where's the pipe? <minaret@sprynet.com>
     transliteration library <stijnvd@cwi.nl>
     Re: Using sockets to connect to daemon - code wanted. <minaret@sprynet.com>
     Win32/NT problems with ARGVand .pl association <troruud@online.no>
     Re: XS problem - Can't find loadable object <minaret@sprynet.com>
     Re: You were there:1981 (Was: Using exec-Why won't this <twpierce+usenet@mail.bsd.uchicago.edu>
     Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)

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

Date: 10 Feb 1997 16:17:59 GMT
From: tarmstro@caleuche.inf.UDEC.CL (Thomas Armstrong Kobrich)
Subject: CGI & Oraperl together ??
Message-Id: <5dnhnn$odd@news.dpi.udec.cl>

	Hi there:

		I'm trying to print out to the browser info
	from an oracle database (using DBD:Oracle, the new version
	of oraperl).

		When I run the scrip offline (from command line)
	it works ok, but when called from the browser, everything
	printed after the call to ora_login() vanishes...

		Any ideas??

		Thanx in advance.

--
--------------------------------------------------------------------
|   Thomas Armstrong Kobrich    |   tarmstro@caleuche.inf.udec.cl  |
|  3 norte 73 - Lonco Oriente3  |    tarmstro@canelo.ing.udec.cl   |
|      Concepcion - Chile       |     Universidad de Concepcion    |
---------------- http://www.ing.udec.cl/~tarmstro/ -----------------


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

Date: Mon, 10 Feb 1997 18:21:23 GMT
From: Petr Ged Kunc <ged@fi.muni.cz>
Subject: CGI: System calls
Message-Id: <32FF6722.167E@fi.muni.cz>

I have such problem:

I'd like to connect to Oracle 7 database using PERL.
Sytem calls works right when I run PERL script from UNIX command line,
but they don't work as CGI-scrips.

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

print "Content type: text/html\n\n<PRE>\n";

@lines1 = `/packages/run/lynx-2.5/bin/lynx -source
http://www.yahoo.com`;
@lines2 = `ls -l`;
@lines3 = `/packages/run/oracle/bin/sqlplus -s ged/password \@all`;
print @lines1;
print @lines2;
print @lines3;

print "</PRE>\n";
-------------------------------------------
If the script is run from UNIX, if prints all three @lines,
but from WWW only @lines1 and @lines2.

Cen you help me?

Thank you very much.
 

                                            #--------------------------#
                                            |        Petr Kunc         |
                                            |     ged@fi.muni.cz       |
                                            | http://www.muni.cz/~ged/ |
                                            #--------------------------#


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

Date: Mon, 10 Feb 1997 13:51:57 -0500
From: rturek <rturek@access.digex.net>
Subject: Re: Commercial success stories using perl.
Message-Id: <32FF6E4D.4811@access.digex.net>

Steve Vanechanos wrote:
> 
> I am looking for significant commercial success stories where perl is
> being used.
> 
> (snip)

 We use Entera from Open Environment Corporation (recently bought by
Borland!)  The Entera toolset (use to build DCE and TCP application and
data servers on UNIX platform) uses Perl extensively.  
They deliver a version of perl with their toolset.  
Perl scripts are used to parse IDL and create gobs of C source code for
integration with our code.
Scripts are also used to run their test tools as well as other
utilities.


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

Date: Mon, 10 Feb 1997 08:26:51 -0800
From: erich@powerwareintl.com (Eric Harley)
Subject: Re: Diffuculty writing carriage-return to file
Message-Id: <erich-1002970826520001@ppp-207-104-16-130.snrf01.pacbell.net>

In article <PLwyzHAEcj$yEw4i@doobry.demon.co.uk>, Dave Wilkinson
<doobry@doobry.demon.co.uk> wrote:

> In article <32F96619.3830@amagicstore.com>, A MAGIC STORE
> <max@amagicstore.com> writes
> >I've programmed a couple of scripts in Perl, I've uploaded them to my
> >server (UNIX) but they are not working. My server said that there is a
> >^M (new line) at the end of each line. I'm using Win95 Notepad.
> >Does anybody know any FTP client or other program that transform MS-DOS
> >based text files into UNIX text files (basically without the ^M at the
> >end of each line)??
> >
> >Thank you.
> >
> >Max
> 
> I have recently had this problem too and tried for some time to write a
> Perl script which replaced every occurence of 0x0D0x0A in a DOS file
> with an 0x0A to convert it to UNIX format.
> 
> However - no matter what method I tried, when I tried to write a single
> 0x0A to the file it wrote it as 0x0D 0x0A . I had to write it in C in
> the end!
> 
> (Im running Perl v5.0x on an NT platform BTW)
> 
> So then, how do you write binary characters to a file without this
> happening?
> 

I did this:
while (<>) {
$line =~s /\n/\r/g
print STDOUT "$line";
}

and it this little thing would convert unix files to mac files. Now all
you had to do was reverse that up there to convert back. If you wanted to
go from msdos to unix. This would work:

while (<>) {
$line =~ tr/0x0D0x0A/0x0A/g
print STDOUT "$line";
}

if you will notice, I put a small g at the end of both regexps. This will
make the patterns go through the entire line and not just stop after the
first occurence.

Hope this helps!
:) erich@powerwareintl.com


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

Date: Mon, 10 Feb 1997 10:55:35 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Diffuculty writing carriage-return to file
Message-Id: <7ujnd5.6g2.ln@localhost>

Eric Harley (erich@powerwareintl.com) wrote:
: In article <PLwyzHAEcj$yEw4i@doobry.demon.co.uk>, Dave Wilkinson
: <doobry@doobry.demon.co.uk> wrote:

: > In article <32F96619.3830@amagicstore.com>, A MAGIC STORE
: > <max@amagicstore.com> writes
: > >I've programmed a couple of scripts in Perl, I've uploaded them to my
: > >server (UNIX) but they are not working. My server said that there is a
: > >^M (new line) at the end of each line. I'm using Win95 Notepad.
: > >Does anybody know any FTP client or other program that transform MS-DOS
: > >based text files into UNIX text files (basically without the ^M at the
: > >end of each line)??
: > >
: > >Thank you.
: > >
: > >Max
: > 
: > I have recently had this problem too and tried for some time to write a
: > Perl script which replaced every occurence of 0x0D0x0A in a DOS file
: > with an 0x0A to convert it to UNIX format.
: > 
: > However - no matter what method I tried, when I tried to write a single
: > 0x0A to the file it wrote it as 0x0D 0x0A . I had to write it in C in
: > the end!
: > 
: > (Im running Perl v5.0x on an NT platform BTW)
: > 
: > So then, how do you write binary characters to a file without this
: > happening?
: > 

: I did this:
: while (<>) {


Oops!

while ($line = <>) {
#      ^^^^^^^


: $line =~s /\n/\r/g
: print STDOUT "$line";
: }

[ snip ]

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


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

Date: Mon, 10 Feb 1997 10:02:00 -0600
From: TREX <TERRANCESMITH@www.concentric.net>
Subject: Dynamic Wed Critique Project
Message-Id: <32FF4678.21D3@www.concentric.net>

Hi!

I have a question on web development.

I would like to create a dynamic survey on the web that is the result of
one or more queries (dynamic in that the number of questions is depended
upon the selection criteria made by the user).

This survey would display the questions on a single form and return
numeric and comment data entered by the user for each question.  The
data will then go to a database table.

My question is:  Is this possible?  If so what languages/methods do I
need to look at to make it so?  Right now I plan on using SQLServer 6.5
for the database.

I've already built an Access 7.0 prototype to test the database design
but I'm not sure if I can build the surveys and collect the data on the
web for the implementation.

Any help would be appreciated.

Thanks
Terry


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

Date: 10 Feb 1997 16:37:40 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Dynamic Wed Critique Project
Message-Id: <5dnisk$128@fridge-nf0.shore.net>

TREX (TERRANCESMITH@www.concentric.net) wrote:

: I have a question on web development.
                       ^^^^^^^^^^^^^^^
perl != web.

Although the answers to your questions are "yes," you should post CGI
related material to comp.infosystems.www.authoring.cgi, where many
database/implementation issues you've brought up have been discussed.

--
Nathan V. Patwardhan
nvp@shore.net
"[news:alt.fan.jwz]"


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

Date: Mon, 10 Feb 1997 11:21:47 -0500
From: Darren Crane <dcrane@ivs.piedmont.net>
Subject: Flow control question
Message-Id: <32FF4B1B.9C7717F@ivs.piedmont.net>

Hello perl gurus,
 Here is the problem.  I have a "server" program which comminucates 
with the "client" perl script via sockets.  The client perl script tells
the server what to do.  The server tells the client when there is 
input from a "user".
What I want to have is something like this...

on_input goto process_input
loop
  do something
  do something else
  do another
  do whatever
end_loop

process_input:
  do input processing


 I know it's not perl code, hell it's not pretty either, but I think 
you can understand what I'm looking for from this snippit.  I want to
be able to set some flag (via a socket connection) that signals input
is ready to be processed.  Then I want the perl script to leap out
of the "do somethings" loop to the process_input section, where after
processing input, normal flow control will do just fine.  It's the 
"leap on signal" statement I really need.  

	Any ideas?
	-Darren Crane
	 dcrane@ivs.piedmont.net


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

Date: 10 Feb 1997 17:23:51 GMT
From: dave@fast.thomases.com (Dave Thomas)
Subject: Re: Flow control question
Message-Id: <slrn5fum7t.2dh.dave@fast.thomases.com>

On Mon, 10 Feb 1997 11:21:47 -0500, Darren Crane <dcrane@ivs.piedmont.net> wrote:
> Hello perl gurus,
>  Here is the problem.  I have a "server" program which comminucates 
> with the "client" perl script via sockets.  The client perl script tells
> the server what to do.  The server tells the client when there is 
> input from a "user".
> What I want to have is something like this...
> 
> on_input goto process_input
> loop
>   do something
>   do something else
>   do another
>   do whatever
> end_loop
> 
> process_input:
>   do input processing

Well, there are a couple of options and some problems....

The problem is to do with global state. What are the semantic of the 'leap
out of normal processing to handle the message'? Can this affect global
state (variables, file pointers etc). If so, how do you synchronize the leap
with the regular processing's use of this state.

Stupid example:

    processing does:
    
        $a = $a + $b;
	
    message handler does:
    
       $a++;
       
Depending on where the event triggers the handler, you could lose one or the
other of the changes to $a.

So, you probably don't want totally asynchonous execution of the
notification procedure.

A better approach is to serialize the test. I can see two approaches here:

1. Use the 'select' statement to check for the availability of input. Test
it as many times as needed through the loop.

2. Run a sub-process that reads the input and have it signal the parent when
input becomes available. The signal handle sets a global variable to say
input is reader, which gets polled at various points around the loop. Then
the server can just read the sub-processes stdout to get the user input.

I'd go with (1).

Dave


-- 

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


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

Date: Mon, 10 Feb 1997 10:49:28 -0600
From: Augusto Roman <aroman@nmsu.edu>
Subject: Hashs, associative arrays, and structures
Message-Id: <32FF5198.41C6@nmsu.edu>

Hello! :)

Basically, what I want to do is have a variable similar to a structure
in C and find the number of elements in it.

I am a fairly experienced C programmer that has recently been trying to
learn Perl.  So far, everything has been fairly straightforward.
However, I am having trouble understanding hases and associative
arrays.  I've read the reference manual perldays, but that doesn't make
very much sense to me.  I've checked the FAQ for a better explanation,
but couldn't find one.

For example, I'd like to be able to represent the following psuedo-C
structure in perl:

struct
{
   scalar x,y,z;
	
   struct
   {
      scalar a,b,c;
   } data[];

} foo[];

Such that I'd access it as:

foo[0].x = "Hi";
foo[1].y = foo[2].z = "Yo";

foo[7].data[0].a = "Something";
foo[5].data[5].c = 123;

I've tried the following code, which seems to work, but I don't know how
good of an approach it is, as I can't figure out how to add to the
arrays:

$foo[0]{a} = "Hi";
$foo[1]{y} = foo[2]{z} = "Yo";

$foo[7]{data}[0]{a} = Something;
$foo[5]{data}[5]{c} = 123;


As far as I can tell, this works fine.  However, with normal arrays I
can build them one element at a time simply by assigning the next
element something:

@myarray[@myarray+0] = "New Value";

Is there any way to do this with hashes?  I've tried stuff like:

$elements = @cInfo;

Which works fine for the overall structure elements, but I can't figure
out how to find the number of elements of the internal array.

Thanks,  =)
- Augusto!


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

Date: 10 Feb 1997 18:02:48 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Hashs, associative arrays, and structures
Message-Id: <5dnns8$5bn@news-central.tiac.net>

In article <32FF5198.41C6@nmsu.edu>, Augusto Roman  <aroman@nmsu.edu> wrote:

>Basically, what I want to do is have a variable similar to a structure
>in C and find the number of elements in it.

You might want to have a peek at the perldsc (perl data structures cook
book) manual page.

>For example, I'd like to be able to represent the following psuedo-C
>structure in perl:
>
>struct
>{
>   scalar x,y,z;
>	
>   struct
>   {
>      scalar a,b,c;
>   } data[];
>
>} foo[];

>I've tried the following code, which seems to work, but I don't know how
>good of an approach it is, as I can't figure out how to add to the
>arrays:
>
>$foo[0]{a} = "Hi";
>$foo[1]{y} = foo[2]{z} = "Yo";
>
>$foo[7]{data}[0]{a} = Something;
>$foo[5]{data}[5]{c} = 123;

>Which works fine for the overall structure elements, but I can't figure
>out how to find the number of elements of the internal array.

Recent versions of the debugger are quite helpful in letting you examine
the contents of a structure quite easily.  Try this and see if it makes
sense once you've read the perldsc and perlref manual pages:

$ perl -de 1
Stack dump during die enabled outside of evals.

Loading DB routines from perl5db.pl patch level 0.9904
Emacs support available.

Enter h or `h h' for help.

main::(-e:1):   1
  DB<1> $foo[0]{a} = "Hi"; $foo[1]{y} = $foo[2]{z} = "Yo";

  DB<2> $foo[7]{data}[0]{a} = 'Something'; $foo[5]{data}[5]{c} = 123;

  DB<3> X foo
@foo = (
   0  HASH(0x1401c7aa8)
      'a' => 'Hi'
   1  HASH(0x1401c7b08)
      'y' => 'Yo'
   2  HASH(0x1401c7ad8)
      'z' => 'Yo'
   3  undef
   4  undef
   5  HASH(0x1401c58e8)
      'data' => ARRAY(0x1401c5908)
         0  undef
         1  undef
         2  undef
         3  undef
         4  undef
         5  HASH(0x1401c5928)
            'c' => 123
   6  undef
   7  HASH(0x1401c5878)
      'data' => ARRAY(0x1401c5898)
         0  HASH(0x1401c58b8)
            'a' => 'Something'
)
  DB<4> print scalar @{$foo[5]{data}}
6
  DB<5> push @{$foo[5]{data}}, {'a' => 123, 'b' => 456, 'c' => 'hello'}

  DB<6> x $foo[5]
0  HASH(0x1401c58e8)
   'data' => ARRAY(0x1401c5908)
      0  undef
      1  undef
      2  undef
      3  undef
      4  undef
      5  HASH(0x1401c5928)
         'c' => 123
      6  HASH(0x140033478)
         'a' => 123
         'b' => 456
         'c' => 'hello'
  DB<7>

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: Mon, 10 Feb 1997 16:52:55 GMT
From: gerlach@netcom.com (Matthew H. Gerlach)
Subject: Re: Help!read/write telnet process from perl
Message-Id: <gerlachE5EC87.H9x@netcom.com>


Hi, 

Your first proplem is that you are opening a one-way pipe.  As implemented,
you would only be able to read from the telnet program.  Get Comm.pl
from your favorite CPAN site.  It has examples of "talking" to the telnet
program.

Matthew

>open(TELNET,"|/usr/bin/telnet addresstohost");
>open (LOG,">>bib.log");
>while (<TELNET>){
>	print LOG;
>	if (/Username:/){
>		print TELNET "guest\n";
>		print LOG "guest\n";
>	}
>	
>}




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

Date: Mon, 10 Feb 1997 11:23:19 -0600
From: cejones@huckel.cm.utexas.edu (Chris E. Jones)
Subject: HELP: variable interpretation??
Message-Id: <cejones-1002971123190001@newshost.cc.utexas.edu>



First,  I have defined $water as a normal variable.

I have a second variable, $unknown  that is set to the text name   water


I want to use $unknown to get the value in the $water variable.

Obviously print "$$unknown"; will not work since $$ is the special
variable for giving the process number of the Perl running my script.

Can anyone point me in the right direction?  I've searched my O'Reilly
books, but haven't ferreted out the answer...


TIA, 

Chris Jones
UT Austin


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

Date: 10 Feb 1997 19:16:45 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: HELP: variable interpretation??
Message-Id: <5dns6t$an5@news-central.tiac.net>

In article <cejones-1002971123190001@newshost.cc.utexas.edu>,
Chris E. Jones <cejones@huckel.cm.utexas.edu> wrote:
>
>
>First,  I have defined $water as a normal variable.
>
>I have a second variable, $unknown  that is set to the text name   water
>
>
>I want to use $unknown to get the value in the $water variable.
>
>Obviously print "$$unknown"; will not work since $$ is the special
>variable for giving the process number of the Perl running my script.
>
>Can anyone point me in the right direction?  I've searched my O'Reilly
>books, but haven't ferreted out the answer...

Try it!  Running the debugger using

  perl -de 1

  DB<1> $unknown = 'water'

  DB<2> $water = 'wet'

  DB<3> print $$unknown
wet

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: Mon, 10 Feb 1997 11:35:51 -0600
From: John Putnam <jputnam@nwu.edu>
Subject: Hierarchical Directory Tree
Message-Id: <32FF5C77.16CE@nwu.edu>

Does anyone have or know how to use perl to create a text file of 
directory levels indented in a tree structure. This would very useful
for documenting Web site sub trees.

                          Thanks in advance   

                          John Putnam  jputnam@nwu.edu


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

Date: 10 Feb 1997 18:24:21 GMT
From: schip@lmsc.lockheed.com (Jan Schipmolder)
Subject: Re: Hierarchical Directory Tree
Message-Id: <5dnp4l$7aj@butch.lmsc.lockheed.com>

John Putnam (jputnam@nwu.edu) wrote:
: Does anyone have or know how to use perl to create a text file of 
: directory levels indented in a tree structure. This would very useful

Here is one I use
-----cuthere-----
#!/usr/local/bin/perl

require 'getopts.pl';
&Getopts ( 'h' ) || ( &usage, exit ) ;

&usage, exit if $opt_h;

$|++;
$SIG{'INT'} = 'sighandler';

$NAME = "dirtree";
$INDENT = '>' . ' ' x 4;

$path = shift;
$path = '.' if !$path;

&error ( "main: no such file or directory: $path" ) unless -e $path;
&error ( "main: no r priv: $path" ) unless -r $path;
&error ( "main: no x priv: $path" ) unless -x $path;

chdir ( $path ) || &error ( "main: cannot chdir $path" );

print "$indent$path\n";

&visit ( $indent );


sub error {
   local ( $txt ) = @_;
   print STDERR "$NAME: $txt\n";
   exit;
}


sub sighandler {
   local ( $sig ) = @_;
   print "SIG$sig\n";
   exit;
}

sub usage {
   print <DATA>;
}

sub visit {
   local ( $indent ) = @_;
   local ( *HANDLE, $dev, $file, $ino, $link, $mode, $nlink, );

   ( $dev, $ino, $mode, $nlink ) = stat ( '.' );

   return if $nlink == 2;

   $indent .= $INDENT;

   opendir ( HANDLE, '.' ) || &error ( "visit: cannot opendir HANDLE" );

   File: while ( $file = readdir ( HANDLE ) ) {
      next File if $file eq '.';
      next File if $file eq '..';
      next File unless -d $file;
      if ( -l $file ) {
         $link = readlink($file);
         print ( "$indent$file -> $link\n" );
         next File;
      }
      print ( "$indent$file (cannot read)\n" ), next File unless -r $file;
      print ( "$indent$file (cannot cd)\n" ), next File unless -x $file;
      print "$indent$file\n";
      chdir ( $file ) || &error ( "visit: cannot chdir $file" );
      &visit ( $indent );
      chdir '..';
   }

   closedir ( HANDLE );

}


__END__

Name:

   dirtree

Purpose:
   visualize the directory structure of the specified directory

Usage:
   dirtree [ -h ] [ directory ]

Options:
   -h     -- shows this help, then quits (does not execute)

Examples:

   dirtree
      Shows the name of the current directory (which happens to be
      '.'), and then shows, by the use of indentation, the directory
      structure of the entire subdirectory tree rooted at '.'.

   dirtree /home/maw
      Similar to the previous example, but first does an internal cd
      to /home/maw.

   dirtree ..
      Same, but does if for, you guessed it, your parent directory.

Notes

1. The method used in this script is not the fastest, but satisfies in
   that the display begins almost immediately, as opposed to methods
   that first must read all the files in the current or specified
   directory. 

2. Sorry, as a consequence the listing is not in alphabetical order.

--
jan.b.schipmolder@lmco.com
-----cuthere-----


--
jan.b.schipmolder@lmco.com


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

Date: Mon, 10 Feb 1997 12:31:19 -0600
From: luis@ged.com
To: luis@ged.com
Subject: how to change of a given string?
Message-Id: <855597832.14972@dejanews.com>

Hi:
	I need to change the Case of a string that a client inputs for
instance ibm would be IBM, apple would be Apple.  The string is obtained
from the login that permits the user to enter the page.  (Its a cgi perl
page)
	Thanks
	Its on an Netscape Srever. SGI Running Irix 5.3


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


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

Date: 10 Feb 1997 17:18:53 GMT
From: bdwheele@indiana.edu (Brian Wheeler)
Subject: Re: Loops in perl
Message-Id: <5dnl9t$okb@dismay.ucs.indiana.edu>

In article <5dnf43$ktv$1@ftp.ampersand.com>,
	jason@ampersand.com (Jason Brazile) writes:
>In article <5dj1ls$1p4$1@newshound.csrv.uidaho.edu>,
>Thomas Patrick Bailey <baile934@harrier.csrv.uidaho.edu> wrote:
>> I am fairly new to perl, but I have been doing ok in it.  What I need to
>> know is how to do a simple loop.  
>>
>> A simple example would be very helpful.
>
>No problem. Loops are pretty simple in perl:

	Oh, for the love of God, are you a scheme programmer?  :)

	seems alot easier to do:

	#!/usr/bin/perl
	for($i=1;$i<6;$i++) {
		print "hello, world\n";
	}

	than to do 

>
>	#!/usr/bin/perl
>
>	use strict;
>
>	sub simple_loop
>	{
>		my ($lcv, $code) = @_;
>
>		($lcv) && (&$code, &simple_loop($lcv - 1, $code));
>	}
>	sub main
>	{
>		#
>	 	# print "hello, world\n" 5 times
>		#
>		&simple_loop(5, sub {print "hello, world\n"});
>	}
>
>	&main;
>
>---
>Jason Brazile
>Ampersand, Inc
>Billerica, MA

-- 
Brian Wheeler
bdwheele@indiana.edu


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

Date: 10 Feb 1997 13:11:04 GMT
From: vbwalker@us.oracle.com (Victor Walker)
Subject: OraPerl for Perl4 on Alpha running Oracle 7.3 ???
Message-Id: <5dn6p8$org@inet-nntp-gw-1.us.oracle.com>

I need advice about how to attach Perl to Oracle. I have been away from Perl 
for awhile - so my first thought was to use Perl4. I have had problems linking 
the distribution OraPerl Makefile.

It seems from reading this news group, that Perl5 and DBI may be the way to go.

Can anyone point me to the pieces I need to get up-and-running???  Thanks.



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

Date: Tue, 04 Feb 1997 11:54:01 -0500
From: fl_aggie@hotmail.com (I R A Aggie)
Subject: Re: Perl 5.003 causes segmentation fault on SGI Irix
Message-Id: <fl_aggie-ya023180000402971154010001@news.fsu.edu>

In article <32F7308A.1B79@alexr.com>, jeff@alexr.com wrote:

+ dumping core. The strange thing about it is that sometimes they run
+ fine, and sometimes they crash. There doesn't seem to be any rhyme or
+ reason to it. Anyone have any thoughts?

Check your SYSLOG to see if perl is running out of memory.

There is also a pre-compiled version of perl in SGI "inst" format.
The only drawback there is that it is perl v5.002. :\

James

-- 
Consulting Minster for Consultants, DNRC

To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>


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

Date: 10 Feb 1997 17:13:45 GMT
From: pnataraj@emerald.tufts.edu (Premkumar Natarajan)
Subject: Question about using "system" command
Message-Id: <5dnl09$8lg@d2.tufts.edu>

Hi -
	I am trying to use the system command to run awk from a perl
script as follows

@args = ("awk","\'{print \$1;}\'",$filename,">",$another_filename);
system(@args);

I keep getting an error message that says,

awk:syntax error near line 1

What am I doing wrong?

Thanks
Prem

PS :: Email appreciated but will check newsgroup often.


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

Date: 10 Feb 1997 15:43:22 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Review date notifier
Message-Id: <5dnfmq$qjg@fridge-nf0.shore.net>

Drew Firment (firment@mitchell.hitc.com) wrote:
: I am new to the world of PERL, but know enough to come here for help. 
: For ISO compliance, I need a script that will check the dates on a set
: of documents and send an email notification to an individual stating
: which documents are 11 months old.   

If I've read your question correctly, RTFM about stat().  See:
http://www.perl.com/perl, and follow the links to the Perl documentation.

HTH!

--
Nathan V. Patwardhan
nvp@shore.net
"[news:alt.fan.jwz]"


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

Date: Mon, 10 Feb 1997 10:08:14 -0800
From: Meena <meena@gwcom.com>
Subject: SIGCHLD and process ID
Message-Id: <32FF640E.4F3D@gwcom.com>

Hi,
	I am new to perl. I am trying to write a watchdog monitor
script in perl. This is supposed to run few processes after forking
them.

	Now whenever a child dies, the parent process try to bringup
the child process back. The skeleton of my program is given below.

	The problem in this script is, when I get the SIGCHLD, my
signal handler doesn't know from which child process the signal
was generated.

	Is there a way for the parent process's signal handler
to know which child process died? so that it can bringup the
right process.

Any help on this is greatly appreciated....

Thanks,
Meena

--------------------------------------------------------------------
Meena Gunasekaran
meena@gwcom.com
--------------------------------------------------------------------

#!/usr/local/bin/perl


$SIG{'CHLD'} = 'sighandler';
&bringup("child1");
&bringup("child2");

while (1) {
	print "Parent\n";
	sleep 4;
}

sub bringup {
	local($proc) = @_;

	if ($pid = fork) {
		print "Parent: the CHILD $proc, $pid\n";
		$SIG{'CHLD'} =  'sighandler';
	} 
	else {
		if ($proc eq "child1") {
			exec "/release/child1";
		} 
		elsif ($proc eq "child2") {
			exec "/release/child2";
		}
	}
}


sub sighandler {
	local($sig) = @_;

	$SIG{'CHLD'} = 'IGNORE';
	print "Caught signal $sig from <$proc>\n";
	&bringup($proc);
	print "Brought up child\n";
}


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

Date: 10 Feb 1997 19:30:21 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: SIGCHLD and process ID
Message-Id: <5dnt0d$bpl@news-central.tiac.net>

In article <32FF640E.4F3D@gwcom.com>, Meena  <meena@gwcom.com> wrote:
>Hi,
>	I am new to perl. I am trying to write a watchdog monitor
>script in perl. This is supposed to run few processes after forking
>them.
>
>	Now whenever a child dies, the parent process try to bringup
>the child process back. The skeleton of my program is given below.
>
>	The problem in this script is, when I get the SIGCHLD, my
>signal handler doesn't know from which child process the signal
>was generated.
>
>	Is there a way for the parent process's signal handler
>to know which child process died? so that it can bringup the
>right process.
>
>Any help on this is greatly appreciated....

You can stash the process id of the child process for each child in a data
structure, and then use one of the wait family of calls in your signal
handler to tell which process ID died on you.  In the signal handler you
shouldn't do much more than toggle a flag and let the main code discover
which process died.  If you have recorded which PIDs map to which program,
and have flagged whether a particular process ID has died then you can
tell which program to fire off again.

Hope this helps (even if it is a little rushed...),

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: 10 Feb 1997 15:33:09 GMT
From: "Geoff Mottram" <minaret@sprynet.com>
Subject: Re: SIGPIPE in server script - where's the pipe?
Message-Id: <01bc1767$548f9ea0$a8dcaec7@cactus>

> I wrote a server in Perl that appears to intermitently fail with 
> a SIGPIPE.  Sometimes it fails after 100+ successful transactions 
> and sometimes after as few as 4.  I don't explicitly set up a pipe 
> in the script or when I run it.  So where's the pipe that is failing?
> If I provide a handler for the SIGPIPE, what does it need to do?
> How can I get a handle :) on this problem?

I believe that the SIGPIPE signal is sent to a process that is either
reading from or writing to a socket that looses it's other end.  So a
server who's child disconnects prematurely or vice versa.  Your SIGPIPE
handler could set a global variable to let your higher level code that the
connection went down.  The handler should also re-instate the handler on
the SIGPIPE signal.

-- 
Geoff Mottram
minaret@sprynet.com


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

Date: Mon, 10 Feb 1997 16:24:08 GMT
From: Stijn van Dongen <stijnvd@cwi.nl>
Subject: transliteration library
Message-Id: <32FF4BA8.41C6@cwi.nl>

Hi,

        Recently I have written a perl 5 library, which for example
 allows one to search for different transliterations corresponding with
 the same source string.
 ______________________________________________
 There is no interface, only some documentation. If you want to
experiment
 with it, you have to invest time and *know perl 5*. If you want to have
 very specific tools, you have to build them yourself. However, the
 basic parsing tools (and more) have all been written.

 In principle one can define both the source alphabet and the target
 alphabet to be any collections of strings. For each source morpheme
 and for each transliteration system, one or several rewrite rules
mapping
 the source morpheme to a target morpheme may be defined. A rewrite rule
 is labeled with the system or systems from which it is derived.
 Example for cyrillic-latin transliteration:


# 27 character:

        ':s' => {       Eng => { 1 => 'shch'},
                        Fr  => { 1 => 'chtch'},
                        Ger => { 1 => 'schtsch'},
                        Hol => { 1 => 'sjtsj'},
        }

# 6 character:

        e =>    {       Eng => { 1 => 'e', 2 => 'ye' },
                        Fr  => { 1 => 'e',},
                        Ger => { 1 => 'je', 2 => 'e' },
                        Hol => { 1 => 'je', 2 => 'e', 3 => 'jo' },
        }

# suffix:

        'i-n-$' => {    Sufx  => { 1 => 'ine', 2 => 'ien'}
        },

 When supplied with a list of source strings in source notation
 and a list of target strings, it is possible to search for relations:

[l-o-b-a-x-;e-v-s-k-i-j]                # source string
        [l|o|b|a|x|;e|v|s|k|i-j-$]      # source parse
                [Lobachevski]           # target string, parse omitted
here.
                [Lobachevsky]
        [l|o|b|a|x|;e|v|s|k|i|j]
                [Lobachevskii]
                [Lobachevskij]
[x-i-n-;c-i-n]
        [x|i|n|;c|i-n-$]
                [Chintchine]
                [Khinchine]
                [Khintchine]
        [x|i|n|;c|i|n]
                [Chin\v{c}in]
                [Chintchin]
                [Chintschin]
                [Hin\v{c}in]
                [Hincin]
                [Khinchin]
                [Khintchin]

 It is also possible to list the language scores with a given
source-target
 pair, based on weights associated with the source morphemes which have
to be
 supplied by the user:
        chebyshev
                Eng     9
                Fr      3
                Hol     3
                Ger     1
        tchebycheff
                Fr      9
                Eng     1
                Ger     1
                Hol     1
        tschebyschef
                Ger     7
                Spell   2
                Eng     1
                Fr      1
                Hol     1
        tchebyshev
                Eng     6
                Fr      6
                Hol     3
                Ger     1
        tschebychef
                Fr      4
                Ger     4
                Spell   2
                Eng     1
                Hol     1


 If you are interested, you can follow up on this (but do not
 cross-post), mail me at stijnvd@cwi.nl, or grab a tarred bundle of
 files from http://www.cwi.nl/ftp/stijnvd/, file TRANSLITERATION.tar.uu


        Kind regards,

                Stijn van Dongen


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

Date: 10 Feb 1997 15:39:11 GMT
From: "Geoff Mottram" <minaret@sprynet.com>
Subject: Re: Using sockets to connect to daemon - code wanted.
Message-Id: <01bc1768$2cddc3e0$a8dcaec7@cactus>

> I am having a little difficulty... rather, I am completely clueless
> about how to write a perl script for bi-directional communication over a
> socket. I realise this is elementary for most of you, but does anyone
> have/know where I can find some sample code (the socket clients in CPAN
> are read-only)...

I do it all the time but I don't have any code on this machine to send you.
 You just read and write on the socket's file handle as if it was any other
kind of device (file, serial port, etc).  You probably have to make sure
that both ends open the socket in read + write mode.

-- 
Geoff Mottram
minaret@sprynet.com


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

Date: 10 Feb 1997 19:05:37 GMT
From: "Trond Ruud" <troruud@online.no>
Subject: Win32/NT problems with ARGVand .pl association
Message-Id: <01bc1786$607f6730$43e17a94@nesodden>

Hi Perl experts,
Im an old C and Unix programmer who has just installed Perl5 under WinNT
4.0
on my Intel PC, and I am intrigued by the very close similarities between
Perl
and C. However I'm having some problems with running my Perl scripts.

First, my connecting the .pl extension to perl exe only results in
NT opening a DOS window for a fraction of a second on doubleclicking the
pl
script in an NT window.So I have to manually open a DOS window and 
run the script by explicitly starting Perl, i.e
as: $perl script.pl, which destroys most of the fun!

second, Perl doesn't detect my command line arguments. i.e.:argv is always
empty. I suspect that this problem's connected to my way of explicitly
running perl, (as described above.)
Any advice will be highly appreciated!
regards
Trond Ruud troruud@online


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

Date: 10 Feb 1997 15:45:04 GMT
From: "Geoff Mottram" <minaret@sprynet.com>
Subject: Re: XS problem - Can't find loadable object
Message-Id: <01bc1768$fefa85c0$a8dcaec7@cactus>

> I am experimenting with the XS tutorial (xstut).  Following alone with
> example one, I run across an error when I try to execute the script - it
> complains about not being able find a loadable object.

I recall that when I ran through the tutorial the same thing happened to
me.  I may have had to fiddle with the @INC array in order for the ".pm"
perl module to be found and I maybe also some sort of PERLLIB variable or
some thing like that for it to find the ".so" library with the object
module.  One thing is for sure, the tutorial did not work as documented.

-- 
Geoff Mottram
minaret@sprynet.com


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

Date: Mon, 10 Feb 1997 19:05:15 GMT
From: Tim Pierce <twpierce+usenet@mail.bsd.uchicago.edu>
Subject: Re: You were there:1981 (Was: Using exec-Why won't this work?)
Message-Id: <E5EICr.MF0@midway.uchicago.edu>

In article <annoying-ya02408000R0802972312590001@snews.zippo.com>,
annoying@ <clip-this-out-if-replying> wrote:

>*real* hackers reminisce about ARPAnet... :-)

Real hackers don't say things like `<clip-this-out-if-replying>'.
Bluh.

-- 
Support the Hawaii Equal Rights Marriage Project: call 1-900-97-MARRY ($5/call)


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

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

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