[7311] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 936 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 28 04:07:21 1997

Date: Thu, 28 Aug 97 01:00:37 -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           Thu, 28 Aug 1997     Volume: 8 Number: 936

Today's topics:
     Re: ($p=$pc) =~ s/\.[0-9]*/substr($1,3,length($1))=""/g (Tad McClellan)
     Re: [Q] Awk's "s in A" Hash Test In Perl? <monty@primenet.com>
     Re: A Complex Regex Needed (John S. Anderson)
     Re: basic question <rael@zx81.dnai.com>
     Re: CGI timing out problem <rael@zx81.dnai.com>
     Re: CGI,perl,NT <petri.backstrom@icl.fi>
     Re: Check if a URL exists <petri.backstrom@icl.fi>
     Compiling Perl <amerar@unsu.com>
     Convert to hex (Dave Schenet)
     Re: extracting a pattern... (Tad McClellan)
     Find case conversion script for filenames (Morris M M Law)
     Re: Help whit Serial I/O on PERL <jim@buttafuoco.mv.com>
     Re: How do I break up a line (Marjorie Roswell)
     Re: How to treat "\n" as "\n" ? (dave)
     Re: How to treat "\n" as "\n" ? (Petr Prikryl)
     Re: Is there a perl IDE? (Michael W Peterson)
     Re: last line of a @list... <petri.backstrom@icl.fi>
     Re: Perl and document conversion to HTML <rpsavage@ozemail.com.au>
     Perl FileHandles <mcgrattm@cts.com>
     Re: Q: IPC between Perl and C (dave)
     Re: RegExp Win95/NT4.0 ? <petri.backstrom@icl.fi>
     Shortest Path Algorithm <msbritt@ren.us.itd.umich.edu>
     Re: Some Assistance Please... <tom@mitra.phys.uit.no>
     Re: timeout for getc function (Josh Purinton)
     Re: Which version of PERL is running on the server? <scaldow@metronet.de>
     Which Windows (95) Perl to use? <mjg@oms.com>
     Re: win95 perl/cgi ng - roblem <mturk@globalserve.net>
     Re: win95 perl/cgi ng - roblem (Mike King)
     Re: www.perl.com ? (Michael Fuhr)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Wed, 27 Aug 1997 23:02:12 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: ($p=$pc) =~ s/\.[0-9]*/substr($1,3,length($1))=""/g;
Message-Id: <48t2u5.fm8.ln@localhost>

Raymond K. Bush (rbush@btc4.up.net) wrote:
: i would like to do something like this to a list of random numbers and
: letters of random sizes i have read in from a file.  

: each line has a form like: 

: sdfsd 32423.3245 erye5rye eryter 234.234311111666  12314.3543254322222
: 4456.111111111 4545.345345 dftgdfgdf.345rfwdcf34 234.dgfg 234 345 1.00

: what i really wish i could do is something like:

: ($p=$pc) =~ s/\.[0-9][0-9]* /substr($1,3,length($1))=""/g; 

: aka replace everything from 3rd place past the period to space while
                              ^^^ 2nd?


: recognizing on .[0-9] but not recognizing anything else

: hence my lines would become:

: sdfsd 32423.32 erye5rye eryter 234.234 12314.35
              ^^ two                 ^^^ three ^^ two

???


: Anybody know of a nonsplit-if suroutine to do this in a oneline
: statement? 


Couldn't decide whether to go for two or three.

Had to shell out and write a random number script to help me decide ;-)


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

$pc = 'sdfsd 32423.3245 erye5rye eryter 234.234311111666  12314.3543254322222 4456.111111111 4545.345345 dftgdfgdf.345rfwdcf34 234.dgfg 234 345 1.00';

print "pc '$pc'\n\n";


# one line version   ($p=$pc) =~ s/(\.\d{2})\d* /$1 /g;

($p=$pc) =~ s/(         # start remembering chars that matched
               \.       # a literal dot (period, full stop)
               \d       # a digit, ([0-9] char class)
               {2}      # two of the previous thing (two digits)
              )         # stop remembering chars that matched
              \d        # a digit
              *         # zero or more of the previous thing (digits)
              [ ]       # a hokey way to get a space in with extended regex
             /$1 /gx;   # put that remembered part back in, along with the
                        #    space. The \d* part has been deleted
print "p '$p'\n";
---------------------------


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


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

