[8013] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1638 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 14 15:17:33 1998

Date: Wed, 14 Jan 98 12:00:28 -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           Wed, 14 Jan 1998     Volume: 8 Number: 1638

Today's topics:
     basename with NT <PAYS@FILNET.fr>
     Re: Can I create a Linked List in Perl <jdporter@min.net>
     Re: Can I create a Linked List in Perl (Brian Wheeler)
     Re: Comparing strings <jdporter@min.net>
     Creating seperate process <djboyd@sam.on-net.net>
     Re: DBM libraries <westmj@esvax.dnet.dupont.com>
     DMS1100 and perl? <orangutan@grungyape.com>
     Re: getting charecters from a variable <westxga@ptsc.slg.eds.com>
     Help poor performance with Oraperl for perl5 (DBI Orape (Mark Kornfein)
     Re: Help with my code please <dboorstein@ixl.com>
     Re: i am a newbie <Jacqui.Caren@ig.co.uk>
     Re: Local paths in Perl for Win32 <newspost@dyna_cs.demon.co.uk>
     Re: Multi-line input: fastest way? (Kevin Reid)
     Re: Newbie: how to get file permissions? <jdporter@min.net>
     Re: Perl CGI script's own directory (Steve Linberg)
     Re: Perl on Windows NT (Steve Linberg)
     Re: PERL programmer needed. <Jacqui.Caren@ig.co.uk>
     Perl Script Not Receiving Parameters <shill@ipa.net>
     Re: Perl to Binary? <merlyn@stonehenge.com>
     Re: Problem calling a cgi from cgi <bob.trieger@fmr.com>
     Re: Query on Uncaught Exception <jstern@world.northgrum.com>
     Re: Read STDERR from child? (Robb Kambic)
     Searching in directories? skulk@glue.umd.edu
     Re: Sorting a textfile <joseph@5sigma.com>
     Re: source into binary code <tchrist@mox.perl.com>
     strange read using CGI.pm <richard.remington@gateway2000.com>
     Syntax coloring for POD format (Ken)
     Re: the -> operator <joseph@5sigma.com>
     Webmasters???? <rbhattac@bayou.uh.edu>
     Why would stat return 12/31/69 <djboyd@sam.on-net.net>
     Re: Why would stat return 12/31/69 (Mike Stok)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Wed, 14 Jan 1998 10:47:17 GMT
From: "Olivier" <PAYS@FILNET.fr>
Subject: basename with NT
Message-Id: <01bd20d9$d3243740$0c07000a@dns1.filnet.fr>

I would like to use the same command as basename (UNIX)

to obtain with a path like
c:\folderA\folderB\file.txt  -->file.txt

This expression is not good why ???

$base=($File=~m|.*/([^/]+)$|)

P.S:I dont want to use cgi.pm

Thanks

Olivier ROBERT
soil@filnet.fr



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

Date: Wed, 14 Jan 1998 13:13:22 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Can I create a Linked List in Perl
Message-Id: <34BD0042.64CF@min.net>

Bart Lateur wrote:
> 
> draggs@hawkeye.idx.com wrote:
> 
> >I'm reasonably new to Perl, but am an old C programmer.  I was
> >wondering if it was possible to create a c-style linked list and perl.
> >If it is, how would I go about doing so?
> 
> Who would ever want to use C-style lists? Now if you were to say "LISP
> style lists", *then* I would understand.
> 
> Use arrays for simple lists. If you want nested lists, use an array
> reference as a list item.
> 
>         Bart.

Seems to me that Perl lists are already much more like Lisp lists
than a typical linked list in C.
With linked lists, you have the ability to traverse from any node
to its previous or next (in the case of a doubly-linked list),
without having to have knowledge of the root/head/tail/etc.
Perl arrays do not intrinsically support this feature.
Besides, the linked list question could be considered just a simple
case of the more general question of directed graphs. Even if you
find Perl arrays to be suitable for those situations where you thought
you wanted a linked list, they do not (intrinsically) fit the bill
when you need multiple edges to/from a node.

John Porter


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

Date: 14 Jan 1998 18:47:29 GMT
From: bdwheele@indiana.edu (Brian Wheeler)
Subject: Re: Can I create a Linked List in Perl
Message-Id: <69j181$m4v$1@flotsam.uits.indiana.edu>

In article <34BD0042.64CF@min.net>,
	John Porter <jdporter@min.net> writes:
> Bart Lateur wrote:
>> 
>> draggs@hawkeye.idx.com wrote:
>> 
>> >I'm reasonably new to Perl, but am an old C programmer.  I was
>> >wondering if it was possible to create a c-style linked list and perl.
>> >If it is, how would I go about doing so?
>> 
>> Who would ever want to use C-style lists? Now if you were to say "LISP
>> style lists", *then* I would understand.
>> 
>> Use arrays for simple lists. If you want nested lists, use an array
>> reference as a list item.
>> 
>>         Bart.
> 
> Seems to me that Perl lists are already much more like Lisp lists
> than a typical linked list in C.
> With linked lists, you have the ability to traverse from any node
> to its previous or next (in the case of a doubly-linked list),
> without having to have knowledge of the root/head/tail/etc.
> Perl arrays do not intrinsically support this feature.
> Besides, the linked list question could be considered just a simple
> case of the more general question of directed graphs. Even if you
> find Perl arrays to be suitable for those situations where you thought
> you wanted a linked list, they do not (intrinsically) fit the bill
> when you need multiple edges to/from a node.
> 
> John Porter

	Here's a doubly-linked list implementation using hashes and hash 
references. Its not pretty, but it works:

sub MakeNode {
    my(%hash)=@_;
    $hash{_prev}=undef;
    $hash{_next}=undef;
    return {%hash};
}

sub AddNode {
    my($node,$new_node)=@_;
    $node->{_next}=$new_node;
    $new_node->{_prev}=$node;
}

sub NextNode {
    my($node)=@_;
    return $node->{_next};
}

sub PrevNode {
    my($node)=@_;
    return $node->{_prev};
}



Here's a simple program that uses the subs:

$cur=$head=MakeNode('data'=>'foo');
for($i=0;$i<8;$i++) {
    $new=MakeNode('data'=>$i);
    AddNode($cur,$new);
    $cur=$new;
}

$cur=$head;
while(1) {
    print "data: $cur->{data}\n";
    $cur=NextNode($cur);
    if(!defined($cur)) {
	last;
    }
}



It could be simplified or expanded, but its pretty easy to do them in
perl...if you have the desire/need to ;)  Perhaps someone should make a
linked list class with new, add, next, and prev methods....


