[7960] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1584 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 5 21:17:31 1998

Date: Mon, 5 Jan 98 14:01:37 -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, 5 Jan 1998     Volume: 8 Number: 1584

Today's topics:
     Re: MultiDimensional array. Simple one (M.J.T. Guy)
     Re: MultiDimensional array. Simple one <kompas@galaxy.uci.agh.edu.pl>
     Re: MultiDimensional array. Simple one (M.J.T. Guy)
     Re: need help with pattern match <Brian.Ewins@gssec.bt.co.uk>
     Re: NT cgi query <allaires@ctcdist.com>
     Oraperl / DBD / Perl5 Performance for Oracle query? (Mark Kornfein)
     Re: Oraperl / DBD / Perl5 Performance for Oracle query? <Steve_Kilbane@cegelecproj.co.uk>
     perl manipulation of dbf(dBASE) or db(Paradox) files? <don@marinelab.sarasota.fl.us>
     PERL: How do I overwrite output? <poohba@io.com>
     Re: PERL: How do I overwrite output? (Clay Irving)
     Re: PERL: How do I overwrite output? <jarkko.hietaniemi@research.nokia.com>
     Re: PERL: How do I overwrite output? (brian d foy)
     Re: PERL: How do I overwrite output? <ludlow@us.ibm.com>
     Re: PERL: How do I overwrite output? <rootbeer@teleport.com>
     Re: PERL: How do I overwrite output? (Mike Stok)
     Re: PERL: How do I overwrite output? (Chip Salzenberg)
     Re: PERL: How do I overwrite output? <gmarzot@baynetworks.com>
     Re: PERL: How do I terminate a session? (Jonathan Feinberg)
     Re: PERL: How do I terminate a session? <rootbeer@teleport.com>
     Re: Processnumber $$ on NT (Keith Willis)
     Re: Putting a Caret in My Unix Prompt Capitalizes the N <jdporter@min.net>
     Re: require not working (Honza Pazdziora)
     Re: require not working <joseph@5sigma.com>
     Re: require not working (Mark)
     Run-time naming of packages: possible? <rgw@star.le.ac.uk>
     Re: Run-time naming of packages: possible? <jstern@world.northgrum.com>
     serious post about gmtime and year-1900 (was Re: Perl n <Russell_Schulz@locutus.ofB.ORG>
     Re: serious post about gmtime and year-1900 (was Re: Pe (Chris Nandor)
     Using shell aliases from within Perl scripts, question. (Philip R Ventura)
     Re: word wrap routine <brian@criticalpath.net>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 5 Jan 1998 16:44:01 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: MultiDimensional array. Simple one
Message-Id: <68r2kh$aie$1@lyra.csx.cam.ac.uk>

Arun  <rarun@geocities.com> wrote:
>Hello all,
>
>I am querying the database which returns me multiple records.
>I am trying to insert these values into a array, each element of which
>contains a record.
>
> while ( ($cs_list[0], $cs_list[1], $cs_list[2],
>      $cs_list[3], $cs_list[4], $cs_list[5],
>     $cs_list[6], $cs_list[7], $cs_list[8]) = &ora_fetch($csr))
>     {
>       push @cs_array,[@cs_list];
>    }

Ouch!   That would look much clearer as

  while ( ($cs_list[0..8]) = &ora_fetch($csr))
      {  
        push @cs_array,[@cs_list];
     }

or (assuming there aren't intended to be more elements in the array)

  while ( @cs_list = &ora_fetch($csr))
      {  
        push @cs_array,[@cs_list];
     }

>My problem is how do I access each element of @cs_array for further
>manipulation?

Each element of @cs_array, such as $cs_array[0], is an array reference.
You can dereference it in several ways:

    @{$cs_array[0]}           gets you the whole array
    ${$cs_array[0]}[2]        gets you element 2 of the array
    $cs_array[0]->[2]         so does this, which can be elided to
    $cs_array[0][2]
    $#{$cs_array[0]}          gets the index of the largest element

For more background,   perldoc perlref   and    perldoc perldsc.


Mike Guy


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

Date: 5 Jan 1998 18:00:04 +0100
From: Piotr Piatkowski <kompas@galaxy.uci.agh.edu.pl>
Subject: Re: MultiDimensional array. Simple one
Message-Id: <68r3ik$a1d$1@galaxy.uci.agh.edu.pl>

M.J.T. Guy <mjtg@cus.cam.ac.uk> wrote:

: Ouch!   That would look much clearer as

:   while ( ($cs_list[0..8]) = &ora_fetch($csr))
             ^^^^^^^^^^^^^^
             Did you mean @cs_list[0..8]? :-)

-- 
Piotr Pi1tkowski, Uczelniane Centrum Informatyki, AGH Krakow, POLAND


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

Date: 5 Jan 1998 17:54:14 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: MultiDimensional array. Simple one
Message-Id: <68r6o6$e6i$1@lyra.csx.cam.ac.uk>

ke GuyPiotr Piatkowski  <kompas@galaxy.uci.agh.edu.pl> wrote:
>M.J.T. Guy <mjtg@cus.cam.ac.uk> wrote:
>
>: Ouch!   That would look much clearer as
>
>:   while ( ($cs_list[0..8]) = &ora_fetch($csr))
>             ^^^^^^^^^^^^^^
>             Did you mean @cs_list[0..8]? :-)

Oops.   Yes, of course.   The version with the $ would do something
_very_ obscure.





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

Date: 05 Jan 1998 18:51:31 +0000
From: Brian Ewins <Brian.Ewins@gssec.bt.co.uk>
Subject: Re: need help with pattern match
Message-Id: <y1uhg7idaa4.fsf@gssec.bt.co.uk>

Dave Neuer <smoothie@spiritone.com> writes:

> I've written a Perl script which takes user input from a form and
> formats the content then adds it to an existing web page.  I am trying
> to modify it so that it checks to see if the email address and homepage
> URL the user entered appear to be valid so that I don't end up with
> broken links on my page.  The email portion works great, but so far the
> URL portion doesn't work at all.
> 
> Here is the code:
[snip]
> 
> #test to see if $page appears to be a valid URL,
> #set $page_link accordingly DOESN'T WORK YET
> 
> if ($page !~ m!^[(http://.+) | (www.*)]\..+\..{2,3}\/.+!) {
>  $page_link = "unknown";
> } elsif ($page !~ m{^http://.+}) {
>  $page_link = '<a href="http//' . $page . "\">$page</a>";
> } else { $page_link = '<a href="' . $page . "\">$page</a>"; }
> 

Others have pointed out the possible garbage that could get put in
here which won't work, but you also don't do the Right Thing with
relative URLs. You shouldn't add just http://  - you should be adding
the server in there too, and possibly some relative path.

Consider also, that other protocols are valid, not just http - 
I'm thinking here of (at least) ftp,news, and even 'about' under
netscape (and 'cookie' under emacs-w3)

As others have pointed out the answers are in the LWP module, but
here's a quick bash looking at RFC 1738:
(the RFC can be found at, eg
http://rfc.fh-koeln.de/rfc/html/rfc1738.html
)

#         scheme.............  alpha    digit safe    extra           escape
$page=~m!([A-Za-z+.-]+:)?([A-Za-z]|[0-9]|[\$_.+-]|[\!\*\'\(\)\,]|(%[0-9a-
fA-F][0-9a-fA-F])|[\;\/\?\:\@\&\=])*$!s 
	or $page="unknown";
#................ reserved.       don't be fooled by newlines!

(taken from section 5, using the generic url scheme. I've written the
above to follow the original definition closely, but its slightly more
compact in perl as:

#                         Using ascii ranges...
$page=~m!([A-Za-z+.-]+:)?([\!\$\&-\;\=\?-Z_a-z]|(%[0-9a-fA-F]{2}))*$!s
	or $page="unknown";

Note that it is unsafe to use \w to check for alphanumerics as what
that actually matches depends on your locale, and thus may not match
the RFC.

The above pattern will reject URLs containing fragment marks (#) but
actually pretty much anything is legal after these marks.  A
conservative thing to do would be to add (#[A-Za-z0-9_]+)? after the
last * in the pattern. The definition use the 'NAME' attribute in HTML
implies the pattern could be (#[^"]*)? (since we cannot guess the
character encoding of the target document, and NAME is CDATA) but this
is would allow 'unsafe' URLs. If you don't know why I'm saying this is
unsafe, you should read this document now:
ftp://ftp.cert.org/pub/tech_tips/cgi_metacharacters

While all this is academically interesting, you probably want to
restrict yourself to IP-based URLS (the ones with the // after
the first :). The regexp involved here is longer but no more complex.

A much better plan is to use a web page validation tool regularly, since
even links which are right now can and do disappear. Take a look on
Yahoo, they're two a penny.

	HTH

		Baz.

-- 
****====----                                              Brian Ewins. 
Fax: (44) 141 220 6100                          Tel: (44) 141 220 6121
 "It's time we face reality, my friends...
      We're not exactly rocket scientists." --Gary Larson ----====****


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

Date: Mon, 5 Jan 1998 10:12:21 -0600
From: "Scott Allaire" <allaires@ctcdist.com>
Subject: Re: NT cgi query
Message-Id: <68r0ut$ne2$1@darla.visi.com>

greg@unibiz.net wrote in message <883424387.1036320769@dejanews.com>...
>Trying to use a HREF tag in html to access a cgi script with a query
>string on an NT server -- NT ignores the question mark separating the cgi
>script from the query string and returns a cgi error.  Any hints?
>
><A HREF="links.pl?variableXYZ">
>
>causes:
>
>CGI Error The specified CGI application misbehaved by not returning a
>complete set of HTTP headers. The headers it did return are:
>
>Can't open perl script "C:\Perl\bin\links.plvariableXYZ": No such file or
>directory

You need to tell IIS how to handle files that end in a '.pl'.  Using regedit
or regedt32, create a new string value in
'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC\Parameters\Scrip
t Map' called '.pl' and set the value to the program that should deal with
those types of files.  Mine is set to 'd:\perl\bin\perl.exe %s %s'.

There should be an easier way to do this.

allaires@ctcdist.com





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

Date: 5 Jan 1998 17:04:59 GMT
From: kornfein@.crd.ge.com (Mark Kornfein)
Subject: Oraperl / DBD / Perl5 Performance for Oracle query?
Message-Id: <68r3rr$6hv$1@rdsunx.crd.ge.com>


I've recently come on board a web project that uses the Oraperl emulation 
interface for DBD. The performance is horrible, a query that returns in 4-5
seconds from sqlplus takes 50 seconds, This is just to do the "fetch"
without calling any cgi scripts.

The documentation hints at a "cache value" that one can set but then
goes on to say that it  not implemented yet. I should point out that the
query is trival and just brings back a lot (about 1000) small rows (1 field)
from Oracle. 

I think we are using the latest version of the emulation (I think DBD version 0.90).


Any ideas? 
Is this a known problem with the DBD - Oraperl emulation?
Any workarounds?

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                         




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

Date: Mon, 05 Jan 1998 17:47:10 GMT
From: Steve Kilbane <Steve_Kilbane@cegelecproj.co.uk>
Subject: Re: Oraperl / DBD / Perl5 Performance for Oracle query?
Message-Id: <157ce$112fa.26a@news.cegelecproj.co.uk>

In article <68r3rr$6hv$1@rdsunx.crd.ge.com>, kornfein@.crd.ge.com (Mark Kornfein) writes:
> 
> I've recently come on board a web project that uses the Oraperl emulation 
> interface for DBD. The performance is horrible, a query that returns in 4-5
> seconds from sqlplus takes 50 seconds, This is just to do the "fetch"
> without calling any cgi scripts.

Is that *just* the fetch, or are you looking at Perl invocation,
parsing, connection to Oracle, the query opening, and then the
fetch? Usually, the time is in the connection to Oracle, and the
README for DBD::Oracle gives some hints and tips on that.
For example, are you using SQL*Net, and if so, do you actually
need to?

Also, are you running them on a level playing-field? Do repeated
invocations of the queries return a consistent discrepancy between
the two methods, or are you losing a lot while Oracle loads its
cache?
-- 
<Steve_Kilbane@cegelecproj.co.uk> - All opinions are mine alone.
Kilbane's law of integration: standardise on protocols and file
formats, and the applications take care of themselves.



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

Date: Mon, 5 Jan 1998 14:36:25 -0500
From: Don Hayward <don@marinelab.sarasota.fl.us>
Subject: perl manipulation of dbf(dBASE) or db(Paradox) files?
Message-Id: <Pine.GSO.3.96.980105142102.15091D-100000@orcinus.mote.org>

I'm looking for perl modules to read, write, etc. (dbf) dBASE and (db)
Paradox files.  Thanks for any help.

Don Hayward			don@mote.org
Mote Marine Laboratory		Voice: 941.388.4441
1600 Ken Thompson Parkway	Fax: 941.388.4312
Sarasota, FL 34236		See: http://www.mote.org
Independent, non-profit, marine and estuarine research and education facility. 
For PGP public key do: finger don@ajaia.mote.org or http://www.mote.org/~don
require "disclaimer.pl"; # We run Linux
Taxes feed the starving and clothe the naked.



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

Date: Mon, 5 Jan 1998 11:48:47 -0600
From: Chocolate <poohba@io.com>
Subject: PERL: How do I overwrite output?
Message-Id: <Pine.BSI.3.96.980105114552.24901B-100000@pentagon.io.com>

I have this program that counts down.  It goes like this

for($i=10; $i>0; $i--) {
	print "\a";
	print "$i\n";
	sleep(2);
}

What it does is this:
10
9
8
etc.

How do I make it so that it just puts the 9 where the 10 is and the 8
where the 9 is etc?  Is this possible?



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

Date: 5 Jan 1998 10:56:06 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: PERL: How do I overwrite output?
Message-Id: <68qvqm$qfo@panix.com>

In <Pine.BSI.3.96.980104184409.21690A-100000@bermuda.io.com> Chocolate <poohba@io.com> writes:

>Is it possible to overwrite the output with the new output?  Like if I
>wanted to do a count down can I have it so that it starts with 10 and then
>the 9 replaces the ten instead of going next to it or below it.  Is this
>possible?

Like open the file and read the data, close the file, increment the variable,
open the file for writing (destroying the contents of the file), and write
the new value?

-- 
Clay Irving <clay@panix.com>                  I think, therefore I am. I think? 
http://www.panix.com/~clay/


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

Date: 05 Jan 1998 18:01:58 +0200
From: Jarkko Hietaniemi <jarkko.hietaniemi@research.nokia.com>
Subject: Re: PERL: How do I overwrite output?
Message-Id: <dpu3bi7vux.fsf@koah.research.nokia.com>


Chocolate <poohba@io.com> writes:

> Is it possible to overwrite the output with the new output?  Like if I
> wanted to do a count down can I have it so that it starts with 10 and then
> the 9 replaces the ten instead of going next to it or below it.  Is this
> possible?

This has nothing to do with Perl.  This has to do with your display device,
how does one `overwrite' in it.

Assuming

	your display device is a character terminal

AND assuming

	it obeys "\r" as a `carriage return'

you could try for example tricks like the following:

use IO::Handle qw(autoflush);
autoflush STDOUT 1;		# The counter becomes immediately visible.

sub print_count_down {
    my $counter = shift;
    my $clear;
    return sub {			# return a closure: see perlref.
	print "$clear\r" if defined $clear;
	print "$counter\r";
        $clear = " " x length($counter);
	$counter--;
    }
}

my $a = print_count_down(10000);

for (1..10000) {
    &$a;
}

-- 
Jarkko Hietaniemi


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

Date: Mon, 05 Jan 1998 11:59:22 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: PERL: How do I overwrite output?
Message-Id: <comdog-ya02408000R0501981159220001@news.panix.com>
Keywords: from just another new york perl hacker

In article <Pine.BSI.3.96.980104184409.21690A-100000@bermuda.io.com>, Chocolate <poohba@io.com> posted:

>Is it possible to overwrite the output with the new output?  Like if I
>wanted to do a count down can I have it so that it starts with 10 and then
>the 9 replaces the ten instead of going next to it or below it.  Is this
>possible?

depends.  where is this output going to?

-- 
brian d foy                                  <comdog@computerdog.com>
Fifth Avenue Disaster! <URL:http://computerdog.com/brian/fire/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Mon, 05 Jan 1998 10:43:29 -0600
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: PERL: How do I overwrite output?
Message-Id: <34B10DB1.1938@us.ibm.com>

Clay Irving wrote:
> 
> In <Pine.BSI.3.96.980104184409.21690A-100000@bermuda.io.com> Chocolate <poohba@io.com> writes:
> 
> >Is it possible to overwrite the output with the new output?  Like if I
> >wanted to do a count down can I have it so that it starts with 10 and then
> >the 9 replaces the ten instead of going next to it or below it.  Is this
> >possible?
> 
> Like open the file and read the data, close the file, increment the variable,
> open the file for writing (destroying the contents of the file), and write
> the new value?

Hmmm... I think he means to the screen.  If so one way to do it is to
use \r to give you a carriage return, but not a newline.  For example:

#!/usr/bin/perl -w
for($i=10;$i>=0;$i--) {
    print "$i \r";
    # pause
    for ($j=0;$j<100000;$j++){}
}

This is an extremely basic example, so it may not cover everything you
wanted, but then again, your question wasn't very specific either. ;) 
Note: The space after the $i in the print statement is just there to
erase the 0 that comes with the printed "10".  I'm sure that it could be
done better using some sort of formatted output.

--
James Ludlow (ludlow@us.ibm.com)
This isn't tech support, and all opinions are my own.


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

Date: Mon, 5 Jan 1998 09:43:15 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Chocolate <poohba@io.com>
Subject: Re: PERL: How do I overwrite output?
Message-Id: <Pine.GSO.3.96.980105094215.26455C-100000@user2.teleport.com>

On Sun, 4 Jan 1998, Chocolate wrote:

> Is it possible to overwrite the output with the new output?  

Sounds as if you want to use the Curses module (or something similar).
Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 5 Jan 1998 12:59:01 -0500
From: mike@stok.co.uk (Mike Stok)
Subject: Re: PERL: How do I overwrite output?
Message-Id: <68r715$26b$1@stok.co.uk>

Maybe something like might help:

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

$| = 1;

for ($i = 10; $i > 0; $i--) {
  print "\a$i";
  sleep (2);
  for ("\b", ' ', "\b") {
    print $_ x length ($i);
  }
}

Hope this helps,

Mike

In article <Pine.BSI.3.96.980105114552.24901B-100000@pentagon.io.com>,
Chocolate  <poohba@io.com> wrote:
>I have this program that counts down.  It goes like this
>
>for($i=10; $i>0; $i--) {
>	print "\a";
>	print "$i\n";
>	sleep(2);
>}
>
>What it does is this:
>10
>9
>8
>etc.
>
>How do I make it so that it just puts the 9 where the 10 is and the 8
>where the 9 is etc?  Is this possible?
>


-- 
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: Mon, 05 Jan 1998 18:35:06 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: PERL: How do I overwrite output?
Message-Id: <68r93f$t68$1@cyprus.atlantic.net>

According to Chocolate <poohba@io.com>:
>for($i=10; $i>0; $i--) {
>	print "\a";
>	print "$i\n";
>	sleep(2);
>}

Forget the "\a" and change the "\n" to "\r".  That will probably work.
Oh, and be sure to set  $| = 1  first.
-- 
Chip Salzenberg               - a.k.a. -               <chip@pobox.com>
** Perl Training from Stonehenge Consulting Services: (503) 777-0095 **
                 "Prepare to jettison the core!"
         "We don't have a core!  We're all gonna die!"  // MST3K


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

Date: 05 Jan 1998 13:45:59 -0500
From: Joe Marzot <gmarzot@baynetworks.com>
Subject: Re: PERL: How do I overwrite output?
Message-Id: <pdoh1qkbdk.fsf@baynetworks.com>

Chocolate <poohba@io.com> writes:

> 
> Is it possible to overwrite the output with the new output?  Like if I
> wanted to do a count down can I have it so that it starts with 10 and then
> the 9 replaces the ten instead of going next to it or below it.  Is this
> possible?
> 
from memory (?)

$|=1;
for ($i=10;$i;$i--) {
    print "\r$i ";
    sleep(1);
}
print "\nBOOM!\n";

-GSM

-- 
 G. S. Marzot <gmarzot@baynetworks.com>   Network Management Development
 Bay Networks Inc.                        (508)670-8888 x63990
--


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

Date: Mon, 5 Jan 1998 11:30:10 -0500
From: jdf@pobox.com (Jonathan Feinberg)
Subject: Re: PERL: How do I terminate a session?
Message-Id: <MPG.f1ad49d21fdb239896a7@news.concentric.net>

[This followup was posted to comp.lang.perl.misc and a copy was sent to the cited author.]

poohba@io.com said...
> I am on a unix machine.  It is also an Apache server if that makes any
> difference.  I now have it set up so that I type done and it does a couple
> of things before I can close out.  I then want it to log out without
> having to go back to the prompt and type logout.  How would I do this?

Hmm.  Perhaps if you were to post your question on one of the newsgroups
that concerns unix, you'll get an answer.

-- 
Jonathan Feinberg    jdf@pobox.com    Sunny Brooklyn, NY


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

Date: Mon, 5 Jan 1998 09:47:20 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Chocolate <poohba@io.com>
Subject: Re: PERL: How do I terminate a session?
Message-Id: <Pine.GSO.3.96.980105094353.26455D-100000@user2.teleport.com>

On Sun, 4 Jan 1998, Chocolate wrote:

> I am on a unix machine.  It is also an Apache server if that makes any
> difference.  I now have it set up so that I type done and it does a couple
> of things before I can close out.  I then want it to log out without
> having to go back to the prompt and type logout.  How would I do this?

There's nothing Perl-specific in this question. (That is, nothing would be
any different in this answer if everything you were using were written in
C, or in any other suitable language.) But if the program you've written
as 'done' can send signals, it could kill its parent process when it's
finished. Not the usual behavior, but that could be done. It might be
better to run it as 'exec done'. Check with a newsgroup about Unix for
more info. Hope this helps! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Mon, 05 Jan 1998 16:49:08 GMT
From: keith_willis.junk@non-hp-unitedkingdom-om1.om.hp.com (Keith Willis)
Subject: Re: Processnumber $$ on NT
Message-Id: <34b50bbd.1226653204@readnews.bbn.hp.com>

On 5 Jan 1998 14:58:25 GMT, "Bjxrn Elstad" <bjorn.elstad@sds.no>
wrote:

>Temporary files are often created as
>
>  open (FU, ">xxx.$$");
>
>On NT the process number is not unique. 
>Microsoft Information Server starts perl processes with same
>process number.
>Is there a recommended method on NT?

Use IO::File::new_tmpfile() instead.

----------------------------------------------------------------------
The above message reflects my own views, not those of Hewlett Packard.
When emailing me, please note that there is no '.junk' in my address.


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

Date: Mon, 05 Jan 1998 12:19:26 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Putting a Caret in My Unix Prompt Capitalizes the Next Character
Message-Id: <34B1161E.1075@min.net>

Dave Barnett wrote:
> 
> I'm using tcsh.  I'm able to get "a^g:" as the prompt by changing your
> print statement to print "a\\^g".  This seems to work because Perl
> expands the first \, and passes "a\^g" to the shell.  The shell then
> expands the \, leaving a^g.
> 
> BTW, I think it is the xterm window (rather than the shell (or in
> addition to it?)) intercepting the ^g characters....?

The "problem" is definitely with tcsh.
Csh (at least the one on my Solaris machine) does the "right" thing.
Dave's suggestion, above, fixes on tcsh and breaks on csh.

John Porter
jporter@logicon.com


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

Date: Mon, 5 Jan 1998 17:39:21 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: require not working
Message-Id: <adelton.884021961@aisa.fi.muni.cz>

gt2863a@acmey.gatech.edu (Mark) writes:

> However, the program does not work, if I comment out the require
> line then everything works fine (except I can't call my sub). 
> I assure you that the sub is there and is returning a positive value (1;)
> 
> What could possibly be wrong???????

Are you running with -w and use strict?

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

Date: Mon, 05 Jan 1998 11:19:46 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: require not working
Message-Id: <34B123A6.5DD42A72@5sigma.com>

You could be a little more specific.  For example, HOW is it
not working?

	-joseph

Mark wrote:
> 
> unshift (@INC, "L:\\scripts\\mec\\subs");
> require ("test_too.pl");
> 
> I am using this code to get to my test_too.pl subroutine.
> 
> However, the program does not work, [...]c


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

Date: 5 Jan 1998 18:46:54 GMT
From: gt2863a@acmey.gatech.edu (Mark)
Subject: Re: require not working
Message-Id: <68r9qu$9ut@catapult.gatech.edu>

: unshift (@INC, "L:\\scripts\\mec\\subs");
: require ("test_too.pl");

: I am using this code to get to my test_too.pl subroutine.

: However, the program does not work, if I comment out the require
: line then everything works fine (except I can't call my sub). 
: I assure you that the sub is there and is returning a positive value (1;)

Okay I am hitting a NT server and the script is "not working" in the
fact that it simply returns "Document contains no data"

Please help

--
mec --gt2863a
 


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

Date: Mon, 05 Jan 1998 13:20:17 +0000
From: Richard West <rgw@star.le.ac.uk>
Subject: Run-time naming of packages: possible?
Message-Id: <34B0DE11.53F60680@star.le.ac.uk>

Hi,

Does anybody know if (and/or how) it's possible to name a module at
run-time (or should that be load-time)? I want to do something like
this...

sub load_module {
    my $class=shift;

    eval {
	package $class;
	require "$class.pm";
    };
}

but perl barffs at the package statement. Is there any other way to set
the default namespace? I've looked in the Camel and the Black Cat and
can't find anything.

PS. Please don't ask _why_ I want to do this...it's related to anal
retentiveness.

Cheers,

Richard.

-- 
*-----------------------------------------------------------------------------*
 Dr Richard West                                   Internet:
rgw@star.le.ac.uk
 Department of Physics & Astronomy, University of Leicester, Leicester
LE1 7RH
*-----------------------------------------------------------------------------*


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

Date: Mon, 5 Jan 1998 21:19:31 GMT
From: Jim Stern <jstern@world.northgrum.com>
Subject: Re: Run-time naming of packages: possible?
Message-Id: <34B14E63.41C6@world.northgrum.com>

Richard West wrote:
> 
> Hi,
> 
> Does anybody know if (and/or how) it's possible to name a module at
> run-time (or should that be load-time)? I want to do something like
> this...
> 
> sub load_module {
>     my $class=shift;
> 
>     eval {
>         package $class;
>         require "$class.pm";
>     };
> }
> 
> but perl barffs at the package statement. [...]

You're close but use eval's string form instead:

	#!/usr/local/bin/perl -w
	use strict;
	my $class = 'C';
	eval <<EOF;
	package $class;
	sub sample {print "success.\n"}
	1;
	EOF

	&C::sample;

Notice that Perl reverts to the original namespace after the
eval ends so all code that belongs in package C should appear
within the eval.

You may find

	eval <<EOF1 . <<'EOF2';

useful.  Variable references inside the EOF1 block will be expanded
prior to the eval's execution; those inside the EOF2 block will
be expanded by the eval itself.

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


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

Date: Mon, 5 Jan 1998 13:46:03 +0000
From: Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
Subject: serious post about gmtime and year-1900 (was Re: Perl not Y2K compliant)
Message-Id: <19980105.134603.8Z6.rnr.w164w_-_@locutus.ofB.ORG>

Randal Schwartz <merlyn@stonehenge.com> writes:

> And how do people read the docs, but *not* read the docs?

personally, I'd guess that it's not just misreading, but also mistrust.
it's HEALTHY to mistrust anything that returns `98'.  why not `1998'?

I think this is an even bigger blunder than leaving the `e' off `creat'.
-- 
Russell_Schulz@locutus.ofB.ORG  Shad 86c


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

Date: Mon, 05 Jan 1998 16:03:07 -0500
From: pudge@pobox.com (Chris Nandor)
Subject: Re: serious post about gmtime and year-1900 (was Re: Perl not Y2K compliant)
Message-Id: <pudge-0501981603080001@ppp-9.ts-1.kin.idt.net>

In article <19980105.134603.8Z6.rnr.w164w_-_@locutus.ofB.ORG>, Russell
Schulz <Russell_Schulz@locutus.ofB.ORG> wrote:

# Randal Schwartz <merlyn@stonehenge.com> writes:
# 
# > And how do people read the docs, but *not* read the docs?
# 
# personally, I'd guess that it's not just misreading, but also mistrust.
# it's HEALTHY to mistrust anything that returns `98'.  why not `1998'?

Fine, mistrust it.  But you can always check it out for yourself, can't you?

$year = 60 * 60 * 24 * 365;
@time = localtime(time() + $year * 3);
print $time[5];

Returns (as of Thursday): 101

--
Chris Nandor               pudge@pobox.com           http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])
#==                    MacPerl: Power and Ease                     ==#
#==    Publishing Date: Early 1998. http://www.ptf.com/macperl/    ==#


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

Date: 5 Jan 1998 19:45:19 GMT
From: pventura@cs.buffalo.edu (Philip R Ventura)
Subject: Using shell aliases from within Perl scripts, question.
Message-Id: <68rd8f$k7s$1@prometheus.acsu.buffalo.edu>


I have several aliases setup in my .cshrc file.  The shell I use is
tcsh.  I am trying to write a Perl script which will be able to use
the aliases defined in the .cshrc file simply calling them, but to no
avail.  When I run something like the following:

   print <<`EOC`;
alias
EOC

My aliases are not shown.  What do I need to do?

-- 
Phil Ventura			  phone:  645-3772
Teaching Assistant CS305	  email:  pventura@cs.buffalo.edu
Dept. Computer Science		  office: Trailer B
SUNY at Buffalo			  http://www.cs.buffalo.edu/~pventura


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

Date: Mon, 05 Jan 1998 08:48:38 -0800
From: Brian Moseley <brian@criticalpath.net>
To: jcotton@erols.com
Subject: Re: word wrap routine
Message-Id: <34B10EE6.4038B0A@criticalpath.net>

Opinion #3: stick with COBOL.

> Opinion #1.  Could anyone now supply a set of functions to format
> strings, so I do not need to use squiggles and slashes in my code
> =~s/u/c/k/s.  I could be so much more productive that way.
> 
> Opinion #2.  Perl is a language which took all the bad parts of C and
> made them even worse.

-- 

* brian moseley *
{ perl warrior | agent of chaos => critical path }


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

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

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