Date: 27 Aug 1997 23:31:00 -0700
From: Jim Monty <monty@primenet.com>
Subject: Re: [Q] Awk's "s in A" Hash Test In Perl?
Message-Id: <5u35v4$edg@nntp02.primenet.com>

Tom Phoenix <rootbeer@teleport.com> wrote:
> On 27 Aug 1997, Tom Grydeland wrote:
>
> > Tom Phoenix <rootbeer@teleport.com> writes:
> >
> > > On Wed, 27 Aug 1997, Eric Bohlman wrote:
> > > > TMTOWTDI, but "defined($words{$name})" should do it.
> >
> > > I prefer exists to defined, in this case. Hope this helps!
> >
> > Perhaps a2p should be doctored to use exists over defined for this?
>
> It doesn't? Maybe you're right... But I don't know awk, so I can't say
> whether that's an accurate 'translation'. (That is, it may be that the awk
> construct does the equivalent of defined(), so Perl should do the same.)

Perl's 'exists' function is the exact equivalent of awk's 'subscript in
array' expression. It tests the existence of a hash key in a hash (i.e.,
a subscript in an associative array).

The camel book is unambiguous on this point:

     [The function 'exists'] returns true if the specified hash key exists
     in its hash, even if the corresponding value is undefined. [Page 164.]

     When used on a hash element [...], 'defined' only tells you whether
     the value is defined, not whether the key has an entry in the hash
     table. It's possible to have an undefined scalar value for an existing
     hash key. Use 'exists' to determine whether the hash key exists.
     [Page 155.]

So the correct translation of the awk statement

    secretword = name in words ? words[name] : "groucho"

into Perl is

    $secretword = exists $words{$name} ? $words{$name} : "groucho";

not

    $secretword = defined $words{$name} ? $words{$name} : 'groucho';

(which is precisely what a2p does).

-- 
Jim Monty
monty@primenet.com
Tempe, Arizona USA


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

Date: Thu, 28 Aug 1997 06:25:51 GMT
From: jandj@alink.net (John S. Anderson)
Subject: Re: A Complex Regex Needed
Message-Id: <5u35gi$ke@ns2.alink.net>

Hi,
As long as the input file contain only four columns, the following regexp 
should work:
        input line is: Big<tab>Tom Hanks<tab>Penny Marshall<tab>Comedy
then,

        /^Big<tab>[^<tab>]*<tab>Penny/

where "<tab>" is an actual tab will match the input line.

I'm reading this from windows, so not able to test but should work.
Best,
John

In article <34030FDC.AB559968@mail.patterndom.com>, Christopher Stetson 
<mentat@mail.patterndom.com> wrote:
>Hi All,
>
>I am trying to write a match-oriented regex that is taking a tab
>delimited set of fields as the target operand and trying to match it
>with a regex that is looking at various fields for a matchs.
>
>E.G.:
>
>Fields   | Movie Name    Actor Name    Director Name     Category
>Record 1 | Big        \t Tom Hanks  \t Penny Marshall \t Comedy
>
>The regex needs to look for "Big" and "Penny" in the exact fields and no
>others and the regex should do it in one fell swoop (no splitting).
>
>Chris
>


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

Date: 27 Aug 1997 22:15:32 -0700
From: Rael Dornfest <rael@zx81.dnai.com>
Subject: Re: basic question
Message-Id: <87g1ruanwr.fsf@zx81.dnai.com>


Liviu Chiriac <lchiriac@sarnoff.com> writes:

> I have a cgi program written in perl, to which I pass parameters when
> calling it from an HTML page like this:
>
> "myprogram.cgi?parameter1=1+parameter2=2" ... for example.
> 
> how do I run the perl script from a terminal window passing the same
> parameters?

Check out the CGI.pm module...

"If you are running the script from the command line or in the perl
debugger, you can pass the script a list of keywords or
parameter=value pairs on the command line or from standard input (you
don't have to worry about tricking your script into reading from
environment variables)."