Brian Wheeler
bdwheele@indiana.edu


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

Date: Wed, 14 Jan 1998 13:38:51 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Comparing strings
Message-Id: <34BD063B.52A4@min.net>

Kyle wrote:
> 
> > I kind of new to perl and am trying to compare two strings but when I
> > use:
> > if ($string1 == $string2) it doesn't work... it's always true.  I thought
> > that was legal.

Sure it's legal, but it's still wrong.  To compare strings, you should
use
cmp, not ==, like so:

    if ( $s1  cmp  $s2 ) { ...


> > I've tried /$string1/g == $string2  but there are brackets in $string1
> > and it keeps saying:
> > unmatched [] in regexp at .... line ..
> >
> Oops... the /$string1/g == $string2 is supposed to be:
> /$string1/g =~ $string2

You're way off.  =~ is the operator which binds (applies) a regular 
expression on the RIGHT to a plain string on the LEFT.
Regular expressions are typically enclosed in // (slashes).
So the following would be valid:

    if ( $s1  =~  /$s2/ ) { ...

The expression is true if the string on the left is matched by 
the regex on the right.
Unfortunately, the construct ( /$s1/ =~ $s2 ) is also legal, 
although not likely EVER to be what you want.

In any case, you wanted to do a simple string comparison: cmp.

Please read your documents, especially perlop and perlfunc.

Good luck.

John Porter


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

Date: Wed, 14 Jan 1998 11:51:54 -0500
From: "David J. Boyd" <djboyd@sam.on-net.net>
Subject: Creating seperate process
Message-Id: <34BCED2A.C4ED4996@sam.on-net.net>

How does one create seperate process under windows NT.  I am using
WIN32::Process::Create.  The application I am running is responsible for
auditing directory structures on 19 server pairs.  If I do this one at a
time it takes about 3 days due
to slow network on some of the pairs.  To help solve this issue I would
like to create
some processes that will attach to the server pairs.  I am using Novell
3.11 client and
know that it has a limit of 8 connections at any given time.  Therefore
I would like to
create 4 process that will each be attached to a source-target combo.  I
have done some
testing this but what happens is that, for example, two process are
working on the
same server pairs, but different volumes.  When one of the processes is
done, it logs out
of the server, which will then log the other process out, not completing
its task.  So
is there a solution to this using WIN32::PROCESS under perl V5.0 Build
110 for WinNT.

 ...
TIA




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

Date: 14 Jan 1998 19:26:17 GMT
From: Mike West <westmj@esvax.dnet.dupont.com>
Subject: Re: DBM libraries
Message-Id: <69j3gp$j50@topgun.es.dupont.com>

This sounds like the classic cgi "permissions" problem. Web
servers run scripts as a different user, often "nobody", with
different a different path and environment than your account.
It may even run a different flavor of dbm.

This topic is well covered in various faqs.  Check for the posting
by the gnat on faqs.


In article <34BBE4D4.41C6@umbc.edu> englehart scott, sengle1@umbc.edu
writes:
(typical litany of cgi problems, including:)
>When I run the script from the command line dbmopen() uses the exact
>file name I give it as a parameter. When I the script from the web it
>creates two new files; one with the file name and .dir appended, and the
>other with .pag appended.
>
>I'm assuming that somehow the script is using different versions of perl
>and/or libraries depending on whether it's running from the command line
>or the web. My ISP's server uses UNIX and I think it is apache. There
>appears to be several versions of perl in several different directories
>on the server. Have any ideas what exactly is going on and how I, or my
>ISP can fix it?


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

Date: Wed, 14 Jan 1998 14:44:42 -0500
From: "Franklin L. Petersen" <orangutan@grungyape.com>
Subject: DMS1100 and perl?
Message-Id: <69j4hl$2uk$1@cletus.bright.net>

Is it possible to access a DMS1100 database via perl?

Thanks,
Frank

please send any info via franklin.petersen@crownlift.com

:)




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

Date: Wed, 14 Jan 1998 14:15:54 +0000
From: Glenn West <westxga@ptsc.slg.eds.com>
Subject: Re: getting charecters from a variable
Message-Id: <34BCC89A.59B7@ptsc.slg.eds.com>

Matthew Robertson wrote:
> 
> Hi
> 
> I am try to get the first six charecters from a variable and store them in
> seperate variables, or seperate array elements.
> 
> e.g.  Variable = Matthew
> var1 = M
> ..
> var6 = e
> 
> I am trying to use substr at the moment, but I am getting some strange
> results.
> 
> Please can anyoe help.
> 
> Thanks in advance
> 
> Mat

Here is one solution:

$variable=Matthew;                                 
                                                   
foreach $offset (0..5) {                           
        push(array, substr($variable,$offset,1));  
        }                                          
                                                   
print join(':', @array)."\n";


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

Date: 14 Jan 1998 18:52:07 GMT
From: kornfein@.crd.ge.com (Mark Kornfein)
Subject: Help poor performance with Oraperl for perl5 (DBI Oraperl)
Message-Id: <69j1gn$oop$1@rdsunx.crd.ge.com>
Keywords: oraperl, dbi, oracle



-- 
We have an application that we are developing using the Oraperl interface
to DBI. (DBD-Oracle-0.47).

After doing some timing tests we have found the queries have very poor 
perfromance. A query that takes 4-5 seconds to complete in sqlplus takes
50 seconds from perl. We have similiar ratios for other queries. The time is
being spent in the fetch loop (not login or open).

Also the query we are using is very simple "select x from table where y =2;"
it does not contain a join and returns about 600 records 1 field each.

We have been told by folks who use Oraperl for perl 4, that we need to
increase the cache size, but this is evidently not an option in
DBI.

Any ideas or help? Anyone else see this type of performance?

thanks,

Mark

===============================================================================
Mark Kornfein                              INET: kornfein@crd.ge.com
GE Corporate Research & Development        Phone: (518) 387-5843
One Research Circle, K1-5B36, Schenectady, NY 12309                         


===============================================================================
Mark Kornfein                              INET: kornfein@crd.ge.com
GE Corporate Research & Development        Phone: (518) 387-5843
One Research Circle, K1-5B36, Schenectady, NY 12309                         




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

Date: Wed, 14 Jan 1998 12:08:20 -0500
From: Dan Boorstein <dboorstein@ixl.com>
To: Webmaster@builders-connection.com
Subject: Re: Help with my code please
Message-Id: <34BCF104.714E0833@ixl.com>

seeing this makes me loop-y, try:

for $field ($sitename, $type, $name) { # et cetera
  $field =~ s/,|\n//g;
}  

dan

Builders Connection wrote:
> 
> #!/user/bin/perl
> # Program to do the obvious
> #checking for any comma's
> #Can I combined the substitute statement and have it chek for both at
> one time
> $sitename =~ s/,//;
> $type =~ s/,//;
> $name =~ s/,//;
> $address1 =~ s/,//;
> $city =~ s/,//;
> $state =~ s/,//;
> $zip_code =~ s/,//;
> $country =~ s/,//;
> $phone =~ s/,//;
> $phone2 =~ s/,//;
> $e_mail =~ s/,//;
> 
> #checking for any \n
> $sitename =~ s/\n//;
> $type =~ s/\n//;
> $name =~ s/\n//;
> $address1 =~ s/\n//;
> $city =~ s/\n//;
> $state =~ s/\n//;
> $zip_code =~ s/\n//;
> $country =~ s/\n//;
> $phone =~ s/\n//;
> $phone2 =~ s/\n//;
> $e_mail =~ s/\n//;
>


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

Date: Wed, 14 Jan 1998 18:11:34 GMT
From: Jacqui Caren <Jacqui.Caren@ig.co.uk>
Subject: Re: i am a newbie
Message-Id: <EMsD7B.3Ho@ig.co.uk>

In article <34afc017.4221670@news.hol.fr>,
Fabrice Scemama <fabrice.scemama@gesnet.net> wrote:
>You should set up a HTML form, then make
>your PERL script output another HTML doc.
>
>Your present script can only work within
>your local compiler (assuming you replace the
>if ($name eq "lisa")
>line with
>if ($name == "lisa").

ROTFL!

See my posting about the usage of .net to the job posting by @alex.net
addresses. The logic goes something like :-)

sub competence { my ($eaddr) = shift;

	if ($eaddr =~ m/^\.net$/i) { 
		return  "Possibly Intelligent" if works_for_isp($eaddr);
		return "Probable Utter Moron";
	}
	return "Unsure";
}

All the best,
	Jacqui Caren
-- 
Jacqui Caren                    Email: Jacqui.Caren@ig.co.uk
Paul Ingram Group               Fax: +44 1483 419 419
140A High Street                Phone: +44 1483 424 424
Godalming GU7 1AB United Kingdom



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

Date: Wed, 14 Jan 1998 19:33:57 GMT
From: "GarryG" <newspost@dyna_cs.demon.co.uk>
Subject: Re: Local paths in Perl for Win32
Message-Id: <01bd2123$58831700$0300a8c0@renegade>

Eric T. Wienke <eric@NOSPAM_liquidsilver.com> wrote in article
<34bbb587.40974147@192.168.0.1>...
> 
> Any reason in particular you are not simply using full paths, i.e.
> c:/foo/docs/project/data ?
> 
> Eric T. Wienke
> 
> To send email remove "NOSPAM_" from the address.
> 

So that the scripts work when they are tranfered to a unix server they will
be running on once finished.




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

Date: Wed, 14 Jan 1998 12:13:00 -0500
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: Multi-line input: fastest way?
Message-Id: <1d2uf8d.1qnj9dzfl1bv2N@slip166-72-108-28.ny.us.ibm.net>

Terry Michael Fletcher - PCD ~ <tfletche@pcocd2.intel.com> wrote:

> Kevin Reid (kpreid@ibm.net) so eloquently and verbosely pontificated:
> > Is there a better way to implement line continuations?
> the magic expression i have preferred to use is:
> 
>  $_ .= <> while s/\\\s*//;
> 
> for all my STDIN -> STDOUT compilers.  but those don't use prompts.
> 
> for a simple "shell-type" application (like yours?), i would use a for()
> loop like so:
> 
> $U_input = "input";
> 
> for (print "$U_input> "; <>; print "$U_input> ") {
>         $_ .= <> while s/\\\s*$// and print " "x length($U_input) ."> ";
> 
>       # your statement is now ready here....  you may need to chomp.
> 
> }
> 
> hope that helps.

That's certainly shorter, but I wanted something that is easier to
understand, not harder.

-- 
Kevin Reid


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

Date: Wed, 14 Jan 1998 13:50:38 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Newbie: how to get file permissions?
Message-Id: <34BD08FE.3729@min.net>

Andrew W. Robinson wrote:
> 
> How do I get the permission of a file, especially in a format
> suitable to use with the chmod() function?
> 
> The mode field of the stat() function looks close. The perlfunc
> page defines mode as "type and permissions", but I don't know how
> to separate the two. Is there a simple octal formula to do so?

If you're just looking for a way to set the permissions on file B
to be the same as on file A, then get the mode and AND it with
0777. This clears out the bits not pertaining to permissions.
Then you can use the number in chmod.  For example:

    my $mode = (stat($fileA))[2];
    $mode &= 0777;
    chmod $mode, $fileB;

hth,
John Porter


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

Date: Wed, 14 Jan 1998 14:11:58 -0500
From: slinberg-bitme@crocker.com (Steve Linberg)
Subject: Re: Perl CGI script's own directory
Message-Id: <slinberg-bitme-1401981411580001@projdirc.literacy.upenn.edu>

In article <34b68890.524144494f47414741@radiogaga.harz.de>,
MARTIN@RADIOGAGA.HARZ.DE wrote:

> Hi everyone!
> 
> There are a couple of related Perl CGI scripts that pull in other files
> (e.g. for configuration) via require. But how is perl supposed to find
> these, as the scripts' cgi-bin sub-directory isn't part of @INC? Is
> there a (portable) way for a Perl CGI script to get the directory it's
> situated in, in order to push it into @INC before attempting to require?

Under NT 4.0 & M$ IIS 3.0, I use the following at the beginning of each script:

BEGIN {
   $dir = $0;
   $dir =~ s/\\/\//g;
   $dir =~ /(.*)\/(.*).pl/;
   chdir $1;
}

This sets the directory to that containing the current script.  It's not
completely robust, but works for DOS-style directory names where the
script ends in .pl.  After this, require'd files load just fine.

No thanks to M$ for this one.


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

Date: Wed, 14 Jan 1998 14:23:00 -0500
From: slinberg-bitme@crocker.com (Steve Linberg)
Subject: Re: Perl on Windows NT
Message-Id: <slinberg-bitme-1401981423000001@projdirc.literacy.upenn.edu>

In article <34BC7F32.F0BE8927@club-internet.fr>, pr1@club-internet.fr wrote:

> Hello,
> 
> Could someone please tell me how to install and setup Perl on Windows NT:
> 
> - which version of Perl 5 should I use?

The ActiveWare port is popular.  www.activeware.com

> 
> - where do I put the Perl directory? In the NT Server directory?

see below

> 
> - where do I create a cgi-bin directory?

see below

> 
> - how do I configure the NT Server so that it knows that ".pl" files are cgis?
> 

this is explained in the activeware documentation


> - is Perl for Windows NT multi-threaded?

Don't know...

> 
> - how robust is Perl 5 for Windows NT?

Works fine for me, but get ready to write code to get around NT-specific
problems, limitations, and differences from UNIX.

Tell us what version of NT you're using (3.5.1? 4.0), and what web server
you're using.  The answers to many of your questions depend on this
information.

Good luck.


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

Date: Wed, 14 Jan 1998 18:02:37 GMT
From: Jacqui Caren <Jacqui.Caren@ig.co.uk>
Subject: Re: PERL programmer needed.
Message-Id: <EMsCsD.3EL@ig.co.uk>

In article <52ql86.ot.ln@localhost>, Tad McClellan <tadmc@metronet.com> wrote:
>brian d foy (comdog@computerdog.com) wrote:
>: In article <883714026.45875202@dejanews.com>,
   Marcus A. Davis <marcus@alex.net> wrote:
>: >The Alexander Group, Inc. provides custom Internet Applications and is
>: >seeking qualified PERL programmers.  Full and part-time positions are
>                     ^^^^
>: >available.  Please contact Marcus A. Davis at 888.253.9637 or send email
>: >with resume.
>: what's "qualified" and where in the world are you?
>Maybe you need to know the difference between 'perl', 'Perl', and
>'PERL' to be qualified?

I realised long ago that .net is filled with;

 *) ISP routers and staff - most of which know what they are doing. :-)
 *) ISP's accounts (customers) who are mostly utter morons. :-(

Since the prior never talk to me direct I work on the principle that all
 .net mail (with the exception of our ISP demon.net) falls in to the latter
category - until proved otherwise.

I feel sorry for these folks because it is quite obvious they do not
know what they are doing and have no idea how to find who they are
looking for. They may be utter cheapskates or may simply be desperate
to find someone to do the job.

Did anyone suggest that they take a full/half page ad in the perl
journal? This would be a very very good way to get the attention of
some of the best perl folks. People who take out large ads in TPJ are

	*) prominently advertised
	*) are prepared to pay for something they think is valued
	*) are serious about finding good staff

There are also many people who offer thier services on daily or
fixed price per job rates - such as ourselves :-).

Again TPJ adverts is probably the best way to get a quality response...

Hope this helps,
	Jacqui Caren - TPC

p.s.

HINT: get a non .net commercial email address if you want to be taken seriously.

-- 
Jacqui Caren                    Email: Jacqui.Caren@ig.co.uk
Paul Ingram Group               Fax: +44 1483 419 419
140A High Street                Phone: +44 1483 424 424
Godalming GU7 1AB United Kingdom



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

Date: Wed, 14 Jan 1998 11:52:00 -0600
From: Shane Hill <shill@ipa.net>
Subject: Perl Script Not Receiving Parameters
Message-Id: <34BCFB3F.2C2F1B0B@ipa.net>