Find it at a CPAN mirror near you (http://www.perl.com/CPAN) or point
your Web-browser at:

http://www.genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.html

For specific info on command-line debugging, see:

http://www.genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.html#debugging

Rael

---------------------------------------------------------------------------
/Rael Dornfest/                                     <title>Webmaven</title>
                              %company = (DNAI => 'Direct Network Access');
print <<ADDRESS;
2039 Shattuck Avenue, Suite 206                           To: rael@dnai.com
Berkeley, CA 94704                                 atdt 888 321 3624 (DNAI)
ADDRESS                           <a href="http://www.dnai.com">Website</a>





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

Date: 27 Aug 1997 22:24:12 -0700
From: Rael Dornfest <rael@zx81.dnai.com>
Subject: Re: CGI timing out problem
Message-Id: <87d8myanib.fsf@zx81.dnai.com>


> Start the script name with 'nph-' (like 'nph-foo.cgi').

The CGI.pm module deals with this nicely.

See http://www.genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.html

Rael

---------------------------------------------------------------------------
/Rael Dornfest/                                     <title>Webmaven</title>
                              %company = (DNAI => 'Direct Network Access');
print <<ADDRESS;
2039 Shattuck Avenue, Suite 206                           To: rael@dnai.com
Berkeley, CA 94704                                 atdt 888 321 3624 (DNAI)
ADDRESS                           <a href="http://www.dnai.com">Website</a>





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

Date: Thu, 28 Aug 1997 09:26:38 +0300
From: Petri Backstrom <petri.backstrom@icl.fi>
Subject: Re: CGI,perl,NT
Message-Id: <34051A1E.354@icl.fi>

Jeszs M* Fuentes wrote:
> 
> We are trying to run and httpd program in winNT. We have some problems
> with CGIs.  We have several .pl files, and when we do:   <name>.pl  in
> the ms-dos prompt the program runs but when we open the .pl file in the
> netscape, we read:" HTTP/1.0 404 Objeto no encontrado"
> 
> Do you know why ?

Yes, I know why: You haven't configured your web server properly.
In other words, yours isn't a Perl problem at all, but a web
server/operating system installation & configuration issue.

Start with

  http://www.endcontsw.com/people/evangelo/Perl_for_Win32_FAQ.html

and see the FAQ titled "How do I configure Netscape Web servers to 
support Perl for Win32?" for starters, and Netscape docs about CGI
for more.

regards,
 ...petri.backstrom@icl.fi
    ICL Data Oy
    Finland


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

Date: Thu, 28 Aug 1997 09:27:49 +0300
From: Petri Backstrom <petri.backstrom@icl.fi>
Subject: Re: Check if a URL exists
Message-Id: <34051A65.4B89@icl.fi>

RCI Federation wrote:
> 
> Does any one know if a Perl script which would check whether a URL exists
> or not is available ?
> 
> I do want to program it myself because a lack of time.
> I wonder if someone has not already done this.

Start by looking at the LWP (libwww) modules on CPAN

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

regards,
 ...petri.backstrom@icl.fi
    ICL Data Oy
    Finland


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

Date: Tue, 26 Aug 1997 21:56:28 -0500
From: Arthur Merar <amerar@unsu.com>
Subject: Compiling Perl
Message-Id: <3403975C.10DE@unsu.com>

Interesting thing.  Perl is supposed to have an interpeter right?  here
is my situation:

I modify my perl script.  When I try and run it, I get an error that
says: 'Text File busy'.  The file it points to is the script.  Now, if I
compile that, (perl -c trivia.pl), then the thing runs fine......

Any ideas???

-- 

Thanks,

Arthur
amerar@unsu.com
http://www.unsu.com


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

Date: 28 Aug 1997 04:05:31 GMT
From: shodan@shodan.erols.com (Dave Schenet)
Subject: Convert to hex
Message-Id: <5u2teb$2lv@winter.news.erols.com>

Hello,

I have a script that will pass some data to a CGI script, and some of the
values need to be escaped, as they might consist of !@#$%^& etc.

I looked through the FAQ, and there is a module available, however, it
appears to skip over /?&= and maybe some others, as those are "reserved"
for URLs... I need to escape ALL non alphanumeric characters.

So I figured I'd re-invent the wheel. I'm using sprintf, but getting null
returns. At first I tried:

$data = '!a@b#c';
$data =~ s/([^a-zA-Z0-9])/sprintf "%2l.x", $1/eg;

And that resulted in "  a  b  c".

Next, as a test, I tried:
sprintf "%2l.x", '!';
And that also returned two spaces!

I'd like to get a two-digit hex value of each of the characters. This is
how the camel book said to go about doing it; where am I going wrong?

Thanks.

--
+----------------------------------+-----------------------------------+
|Dave Schenet - shodan@erols.com   | Erols Internet Services, INC.     |
|Junior UNIX Developer             | Springfield, VA.                  |
+----------------------------------+-----------------------------------+


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

Date: Wed, 27 Aug 1997 22:26:55 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: extracting a pattern...
Message-Id: <v5r2u5.6i8.ln@localhost>

Dave Boutilier (boutilie@ipa.net) wrote:


: > Joe Shaw wrote:
: > >
: > > I'm wondering if anyone could help me with a problem I'm having.  I
: > need
: > > to extract an IP address from a string, 

[ snip ]

: try this:
: open FOO, "<temp.dat" || die "darn";

: while (<FOO>) {
:    if ( /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/o ) {
                                              ^
                                              ^
This has no effect of course.

You should leave it off since it isn't doing anything.


:      print "ip address:", $&, "\n";
:      }
:    }

: close FOO;

: This will match the first ip address (if any) on the line, and print
: it.  Doesn't require 3 digits to be present.  I've tested on the sample
: data you gave.

: Content-Type: text/html; charset=us-ascii
: Content-Transfer-Encoding: 7bit


[ snip 55 lines with the entire Usenet article repeated in
  some kind of markup language.

  The size of the article transported to tens of thousands of computers
  around the world was about doubled with no new information added.

  That's bad resource utilization ;-)

  Please configure your newsreader to not do that.
]


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


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

Date: 28 Aug 1997 07:05:50 GMT
From: morris@sci.hkbu.edu.hk (Morris M M Law)
Subject: Find case conversion script for filenames
Message-Id: <5u380e$8c8$1@power42t.hkbu.edu.hk>

I would like to have a perl script to automatically search my directory
and convert the filename in lower case to upper case.  Would anyone have
any pointers to ?

Thanks in advance.

Regards,


--
Morris Law
Assistant Computer Officer    Address : 224 Waterloo Road, KLN, Hong Kong
Science Faculty               Tel : (852) 23395909   Fax : (852) 23388014
Hong Kong Baptist University  WWW : http://www.sci.hkbu.edu.hk/~morris
Email : morris@sci.hkbu.edu.hk  or  morris@math.hkbu.edu.hk
=========================================================================


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

Date: Wed, 27 Aug 1997 23:38:06 GMT
From: Jim Buttafuoco <jim@buttafuoco.mv.com>
Subject: Re: Help whit Serial I/O on PERL
Message-Id: <5u2dou$md4@gateway.buttafuoco.net>


Here is a little perl "serial terminal emulator for unix"  that I wrote under linux.  Not many comments (sorry :( ).

If you make any improvements please email them back to me.

Thanks
Jim
jim@buttafuoco.mv.com


#!/usr/bin/perl -w

use strict;
use POSIX;
use FileHandle;

# use POSIX::Termios;

sub PerlMain
{
    my($bytes,$buf);
    my($timeleft);
    my($tserial,$tterm,$sterm);
    my($cflags,$oflag,$iflag,$lflag);
    my($fdserial,$fdterm);
    my($rin,$win,$ein) = (0,0,0);
    my($rout,$wout,$eout) = (0,0,0);
    my($nfound);
    my($buf) = '';
    my($x);

    
    $fdserial = POSIX::open("/dev/cua0",O_RDWR|O_NONBLOCK);
    if($fdserial < 0)
    {
	die "Error opening /dev/cua1\n";
    }

    $fdterm = POSIX::open("/dev/tty",O_RDWR);
    if($fdterm < 0)
    {
	die "Error opening /dev/cua1\n";
    }


    $tserial = new POSIX::Termios;
    $tserial->setiflag(IGNBRK | INPCK);
    $tserial->setoflag(0);
    $tserial->setcflag(CS8 | CREAD | CLOCAL | CSTOPB);
    $tserial->setlflag(0);
    $tserial->setispeed(B38400);
    $tserial->setospeed(B38400);
    $tserial->setattr($fdserial,TCSANOW);

    $tterm = new POSIX::Termios;
    $sterm = new POSIX::Termios;
    $tterm->getattr($fdterm);
    $sterm->getattr($fdterm);
    $tterm->setiflag(0);
    $tterm->setlflag(0);
    $tterm->setcc(VTIME,0);
    $tterm->setcc(VMIN,0);

    $tterm->setattr($fdterm,TCSANOW);


    while(1)
    {
	my($bytes,$buf);
	my($timeleft);
	$rin = '';
	vec($rin,$fdterm,1) = 1;
	vec($rin,$fdserial,1) = 1;

	($nfound,$timeleft) = select($rout = $rin,undef,undef, 10);

	if(vec($rout,$fdterm,1))
	{
	    $bytes = POSIX::read($fdterm,$buf,256);
	    last if $buf =~ /^~/;
	    POSIX::write($fdserial,$buf,$bytes);
	}


	if(vec($rout,$fdserial,1))
	{
	    $bytes = POSIX::read($fdserial,$buf,256);

	    if($buf)
	    {
	      POSIX::write($fdterm,$buf,$bytes);
	    }
	}

    }

    $sterm->setattr($fdterm,TCSANOW);
    exit(0);
}

PerlMain();
J. Edgar Zavala Siller <jzavala@lsi.net.mx> wrote:
: Hello,

:      Can anybody giveme an example of Serial I/O comunication in perl?
:      (linux).





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

Date: Wed, 27 Aug 1997 20:59:56 GMT
From: roswell@umbc.edu (Marjorie Roswell)
Subject: Re: How do I break up a line
Message-Id: <340493c6.6932659@news>

I noticed you left out a quote before the "H" in "Hello..."
Nevertheless, it's nice to have a little starter code, rather than
just the standard "try Text::Wrap" 

Margie

On Tue, 26 Aug 1997 15:44:57 +0100, Paul Cunnell <pcunnell@csfp.co.uk>
wrote:

>Try this (available at every CPAN site):
>
>NAME 
>
>Text::Wrap -- wrap text into a paragraph 
>
>SYNOPSIS 
>
>        use Text::Wrap;
>        
>        $Text::Wrap::columns = 20; # Default
>        print wrap("\t","",Hello, world, it's a nice day, isn't it?");
>


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

Date: Wed, 27 Aug 1997 10:41:25 GMT
From: over@the.net (dave)
Subject: Re: How to treat "\n" as "\n" ?
Message-Id: <3404030c.415892@news.one.net>

mheins@prairienet.org (Mike Heins) wrote:

>Thomas Bahls (thommy@cs.tu-berlin.de) wrote:
>: napier@seas.upenn.edu (Bill Napier) writes:
>: 
>: I have asked:
>: >> I am looking for a function that does the opposite of quotemeta; I
>: >>want Perl to interprete <backslash> <n> (two chars) as carriage
>: >>return.

I used:

  $foo =~ s{\\n}{\n}g;

I suppose one could also do:

$foo =~ s{\\t}{\t}

(I assume perl treats "\t" as a tab character).


FYI, I found another one today, wanting to put a variable reference in an eval.
How about:

    eval "sub{ MySub \\\$myvar }"


Three backslashes!


Dave
|
| Please visit me at http://w3.one.net/~dlripber
|
| For reply by email, use:
| dlripber@one.net
|________


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

Date: 28 Aug 1997 07:41:17 GMT
From: prikryl@dcse.fee.vutbr.cz (Petr Prikryl)
Subject: Re: How to treat "\n" as "\n" ?
Message-Id: <5u3a2t$qm9$1@boco.fee.vutbr.cz>

Thomas Bahls <thommy@cs.tu-berlin.de> wrote:
[...]
> How can I do this?
> 	example:
> 		$a= 'This is the first line.\n"Nope!"';
> 		print $a
> 
> 	results:
> 		This is the first line.\n"Nope!"
> 
> 	but I want:
> 		This is the first line.
> 		Yes!

The problem is that single quotes are treated similarly like in a Unix shell.
It means that the caracters inside are not interpreted. Because of this 
the example printed also \n and " as visible characters. When you remove 
the double quotes from inside and when you use them instead of single quotes, 
it will work.  When you want to print double quotes inside the string 
enclosed in double quotes, you must write them this way:  \"

Your example:
       example:
               $a= "This is the first line.\n\"The second line!\"";
               print $a;

       results:
               This is the first line.
               "The second line!"

To summarize: 'string' is not the same as "string".

Petr

--
Petr Prikryl (prikryl@dcse.fee.vutbr.cz)   http://www.fee.vutbr.cz/~prikryl/
TU of Brno, Dept. of Computer Sci. & Engineering;    tel. +420-(0)5-7275 218


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

Date: 28 Aug 1997 03:56:12 GMT
From: michael@flash.net (Michael W Peterson)
Subject: Re: Is there a perl IDE?
Message-Id: <5u2sss$11u$1@excalibur.flash.net>

On Wed, 27 Aug 1997 23:15:19 +0100, 
	Charlie Stross <charlie@nospam.antipope.mapson.org> wrote:
>
>Brian Wheeler<bdwheele@indiana.edu> wrote 
>(in article <5tevoa$mec$1@dismay.ucs.indiana.edu>):
>>
>>	You forgot the "one true editor": emacs.  It has a perl mode which
>>indents for you and will flash matching parens/brackets/braces.
>
>Apropos which: anyone know how to turn indenting off in cperl-mode? I
>HATE HATE HATE having some idiot editor decide how to indent my code
>for me!
>

Use vi?

-- 
Michael W Peterson			<http://www.flash.net/~michael/>
Senior System Administrator
FlashNet Communications			<http://www.flash.net/>
"Unix: more than enough rope..."


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

Date: Wed, 27 Aug 1997 22:54:00 +0300
From: Petri Backstrom <petri.backstrom@icl.fi>
Subject: Re: last line of a @list...
Message-Id: <340485D8.8A3@icl.fi>

Bert ten Cate wrote:
> 
> I'm new to perl and have a question that might sound stupid, but I'm stuck so
> here it goes...
> 
> I need to get the last line of @list into $lastline. Does anybody know how to
> do this? Any help is appriciated...

$lastline = $list[$#list];

regards,
 ...petri.backstrom@icl.fi
    ICL Data Oy
    Finland


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

Date: Thu, 28 Aug 1997 17:18:15 +1100
From: Ron Savage <rpsavage@ozemail.com.au>
Subject: Re: Perl and document conversion to HTML
Message-Id: <34051827.31F@ozemail.com.au>

Use LAOLA to read OLA files...

From: schwartz@cs.tu-berlin.de (Martin Schwartz) Newsgroups: comp.lang.perl.announce,comp.lang.perl.modules 
Subject: LAOLA library Followup-To: comp.lang.perl.modules Date: 10 Mar 1997 14:06:41 GMT Organization: 
Technical University of Berlin, Germany Lines: 48 Sender: news-merlyn@gadget.cscaper.com Approved: 
merlyn@stonehenge.com (comp.lang.perl.announce) Message-ID: NNTP-Posting-Host: gadget.cscaper.com 
X-Disclaimer: The "Approved" header verifies header information for article transmission and does not imply 
approval of content. Xref: merlin comp.lang.perl.announce:383 comp.lang.perl.modules:3336 Hello, I just 
finished a new distribution of LAOLA. This is a distribution of source codes and information about the binary 
format of OLE documents. Can be found at: http://wwwwbs.cs.tu-berlin.de/~schwartz/pmh/laola.html or at 
http://user.cs.tu-berlin.de/~schwartz/pmh/laola.html There you will find especially: Hacking guide Explanation 
of the binary format of OLE documents. laola.pl A perl library, that gives access to OLE documents like Word 
and Excel without Microsoft code.


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

Date: Wed, 27 Aug 1997 10:10:35 -0700
From: Michael McGrattan <mcgrattm@cts.com>
Subject: Perl FileHandles
Message-Id: <34045F8B.321E@cts.com>

I have a question regarding Perl file handles.  If I pass
a filehandle reference to a subroutine, how can I use that
reference as the handle for Perl format output?  Below is
a small example of what I am trying to do.  I am using STDOUT
as an example, but I would actually be using a filehandle other
than STDOUT.  I have no problem
using 'print' with the referenced filehandle, but I can not
assign format attributes to the same reference.  Is it possible
and if it is, what would the syntax be?

----------------------------------
#!/export/home/local/bin/perl 
use English;

&getTest(\*STDOUT);

sub getTest
{
   my ($fh) = @_;
   
   #
   #THIS WORKS FINE
   #
   print $fh "HELLO\n";

format REPORT_TOP=
@|||||||||||||||||
"E X A M P L E"

@|||||||||||||||||
"Name"
@||||||||||||||||||
"-----------------"
 .

format REPORT=
@<<<<<<<<<<<<<<<<<<
$name
 .

   #
   #THIS IS WHERE I HAVE THE PROBLEM.  DO I NEED
   #TO ASSIGN A NEW FILE HANDLE TO THE EXISTING REFERENCE?
   #I KNOW THE BELOW DOES NOT WORK, BUT I CAN NOT FIGURE OUT
   #HOW TO ASSIGN THE FORMAT VARIABLES TO MY EXISTING REFERENCE
?????  open(REPORTOUT,">$fh");  ??????

   $ofh = select(REPORTOUT);
   $FORMAT_TOP_NAME="REPORT_TOP";
   $FORMAT_NAME="REPORT";
   select($ofh);

   $name = "TEST";
   write REPORTOUT;
   close REPORTOUT;
}
 ------------------------------

If anyone has any advice/suggestions/solutions, it would be much
appreciated.

Thank you
Michael McGrattan


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

Date: Wed, 27 Aug 1997 10:50:26 GMT
From: over@the.net (dave)
Subject: Re: Q: IPC between Perl and C
Message-Id: <340405b0.1092568@news.one.net>

Doug Seay <seay@absyss.fr> wrote:

>Joachim Wunder wrote:
>> 
>> Hi!
>> 
>> I am trying to figure out how to do InterProcessCommunication (IPC) between a C
>> program and a Perl 5 program.
>> 
>> Any hints and/or code examples will be appreciated!
>
>What sort of IPC?  I have Perl scripts that are clients of C servers
>using TCP/IP.  I've never had any sort of problem with mixing the two
>languages.  What sort of problems have you seen?
>
>- doug

I just used System V msgget, msgsnd and msgrcv.  I used perl pack and unpack to
build binary structures that matched the message structures defined by C.
Worked very nicely.  I did need to define IPC_NOWAIT locally, though, cause I
could not get the h file converter to work properly in 5.002.


Dave

|
| Please visit me at http://w3.one.net/~dlripber
|
| For reply by email, use:
| dlripber@one.net
|________


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

Date: Wed, 27 Aug 1997 23:10:23 +0300
From: Petri Backstrom <petri.backstrom@icl.fi>
Subject: Re: RegExp Win95/NT4.0 ?
Message-Id: <340489AF.3F1F@icl.fi>

Marc Filthaut wrote:
> 
> I have a simple question to all the Windows Perl programmers.
> 
> I programm perl under unix and have the hole regexp, but when i use the
> same regexp under windows they didn't work. Is there a different between
> perl for windows and for unix ??

"Didn't work" is a bit vague for a problem description,
don't you think?

Anyway, there shouldn't be any differences in this respect, 
but it'd be easier to check out if you posted the data, your 
regular expression, and an example of what you expect as
a result (and what you actually see on UNIX vs. what you
get on Windows NT).

regards,
 ...petri.backstrom@icl.fi
    ICL Data Oy
    Finland


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

Date: 28 Aug 1997 03:17:46 GMT
From: Matthew Scott Britt <msbritt@ren.us.itd.umich.edu>
Subject: Shortest Path Algorithm
Message-Id: <5u2qkq$g5v$1@newbabylon.rs.itd.umich.edu>

Does anyone know of a shortest path algorithm written in perl?  I search
CPAN with no luck...
thanks...matt

-- 
_______________________________________________________________________________
Matthew Britt 		Web Page:  http://www.umich.edu/~msbritt
668-2411		PGP Key :  http://www.umich.edu/~msbritt/pgp.html

"Give me but one spot on which to stand and I will move the world."
								-Archimedes 


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

Date: 28 Aug 1997 09:41:56 +0200
From: Tom Grydeland <tom@mitra.phys.uit.no>
Subject: Re: Some Assistance Please...
Message-Id: <nqod8myycsb.fsf@mitra.phys.uit.no>

Tom Phoenix <rootbeer@teleport.com> writes:

> I prefer to use flexible qq// quoting, which
> allows all of the magic of double quotes, but lets me choose my own
> punctuation mark. (Choose one which doesn't appear in the string, of
> course! :-)

perl -wle 'print qq(Any (properly) "paired" delimiters are ok)'

>     print qq{I've got "quote marks", _and_ I'm easier to read!\n};

> Tom Phoenix           http://www.teleport.com/~rootbeer/

-- 
//Tom Grydeland <Tom.Grydeland@phys.uit.no>


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

Date: 27 Aug 1997 20:25:59 -0700
From: joshp@silmaril.com (Josh Purinton)
Subject: Re: timeout for getc function
Message-Id: <5u2r47$hao$1@shell3.ba.best.com>

[ posted and mailed ]

The one and only Ted Pavlic  <tpavlic@netwalk.com> writes:
>Does anyone know how to tell getc to either:
>
>a) Timeout if no data is received after a certain time
>b) Return something like \0 when no data is received

	perlfaq8: How do I timeout a slow event? 

	Use the alarm function, probably in conjunction with a
	signal handler, as documented in the Signals section of
	perlipc and chapter 6 of the Camel.  You may instead use
	the more flexible Sys::AlarmCall module available from
	CPAN.

--Josh

-- 
Josh Purinton <joshp@silmaril.com>
	
Good against remotes is one thing -
	good against the living is something else.  -- Han Solo




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

Date: Thu, 28 Aug 1997 08:12:53 +0200
From: Simon Caldow <scaldow@metronet.de>
To: bob@cafemedia.com
Subject: Re: Which version of PERL is running on the server?
Message-Id: <340516E5.170360B@metronet.de>

Bob,

Try 'which perl' and then follow the path and check the alias.

Or, on a standard setup, cd /usr/bin/perl and check the alias again.

Simon


Bob Maillet wrote:

> How would I go about finding which version of PERL is running on a
> unix
> server?
>
> Bob





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

Date: Thu, 28 Aug 1997 06:43:57 GMT
From: "Mark J. Gardner" <mjg@oms.com>
Subject: Which Windows (95) Perl to use?
Message-Id: <EFM2nz.FAp@nonexistent.com>

Sources on this newsgroup and on the Web have either recommended the
ActiveWare Perl for Win32 (available at
"http://www.activeware.com/Download/download.htm"), or Gurusamy Sarathy's
port (available on CPAN). I'm confused as to which I should actually
install, and confused as to why there are two separate versions. What are
the benefits of one over the other?

I don't think this is in the FAQ, but it is a point of confusion for me,
coming from a Unix world where there's only One True Perl. :-)

 --MJG



--
Mark J. Gardner
mjg@oms.com
http://www.oms.com/mjg/






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

Date: Wed, 27 Aug 1997 23:30:08 -0400
From: Mike Turk <mturk@globalserve.net>
Subject: Re: win95 perl/cgi ng - roblem
Message-Id: <3404F0BF.D46D5476@globalserve.net>

joe_g wrote:

> Having a problem:
>
> - I'm using windows 95
> - I have perl 5.003, cgi.pm
> - Netscape 3.01 gold
>
> the problem:
> If  I open my perl script (somefile.pl) in my browser I get a DOS
> window, the HTML code generated within the perl script is then printed
>
> as a literal   , and the DOS windows closes.
>
> If  I pipe the output of the perl script to a file from a DOS prompt
> ( perl somefile.pl > test.html )
> and then open the test.html file in my browser , everything is ok.
>
> Any ideas ??
>
> Thanks Joe

   I suspect you're missing the whole concept of CGI.... you don't open
a perl script with your browser..... a cgi script is usually invoked
via a "GET" or "POST" method  from a form which  passes "NAME -VALUE"
pairs to your script....... you might be better off posting this to a
cgi group.

Mike Turk
mturk@globalserve.net




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

Date: Thu, 28 Aug 1997 05:19:26 GMT
From: m.king@praxa.com.garbage.au (Mike King)
Subject: Re: win95 perl/cgi ng - roblem
Message-Id: <34050a42.604137794@news.ozemail.com.au>

>joe_g wrote:
>
>> Having a problem:
>>
>> - I'm using windows 95
>> - I have perl 5.003, cgi.pm
>> - Netscape 3.01 gold
>>
>> the problem:
>> If  I open my perl script (somefile.pl) in my browser I get a DOS
>> window, the HTML code generated within the perl script is then printed
>>
>> as a literal   , and the DOS windows closes.
>>

The problem is that you are missing a web server - what is happening
is that netscape is downloading it, and then executing it as an
applet, not caring what it actually does.

GO and find a web server for your machine, and then ask for
http://mymachine/mypage.html, which should be a form which will invoke
the perl script on the SERVER process, delivering the HTML output to
the browser

Mike

===== Spam Filter:
===== You can email me at the following address after putting out the trash ...
garbage.m.king@praxa.com.garbage.au


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

Date: 27 Aug 1997 21:31:33 -0600
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: www.perl.com ?
Message-Id: <5u2rel$n45@flatland.dimensional.com>

David Turley <dturley@rocketmail.com> writes:

> Does anybody know what has happened to www.perl.com?
>
> I added the "Programming Republic of Perl" logo to my page and now the
> link returns a "Document contains no data" error.
>
> Just what does this error anyway?

It means exactly what it says, i.e., the document contains no data:

    % telnet www.perl.com 80
    Trying 208.201.239.48...
    Connected to www.perl.com.
    Escape character is '^]'.
    GET / HTTP/1.0
    
    Connection closed by foreign host.

I'm sure they'll fix it ASAP.
-- 
Michael Fuhr
http://www.dimensional.com/~mfuhr/


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

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

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