Please help,

I am using Windows NT with IIS 3.0.  Somehow my HTML form is not passing
my PERL script values.  I can for example type in the URL in IE 3.0 bar:

http://local_host/cgi-bin/db_search.pl?setup_file=poretrieve.setup&submit_value=yes&custno=1045

and it runs like it should.  When I put the same parameters in the HTML
search
form and call http://local_host/cgi-bin/db_search.pl, it will not pass
any of the
parameters that I have coded in the HTML search form.  I can't figure it
out.
The same HTML search form on Windows 95 running OMNIHTTPD machine works
perfectly.  Has anyone got any  ideas why it
is losing the values when it calls the script on Windows NT using IIS?

Thanks
Shane Hill
shill@ipa.net



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

Date: 14 Jan 1998 10:54:05 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: jdporter@min.net
Subject: Re: Perl to Binary?
Message-Id: <8cwwg37xhe.fsf@gadget.cscaper.com>

>>>>> "John" == John Porter <jdporter@min.net> writes:

John> J. Bacon wrote:
>> 
>> ...  merlyn@stonehenge.com is (as
>> near as I can determine) COMPLETELY correct ...

John> Heh heh.  I tend to agree.

Ugh.  I don't.  There's plenty of evidence for my back-cover bio that
says "... occasionally INCORRECT spatterings on Usenet...".

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 229 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Wed, 14 Jan 1998 14:32:06 -0500
From: Bob Trieger <bob.trieger@fmr.com>
To: Maxwell Smart <dereligion@dereligion.com>
Subject: Re: Problem calling a cgi from cgi
Message-Id: <34BD12B6.69AD@fmr.com>

Maxwell Smart wrote:
> 
>     I4m not an expert perl programmer, but i have to design avarious
> script4s in perl, and this is my problem, well the biggest at this time:
> 
>     I have a cgi generated from an user consult sent in the url, the the
> page in the screen have many word tha have to b linked with other cgi. I
> tried to do using the next
> 
>     <a href="04.cgi">$A,</a>
> 
>     where $A is the word that have to be linked with the next cgi that
> will present mor info about the word.
> 
>     Well my dear friends, this is my problem, I really need your help so
> I4ll be waiting for you...        Thanks
> 
> Jorge
> 
>     Please send me a mail to the next adress: patomas@hotmail.com


What was the syntax of the entire line?

If you tried:
	print "<a href="04.cgi">$A,</a>";
it will fail because you didn't escape your quotes:
	print "<a href=\"04.cgi\">$A,</a>";
is correct.


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

Date: Wed, 14 Jan 1998 17:23:15 GMT
From: Jim Stern <jstern@world.northgrum.com>
Subject: Re: Query on Uncaught Exception
Message-Id: <34BCF483.167E@world.northgrum.com>

Simon Peate wrote:
> 
> I am receiving the following when no parameters are supplied to my perl
> script:
> 
> Uncaught exception from user code:
>      No parameter supplied!
> 
> The start of my script is as follows:
> 
> #!/opt/perl/bin/perl -w
> 
> use strict;
> use diagnostics;
> 
> die "No parameter supplied!\n" unless $ARGV[0];
> 
> Why is it uncaught when I thought I'd caught it?

Ironically, the uncaught exception is generated by the `die' itself.
Put a line such as this above your `die' to eliminate the message:

    $SIG{__DIE__} = sub {warn $_[0]; die "for real\n"; };

For more about $SIG{__DIE__}, see perlfunc and perlvar.

-- 
Jim Stern -- Views here are my own, not Northrop Grumman's.   (El
Segundo, CA)


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

Date: 14 Jan 1998 19:09:23 GMT
From: rkambic@unidata.ucar.edu (Robb Kambic)
Subject: Re: Read STDERR from child?
Message-Id: <69j2h3$gq8$1@ncar.ucar.edu>

In article <34bcce76.642189@flood.xnet.com>,
	efflandt@xnet.com (David Efflandt) writes:
> I cannot seem to find in man pages or Programming Perl how to read
> STDERR from a child process (in Linux).  I am attempting to use a
> 'dialog' menu.  STDIN and STDOUT should remain normal.
> 
> I can get the results of a yesno dialog because it simply uses the
> exit code.  But a dialog --menu puts the menu selection in STDERR and
> it now just displays on the screen at the last cursor position.  How
> do I read this into my script instead?

David,

Here's a simple way of catching STDERR from a subprocess, redirect it to STDOUT.
Because perl uses borne shell like syntax  2>&1 in system calls.

( @output ) = `pqact -vl - -q /dev/null $pqact_conf 2>&1` ;
 
The only problem you might have is determining what output is from STDOUT 
verses STDERR.  

Robb...


> 
> Or is there any way in perl to do a colored dialog like menu?
> 
> I am trying to write a console script to poll Quake 2 servers
> (w/qstat) and then display a selection list to connect Q2 to the
> selected server.
> 
> 
> David Efflandt/Elgin, IL USA
> efflandt@xnet.com    http://www.xnet.com/~efflandt/

-- 
_______________________________________________________________________________
Robb Kambic        			   Unidata Program Center
Software Engineer			   Univ. Corp for Atmospheric Research
rkambic@unidata.ucar.edu		   WWW: http://www.unidata.ucar.edu/
==========================================================================
"I've seen things you people wouldn't believe...
"Attack ships on fire off the shoulder of Orion.
"I watched C-beams glitter in the dark near the Tannhauser gate...
"All those moments will be lost in time, like tears in rain.
"Time to die."  movie BladeRunner
==========================================================================



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

Date: Wed, 14 Jan 1998 12:35:41 -0600
From: skulk@glue.umd.edu
Subject: Searching in directories?
Message-Id: <884790996.24444941@dejanews.com>

I am new to Perl and am trying to figure out how to do this problem.
I need to search through directories to find out which files do not have a
cover page, basically a file with blah_blah_cover.txt for each .txt in
the directory. how do i go about this?

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


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

Date: Wed, 14 Jan 1998 11:42:10 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Sorting a textfile
Message-Id: <34BD06F6.3742A59B@5sigma.com>

If you're sorting on a Unix machine, and the file might be
large, use the built-in sort command, not Perl, to sort the file.
Much faster and less of a resource hog.

	-joseph
	 http://www.effectiveperl.com

Franziskus Geeb wrote:
> 
> Hi everybody,
> a newbie-question :-)
> 
> I want to sort a textfile on a number, [...]


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

Date: 14 Jan 1998 17:04:54 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: source into binary code
Message-Id: <69ir7m$m43$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, Dan Boorstein <dboorstein@ixl.com> writes:
:i have to disagree with this statement. i can't read compiled
:code just by opening a file. in order to understand just
:what's going on internally i would have to disassemble the code.

Security through obscurity is a terribly dangerous miscarriage of truth.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

"Patriotism is the virtue of the vicious."
 - Oscar Wilde


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

Date: Wed, 14 Jan 1998 12:03:34 -0600
From: Richard Remington <richard.remington@gateway2000.com>
Subject: strange read using CGI.pm
Message-Id: <34BCFDF6.1EC4DB11@gateway2000.com>

i am using perl5 on a machine using NT and IIS. and i am writing a
script that uses the CGI object to save to a file repeatedly and then
later it reads the saved objects off from the file. but for some reason
CGI won't read the first saved object, but it will read the second,
third, fourth and so on...
the code is basically from the man:

use CGI;


   open (OUT,``>>test.out'') || die;
       my $q = new CGI;
      $q->save(OUT);
   }
   close OUT;
   # reopen for reading
   open (IN,"test.out") || die;
   while (!eof(IN)) {
       my $q = new CGI(IN);
       #munge and print 
	}

does anyone know what i am talking about


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

Date: Wed, 14 Jan 1998 12:00:43 -0500
From: ken@forum.swarthmore.edu (Ken)
Subject: Syntax coloring for POD format
Message-Id: <ken-1401981200430001@news.swarthmore.edu>

Hi-

I'm about to send a message to the folks at BBEdit (my favorite text
editor) asking for some syntax-coloring support for Perl files with POD in
them.  Would anybody want to double-check what I've said, making sure it's
what we Perl types really want?

Here's the message>>>>>>>>>>>>>>
Hi there-

I'd like to report a bug, or desired feature (depending on how you look at
it) in BBEdit's Perl text coloring.  It has to do with the documentation
format that Perl supports (pod, "plain old documentation").  The change, I
guess, amounts to this - anytime BBEdit saw one of these pod directives,
it would color the following text as a fill-style comment:

=pod
=head1
=head2
=item
=over
=back
=for
=begin
=end

And the comments are terminated by this:

=cut


The reason I'm not sure whether to report this as a bug or desired
feature, is that treating pod code as real perl code (as BBEdit does now)
can lead to some nasty coloring.  Consider this case:

______________________________________________________________
sub some_perl_code {
   $var = shift;
   ....
}

=item some documentation

'Twas the night before Christmas.

=cut

sub some_more_perl_code {
   $var = shift;
   # Ak!  All of this code is colored as a string, because of that
   # leading quote in the documentation!
   ...
}
______________________________________________________________

I think it would be very easy for Bare Bones to implement this, because
the documentation format is extremely simple.  Anyway, just wanted to pass
along a wish.

Great product, by the way.
<<<<<<<<<<<<<<<<<<<<<

-Ken Williams
 The Math Forum
 ken@forum.swarthmore.edu


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

Date: Wed, 14 Jan 1998 11:41:03 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: the -> operator
Message-Id: <34BD06B2.D5E60FBB@5sigma.com>

In a word, yes.

	-joseph

Phil R Lawrence wrote:
> 
> Is it because of
> the -> notation as opposed to plain old function(params) notation?


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

Date: Wed, 14 Jan 1998 11:44:32 -0600
From: Rishi Bhattacharya <rbhattac@bayou.uh.edu>
Subject: Webmasters????
Message-Id: <34BCF980.982D2003@bayou.uh.edu>

Hello,

    I am currently starting a new project (a website) and am looking for
an experienced Perl/CGI programmer to head the Perl/CGI department of
the site.  The responsibilities of the hired person will be very simple
- you will be required (contractually obligated) to write three to four
articles on Perl/CGI (topic will be at your discretion) per month.
    The ideal applicant will have at least a year of programming
experience and excellent writing skills.  At this point, you are no
doubt asking - what will I get?
    The website that I am starting will be more like a company.  Each
department head will collaborate with others through email, phone, etc.
If you are selected to be the head, I will send you a contract which
will guarantee you your share of the revenues the company receives.
There will be two methods through which we will generate income - 1)
Consulting  2) Ads.  The website will be a 'gathering' place for
webmasters of all types - novice to expert.  It will have articles on
all the latest topics, as well as discussion groups, forums, chats, etc.
The LAYOUT for the site is complete.  Please feel free to check it out.
Remember - it is only a LAYOUT.

http://www.webresource.net/

There are an enormous amount of details that are left to talk about. If
you are even remotely interested in the position and have the time
needed to do the job, I urge you to contact me.  Please send a few urls
where I can find examples of your work, and of course, mention all the
things that make you a better applicant than all the rest.  If you are
selected, you will be among many elite professionals - employees of
Compaq, HP, NASA, etc.  Thanks for your time.

Rishi Bhattacharya
rbhattac@bayou.uh.edu



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

Date: Wed, 14 Jan 1998 11:06:26 -0500
From: "David J. Boyd" <djboyd@sam.on-net.net>
Subject: Why would stat return 12/31/69
Message-Id: <34BCE282.65715E9A@sam.on-net.net>

Anyone know why the stat function would return a date of 12/31/69 with a
time
of 19:00 on a file or directory.


Here is the sub routine that I am using.  The first time it is called,
it is passed the path
of interest for both arguements:  for example
checkfiles("c:\apps","c:\apps");
 ...

#***************************************************************************

#Name:  CheckFiles
#Purpose: This routine is responsible for makeing sure we can get to the

#  source directory and then get a list of all the files in the
#  directory by path, file name, size, and date.
#***************************************************************************

sub CheckFiles
{
  # get passed arguements
  my($base) = shift;  #store first pass arguement
  my($path) = shift;  #store second pass arguement

  #declare some local vars
  my($fullFilename);
  my(@files);         #array to hold sorted file names
  my($sec, $min, $hr, $day, $month, $year, $day_of_week, $julianDate,
$dst);

  print("new dir");
  #open up the source directory
  if(!opendir(DIR, $path))
  {
    &RecError ("(CheckFiles) Unable to open $path\n     $!");
  }

  #sort the files found in the directory
  @files = sort(readdir(DIR));

  #close the dir
  closedir(DIR);

  foreach (@files)
  {
    print("..");
    next if /^\.|\.\.$/;

    $fullFilename = "$path\\$_";
    $count++;
    $perm = (stat($fullFilename))[2];
    $size = (stat($fullFilename))[7];
    $mtime= (stat($fullFilename))[9];
    ($sec, $min, $hr, $day, $month, $year, $day_of_week, $julianDate,
$dst) = localtime($mtime);
    $month++;

    if ($hr < 10)
    {
      $hr = "0" . $hr;
    }
    if ($min < 10)
    {
      $min = "0" . $min;
    }
    if ($sec < 10)
    {
      $sec = "0" . $sec;
    }

    #if the current file name is a directory indictate and then call sub
again to go into
    #current directory
    if (-d $fullFilename)
    {
      $tempDirname = substr($fullFilename, length($base));
      print test_log ("$tempDirname directory $month/$day/$year
$hr:$min\n");
      print("..");
      CheckFiles($base, $fullFilename);
      next;
    }

    $tempFilename = substr($fullFilename, length($base));
    print test_log ("$tempFilename $size $month/$day/$year $hr:$min\n");


  }
  print(".");
}







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

Date: 14 Jan 1998 13:56:57 -0500
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Why would stat return 12/31/69
Message-Id: <69j1pp$1gc$1@stok.co.uk>

In article <34BCE282.65715E9A@sam.on-net.net>,
David J. Boyd <djboyd@sam.on-net.net> wrote:
>Anyone know why the stat function would return a date of 12/31/69 with a
>time
>of 19:00 on a file or directory.
>

Maybe 'cos you're getting a 0 mtime for some reason , if you add 5 hours
to the time to account for the 5 hours between New York's (US) time zone
and Bristol's time zone (UK) then that might be 0:0:0 on 1/1/1970 which is
the uniz epoch.  Have you checked whether you get a list or a null list
back from the stats?  One way to do it is

  if (@stat = stat ($fullFileName)) {
    $mtime = $stat[9];
    ...
  }
  else {
    ... $! may have some info in it...
  }

Hope this helps,

Mike

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


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

Date: 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 1638
**************************************

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