[15852] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3265 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 6 14:10:56 2000

Date: Tue, 6 Jun 2000 11:10:32 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <960315032-v9-i3265@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 6 Jun 2000     Volume: 9 Number: 3265

Today's topics:
        How to set an arguments to the environment <kennylim@techie.com>
        Installing Active Perl on a different drive <juliopNOjuSPAM@email.com.invalid>
    Re: Installing Active Perl on a different drive <andersen+@rchland.ibm.com>
    Re: Inverse video? <tony_curtis32@yahoo.com>
    Re: Inverse video? <Jonathan.L.Ericson@jpl.nasa.gov>
    Re: IP/port check help wanted scarey_man@my-deja.com
    Re: IP/port check help wanted <sariq@texas.net>
    Re: list array contains perl functionality nobull@mail.com
    Re: making the source unreadable (Csaba Raduly)
    Re: module for MsAccess database? <mr.soetjianto@mail.tju.edu>
    Re: Multiple Threads Running Perl via Shared Lib - Poss <dan@tuatha.sidhe.org>
    Re: Multiple Threads Running Perl via Shared Lib - Poss (Elliot Finley)
    Re: Newbie: counter sometimes resets (Yan Bilik)
    Re: Newbie~~Please Help !!!!!!!!! <abe@ztreet.demon.nl>
        Perl and PDF Files 572_dex@my-deja.com
    Re: perl editor for linux (Csaba Raduly)
    Re: Perl gurus: help a C++ programmer optimize his ways <abe@ztreet.demon.nl>
    Re: Perl gurus: help a C++ programmer optimize his ways <michael.schlueter@philips.com>
    Re: Perl gurus: help a C++ programmer optimize his ways (Abigail)
    Re: PERL JOBS =?iso-8859-1?Q?=28=A340k+=29?= (David H. Adler)
        PerlMud and Win32 <spragg@cs.ucdavis.edu>
        PLEASE HELP: Perl for WWW <jeniNOjeSPAM@hotbot.com.invalid>
    Re: PLEASE HELP: Perl for WWW <blah@nospam.com>
    Re: PLEASE HELP: Perl for WWW <jeniNOjeSPAM@hotbot.com.invalid>
    Re: PLEASE HELP: Perl for WWW <red_orc@my-deja.com>
    Re: please?? nobull@mail.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 6 Jun 2000 10:29:43 -0700
From: "Kenny Lim" <kennylim@techie.com>
Subject: How to set an arguments to the environment
Message-Id: <zwa%4.35008$5k2.58121@dfw-read.news.verio.net>



Hi All,

It would be greatly appreciated if anyone can advise me or provide a sample
as to how I can achieve the following objective..

(a) Parse an argument from script A to script B ?

If this is not possible.....

(b) How to set to the environment variables for each shell being invoked.
     (There would be multiple shell being invoked from the first script to
the second
     and I would like to ensure that each shell being invoked has the
argument
     set to the environment)

#Tried system (..) and so far, had not much luck yet.

ps: Please let me know if you need more explicit information.

Thanks in advance !

Kenny-

#Snippets of my code.

#========
# Script A #
# ========================================================================
sub RunProcess
{
 my $ProcessObj;

 #print "Cmd = $Cmd\n";
 chomp($Cmd);

    #cheesy way to simulate a fork in NT.
 # note: the programatic way to get the cmd.exe path doesn't work. (?)
 Win32::Process::Create($ProcessObj,
  $Cmd,
  cmd /c perl
RunAllSql2.pl -S$connect_string -U$user_name -P$password -N$number_rows",
# There would be multiple shell being invoked and I would like
            to parse the login argument and to add the number of rows
            to be populated to the second script.
  0,
  NORMAL_PRIORITY_CLASS,
  ".")|| die ErrorReport();

 #$ProcessObj->Suspend();
 #$ProcessObj->Resume();
 #$ProcessObj->Wait(INFINITE);
}

#===========================================================================
=


#========
# Script B #
#===========================================================================
=

my $dbh = DBI->connect(
  "dbi:Oracle:$connect_string", $user_name, $password )
   || die "Can't connect to $Data_source: $DBI::errstr";

#===========================================================================
=

my $insert = ("insert into loop values (loopseq.NEXTVAL, 'a','b','c','d')");

my $i;
for ( $i = 0; $i < $number_rows; ++$i )
{

my $sth = $dbh->do("$insert")
                or die "Couldn't prepare statement: " . $dbh->errstr;

};
        $dbh->disconnect;

print "\n\n\nSession Completed..\n\n\n";

============================================================================
====













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

Date: Tue, 06 Jun 2000 08:28:04 -0700
From: JulioP <juliopNOjuSPAM@email.com.invalid>
Subject: Installing Active Perl on a different drive
Message-Id: <13c5af1a.2b0db6af@usw-ex0102-015.remarq.com>

I was asked to install Active Perl on one of our web server. The
problem is that they don't want anything installed on drive c:\,
any new installations are to go in drive d:\. When I run the
Active Perl installer it automatically installs it on c:\perl\
and add the line to the windows path and the makes some changes
to the registry (I think). Now, can I just move the folder
(c:\perl\) to d:\?? if so, what changes do I have to make to the
registry??

Thanks!


* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



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

Date: Tue, 06 Jun 2000 11:45:45 -0500
From: "Paul R. Andersen" <andersen+@rchland.ibm.com>
Subject: Re: Installing Active Perl on a different drive
Message-Id: <393D2AB9.B9EC3282@rchland.ibm.com>

JulioP wrote:
> 
> I was asked to install Active Perl on one of our web server. The
> problem is that they don't want anything installed on drive c:\,
> any new installations are to go in drive d:\. When I run the
> Active Perl installer it automatically installs it on c:\perl\
> and add the line to the windows path and the makes some changes
> to the registry (I think). Now, can I just move the folder
> (c:\perl\) to d:\?? if so, what changes do I have to make to the
> registry??
> 
All the times I have installed it I have been able to change the install
location.  It does default to C: but that is normal, hit Browse and
change it. 
-- 
Paul Andersen
-- I can please only ONE person per day.
-- Today is NOT your day.
-- Tomorrow isn't looking good either.


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

Date: 06 Jun 2000 10:08:55 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Inverse video?
Message-Id: <87aegyj188.fsf@limey.hpcc.uh.edu>

>> On Mon, 05 Jun 2000 19:39:49 GMT,
>> dont@want.spam.com (Xebeche) said:

> Perhaps this is a dumb question, but I'm a newbie so I
> don't know any better: how (if possible) do you write to
> STDOUT in reverse video? I need to highlight some info
> in my listings...

    use Term::ANSIColor qw(:constants);
    $Term::ANSIColor::AUTORESET = 1;
    print REVERSE "This is in reverse\n";

perldoc Term::ANSIColor, avaialble from CPAN.

hth
t
-- 
"Trying is the first step towards failure"
                                           Homer Simpson


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

Date: Tue, 06 Jun 2000 10:40:17 -0700
From: Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov>
Subject: Re: Inverse video?
Message-Id: <393D3781.CBEEDF3D@jpl.nasa.gov>

Xebeche wrote:
> Perhaps this is a dumb question, but I'm a newbie so I don't know any better:
> how (if possible) do you write to STDOUT in reverse video? I need to highlight
> some info in my listings...

This depends more on what STDOUT is directed to than on Perl.  If you
have an ANSI capible terminal, use Term::ANSIColor to emit the correct
escape sequences.  Use http://search.cpan.org for other modules.

Jon
-- 
Knowledge is that which remains when what is
learned is forgotten. - Mr. King


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

Date: Tue, 06 Jun 2000 16:09:22 GMT
From: scarey_man@my-deja.com
Subject: Re: IP/port check help wanted
Message-Id: <8hj7n1$675$1@nnrp1.deja.com>

Use Net::Ping from CPAN.
I posted a similar question yesterday and was pointed to this and it
worked OK.
here is an extract.
     use Net::Ping;
     $host = "10.11.12.13"     (what ever ip address you want)
     $p = Net::Ping->new();
     $retval = $p->ping($host,2);(2 = 2 second timeout if not pingable)
     $p->close();

     $retval will be 0 or 1  (0 = unsuccessful, 1 = successful)

PERL Experts please do not post messages to pick holes in my code.
It's not perfect and neither are we.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 06 Jun 2000 12:25:03 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: IP/port check help wanted
Message-Id: <393D33EF.39AB5E3D@texas.net>

scarey_man@my-deja.com wrote:
> 
> PERL 

It's Perl (the language) or perl (the interpreter).  PERL is a ticker
symbol for some company that has nothing to do with Perl.

> Experts please do not post messages to pick holes in my code.

That's a silly request.

If you make an error, and it's not corrected, how:

will *you* learn?
will the reader(s) know of the error?

Errant posts should *always* be corrected (with the arguable exception
of obvious trolls).

> It's not perfect and neither are we.

A)  Stating that "It's not perfect" implies that you are aware of
errors.  So why not correct them *before* posting?

B)  Of course we aren't.  So we shouldn't be offended when we're
corrected.

- Tom


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

Date: 06 Jun 2000 17:52:09 +0100
From: nobull@mail.com
Subject: Re: list array contains perl functionality
Message-Id: <u9r9aapxae.fsf@wcl-l.bham.ac.uk>

invinfo@my-deja.com writes:

> I am looking for a perl solution akin to java's hashtable.contains()

I've never used Java but from the name I'd guess that's equivalent to
Perl's exists() function.

> I would like to be able to use it on a list - preferably.

But that would be something else!  The exists() function operates on
hash elements.  Can you call a contains() method on an unhashed list
in Java?

> grep EXPR, LIST
>   would be ideal if I could use a scalar in EXPR.

No it wouldn't, you can

  grep $_ eq $scalar, LIST

> Is there a better solution than the following ?

[Snip foreach() loop]

Yes, the one in the FAQ.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: 6 Jun 2000 14:04:57 GMT
From: csaba_r@my-deja.com (Csaba Raduly)
Subject: Re: making the source unreadable
Message-Id: <8F4B9D382quuxi@193.82.145.131>

02 Jun 2000: A formal bug report was sent to Seti@Home, because the
following message originated from b.kappenburg@rcondw.rug.nl (Bart
Kappenburg) was reported as containing signs of intelligence: 

>Hello,
>
>How can I make the source of a perl-script unreadable? I want to
>sell a script but I don't want the buyers to see how I did it...
>

Ask Abigail to write it as a one-liner :-)
-- 
Csaba Raduly, Software Developer (OS/2), Sophos Anti-Virus
mailto:csaba.raduly@sophos.com      http://www.sophos.com/
US Support +1 888 SOPHOS 9      UK Support +44 1235 559933
Life is complex, with real and imaginary parts.


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

Date: Tue, 6 Jun 2000 11:45:46 -0400
From: "Soetjianto" <mr.soetjianto@mail.tju.edu>
Subject: Re: module for MsAccess database?
Message-Id: <8hj6gv$sg9$1@omle.tju.edu>

Can we have the Access database on Linux and use DBD::ODBC? Is there an
Access ODBC driver for Linux?




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

Date: Tue, 06 Jun 2000 15:32:58 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Multiple Threads Running Perl via Shared Lib - Possible?  Safe?
Message-Id: <KQ8%4.103100$hT2.419299@news1.rdc1.ct.home.com>

Guy Resh <gresh@earthlink.net> wrote:
>    Currently, Perl 5.6 (and 5.005_03 for that matter) can be MADE to
> support multiple concurrent threads, by either running a single
> interpreter instance with multiple threads sharing the single instance
> (i.e. configure USE_THREADS), or by using MULTIPLICITY, where each
> thread runs with it's own interpreter instance.  There are SEVERAL
> nasties here with both of the above, not the least of which:

> With USE_THREADS:
> 1) performance is less than "optimal" as there are several global
> mutexes (sv_mutex comes to mind) that kill performance.

You don't even need to get this far for performance to be bad--it's pretty
slow as it is, even with a single thread.

> 2) global variable/data access must be carefully mutexed around
> (subroutines are global!)

Definitely. The core is *not* threadsafe by itself.

> 3) there are a few instances where MT-safe versions of certain
> functions weren't implemented (localtime_r/gmtime_r come to mind).

This is arguably a Configure/C library issue--the source either should use
a macro-ized version that's #defined to the right thing, or your C libray
should behave properly when running threaded.

> With MULTIPLICITY:
> 1) as currently implemented, there is a global pointer that indicates
> which interpreter instance is currently "active", so only one thread
> can actually be running at a time, lest they stomp on one another
> #2 & #3 from USE_THREADS apply above as well...

This isn't exactly true anymore, at least not as of 5.6.0. There's a
call--PERL_SET_CONTEXT(my_perl)--that'll do it. (my_perl is supposed to be
the interpreter structure, I think. No docs for it that I can find yet)

>    I've spent the last year or so "fixing" the above (and a lot more!
> :( ) with 5.005_03 & lately 5.6, for use at work & "play", including,

> 1) eliminating the need for sv_mutex & strtab_mutexes (each thread has
> it's own "root-pool".  All SVs, HVs, etc. are now thread-centric,
> which probably goes against the current "desired" model, but it's what
> I needed for embedding Perl into an NSAPI module within Netscape
> Enterprise Server on Solaris 2.6.  I also maintain separate
> thread-centric memory blocks, so that hits to the heap are basically
> eliminated once the server is up and running a few seconds.  I can
> serve 800+ dynamic PHTML pages each second on a 4x400 SPARC 450
> (non-optimized, i.e. everything compiled with -g).

Do the threads share any data? If not, 5.6.0's MULTIPLICITY should do this
for you without needing any workarounds now.

> 2) using MT-safe C functions where appropriate (localtime_r, etc.)

> 3) moving a lot of the interpreter-centric (interpvar.h) variables
> over to the thread-centric ones (thrdvar.h) and eliminating
> PERL_OBJECT defines/code since it's being deprecated anyway.

This probably wasn't necessary with a MULTIPLICITY build, and it's not
needed for an ITHREAD build. (Which is probably the way threads are going
to move, at least once I get some free time)

> 4) with 5.6, passing a Perl context EVERYWHERE (including the memory
> management routines), eliminating the dTHR/dTHX overhead (which also
> solves the #1 problem above with MULTIPLICITY.

Did you add it into places in 5.6.0 where it wasn't passed before?

>    I'm not an "official" Perl contributor (yet) as I'm not exacly sure
> where my company stands on me turning my "MT expertise" back over into
> the PD.  If there's enough interest in others seeing what I've done, I
> may be able to convince them.  I'll also be attending the conference
> in Monterey this year and so will be able to lend assistance there as
> well if people are interested.

Well, I'll be giving a threads tutorial on Monday at TPC. Care to drop by?
:)

					Dan


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

Date: Tue, 06 Jun 2000 15:43:58 GMT
From: efinley@efinley.com (Elliot Finley)
Subject: Re: Multiple Threads Running Perl via Shared Lib - Possible?  Safe?
Message-Id: <39421bc9.37980200@news.firstworld.net>

On Tue, 06 Jun 2000 02:34:38 GMT, Guy Resh <gresh@earthlink.net>
wrote:

>   I'm not an "official" Perl contributor (yet) as I'm not exacly sure
>where my company stands on me turning my "MT expertise" back over into
>the PD.  If there's enough interest in others seeing what I've done, I
>may be able to convince them.  I'll also be attending the conference
>in Monterey this year and so will be able to lend assistance there as
>well if people are interested.

Do whatever it takes to convince them that your "MT expertise" SHOULD
go back into the PD.  After all, by using perl, you are using the
generously contributed "expertise" of others.
-- 
Elliot (efinley@efinley.com) Weird Science!


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

Date: Tue, 06 Jun 2000 16:01:41 GMT
From: fromng@pourpre.com (Yan Bilik)
Subject: Re: Newbie: counter sometimes resets
Message-Id: <393d2037.113867109@news.free.fr>

It works !
I added a "truncate" function, as I also store an IP address after the
count.
Thanks again for your help.

Yan


On Mon, 05 Jun 2000 15:47:16 GMT, bart.lateur@skynet.be (Bart Lateur)
wrote:

>Yan Bilik wrote:
>
>>open(CNTFILE, ">cnt.txt");
>>flock CNTFILE, 2;
>
>>What's wrong ??
>
>You delete the contents of the file before locking it. Besides, the
>"28000 to 29000" is coincidence. It's a matter of simultanious accesses
>with a bad file lock.
>
>You can open the file in mode "+<", do the lock, read the file,
>increment the counter, seek back to the start of the file, write the new
>value (which has equal or larger length as the original value, so
>there's no need to truncate the file), and close the file which also
>unlocks it. So you open the file only once.
>
>-- 
>	Bart.



----------------------------------------------
c h r o m a          http://pourpre.com/chroma
16 millions de couleurs, oui mais lesquelles ?
----------------------------------------------
              chroma@pourpre.com


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

Date: Tue, 06 Jun 2000 19:46:47 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Newbie~~Please Help !!!!!!!!!
Message-Id: <6jaqjsskqr7gvrmen1l0fhtru3hkleoieg@4ax.com>

On Mon, 05 Jun 2000 01:35:22 GMT, Agi <agi@feib.com.tw> wrote:

> Hello, theres,
Hi,
>    I want to split a file to lots of small files.
>    I use a while loop and chomp function, how do I keep the privious
>    line for further reference to generate a group report ??
Do you have to? You could read through the file and print only those
lines that belong in that group report.
I can imagine that this transactions file gets _big_, so you might not
be able to read it into memory all at once.
This strategie will mean that you'll have to read the whole file all
over for every group report you want.

You could also do something clever with a hash of filehandles. That
seems better, but is left as an exercise :-)

> 
>    Considering the sample data like follows,
>    ( the transactions of two accounts for customer A11111
>      and file layout as follows
>      id    type  account           date withdraw deposit  balance
>     -------------------------------------------------------------  )
> 
> 
>     A11111 0300 001-003-0001697-7 2000/05/20 100             1000
>     A11111 0300 001-003-0001697-7 2000/05/21         200     1200
That data can be split with unpack.

	my @values = unpack 'A7A5A18A11A8A8A4', $line;

The next program will print the report for account '001-003-0001697-7'.

#!/usr/bin/perl -w
use strict;

my $id = 'A11111';
my $account = '001-003-0001697-7';

print "$account ($id):\n";
printf "%-18s%6s%12s%12s\n", qw(Date Withdraw Deposit Balance);
printf "%s\n",  '-' x 50;

while ( <DATA> ) {

	my @values = unpack 'A7A5A18A11A8A8A4', $_;
	
	next unless $values[0] eq $id && $values[2] eq $account;

	printf "%-12s%12s%12s%12s\n", @values[3..6];
		
}
__DATA__
A11111 0300 001-003-0001697-7 2000/05/20 100             1000
A11111 0300 001-003-0001697-7 2000/05/21         200     1200
A11111 0300 001-003-0001697-7 2000/05/22 100             1100
A11111 0300 002-004-0001234-5 2000/05/22         100     5000
A11111 0300 002-004-0001234-5 2000/05/23 400             4600
A11111 0300 002-004-0001234-5 2000/05/25 100             4500


-- 
Good luck,
Abe


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

Date: Tue, 06 Jun 2000 17:06:49 GMT
From: 572_dex@my-deja.com
Subject: Perl and PDF Files
Message-Id: <8hjb2q$946$1@nnrp1.deja.com>

Am Wanting to Generate Index Pages for directories
the HTML pages are reasonably transparent anybody know
of a Perl Module to Extract the Document Properties from a
Acrobat PDF file.

Any Ideas ?


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 6 Jun 2000 14:08:07 GMT
From: csaba_r@my-deja.com (Csaba Raduly)
Subject: Re: perl editor for linux
Message-Id: <8F4B9EC95quuxi@193.82.145.131>

04 Jun 2000: A formal bug report was sent to Seti@Home, because the
following message originated from dgrogan@virginia.edu (David Grogan)
was reported as containing signs of intelligence: 

>I didn't know emacs did syntax highlighting.
[snip]
*Chuckle*
Is there something EMACS *can't* do ? :-)

-- 
Csaba Raduly, Software Developer (OS/2), Sophos Anti-Virus
mailto:csaba.raduly@sophos.com      http://www.sophos.com/
US Support +1 888 SOPHOS 9      UK Support +44 1235 559933
Life is complex, with real and imaginary parts.


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

Date: Tue, 06 Jun 2000 15:52:00 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Perl gurus: help a C++ programmer optimize his ways
Message-Id: <7gupjs84r7vqpe50su2lb2fblhqsbup4of@4ax.com>

As a general note to Michael:

	You should test the code you post here.
	Once you've tested your code, you can choose to post it by using
	copy/paste, thus avoiding 'typos'.


On Tue, 6 Jun 2000 21:41:42 +0200, "Michael Schlueter"
<michael.schlueter@philips.com> wrote:

 ...
> * There are several ways to pass many variables. E.g. you could store their
> references in a list or in a hash and pass that by reference, like:
And that will work as long as you remember you are passing a reference
to a list of references, so you'll have to dereference twice.

> 
>     my ($var, @list);
>     my @refs(\$var, \@list);    # put their memory references
That gives a syntax error.
	my @refs = (\$var \@list);
> 
>     call_some_func(\@refs);
> ...
> 
>     sub call_some_func {
>         my ($rl)=@_;            # first element is the reference to a list
You could simply shift it:
	my $rl = shift;

> 
>         $$rl[0]++;    # $($rl)[0] is \$var; so you actually manipulate $var
> above
Nope, $rl->[0] (or ${$rl}[0] if you like, but mind the curlies) holds
the reference to $var. You will need to dereference once more. If you
want to increment $var by 1:
	${$rl->[0]}++;
> 
>         reverse $$rl[1];    # do a reverse sort on @list
Now that is nonesens, even if @$rl[1] was a list, no sorting is done and
the result of that reverse is never stored anywhere.
If you want @list to contain its reverse:
	@{$rl->[1]} = reverse @{$rl->[1]};

>     }
> 
 
-- 
Good luck,
Abe


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

Date: Wed, 7 Jun 2000 05:24:50 +0200
From: "Michael Schlueter" <michael.schlueter@philips.com>
Subject: Re: Perl gurus: help a C++ programmer optimize his ways
Message-Id: <8hj54r$kp4$1@porthos.nl.uu.net>

Abe,
Do you have any better suggestions for Greg's initial problems?


> As a general note to Michael:
>
> You should test the code you post here.
> Once you've tested your code, you can choose to post it by using
> copy/paste, thus avoiding 'typos'.
>

Perhaps I should have.

Easily, I can blame it to the incompatibility of Unix (my favourite perl
environment) and Microsoft (newsreader), which keeps me lazy enough. Put
simple, there is no C&P in place for me. - I'm looking forward to Undows or
Winix ...

It is sort of fun to follow peoples comments on these kind of minor, easy to
detect errors. I try to focus on more important things. I admit, this can be
puzzling for newbies. Best, you don't have to use the code I suggested - as
I remarked.

>
> On Tue, 6 Jun 2000 21:41:42 +0200, "Michael Schlueter"
> <michael.schlueter@philips.com> wrote:
>
> ...
> > * There are several ways to pass many variables. E.g. you could store
their
> > references in a list or in a hash and pass that by reference, like:
> And that will work as long as you remember you are passing a reference
> to a list of references, so you'll have to dereference twice.
>
> >
> >     my ($var, @list);
> >     my @refs(\$var, \@list);    # put their memory references
> That gives a syntax error.
> my @refs = (\$var \@list);

Looks like you're less tired today than I am ;-)
Lots of these nasty typos disappear when using proper objects :-)

> >
> >     call_some_func(\@refs);
> > ...
> >
> >     sub call_some_func {
> >         my ($rl)=@_;            # first element is the reference to a
list
> You could simply shift it:
> my $rl = shift;
>

Sometimes I want to extend the list of passed parameters. The initial typing
effort is almost the same with my version. It will be more painfull to
extend the shift-version lateron.

Thanks anyway.





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

Date: 6 Jun 2000 17:43:40 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Perl gurus: help a C++ programmer optimize his ways
Message-Id: <8hjd8c$s6t$1@news.panix.com>

On Tue, 6 Jun 2000 21:41:42 +0200,
Michael Schlueter <michael.schlueter@philips.com> wrote:
++ 
++ * The right way to do it with use strict; is:
++ 
++     !#/usr/local/bin/perl -w

The first two characters should be '#!'.

++     use strict;
++ 
++     my $global_var;    # global in this namespace = this package-file

NO!

my() does *NOT* create variables in name spaces. It creates *lexical*
scoped variables. 

       #!/usr/local/bin/perl -w
       use strict;

       my $global_var;    # A variable in this scope (file).

       package foo;       # Different name space.

       my $a = $global_var;  # $global_var is visible here.

++ * There are several ways to pass many variables. E.g. you could store their
++ references in a list or in a hash and pass that by reference, like:
++ 
++     my ($var, @list);
++     my @refs(\$var, \@list);    # put their memory references

That's a syntax error. Perhaps you meant:

       my @refs = (\$var, \@list);

Although it's not clear why you would like the have a reference to $var.

++ 
++     call_some_func(\@refs);
++ ...
++ 
++     sub call_some_func {
++         my ($rl)=@_;            # first element is the reference to a list
++ 
++         $$rl[0]++;    # $($rl)[0] is \$var; so you actually manipulate $var
++ above

$($rl)[0] is a syntax error. Perhaps you mean ${$r}[0], also known as
$rl -> [0]. However, since ${$r}[0] is \$var, you are *not* at all
manipulating $var. $$rl[0]++ will turn the reference into a number, and
add one to it, basically making $refs [0] contain a useless number.

++         reverse $$rl[1];    # do a reverse sort on @list

Huh? You've no idea what you are talking about. First, no sorting at
all is done. Second, $$rl[1] is a *scalar*, not a list. Third, reverse
doesn't have side effects, so @list isn't going to change, even if you
had given the correct argument to reverse. Fourth, what reverse returns
depends on the context - a context that cannot be determined here.

++     }
++ 
++ With lists this looks quite ugly. It appears better with hashes, like
++ $$refs{_var}++. But still somewhat ugly. - Why do you really need so many
++ different global variables?

$$refs{_var}++ looks ugly because it doesn't make any sense.



Abigail


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

Date: 6 Jun 2000 17:41:16 GMT
From: dha@panix.com (David H. Adler)
Subject: Re: PERL JOBS =?iso-8859-1?Q?=28=A340k+=29?=
Message-Id: <slrn8jqdts.kjs.dha@panix2.panix.com>

On 05 Jun 2000 19:44:09 -0700, Randal L. Schwartz
<merlyn@stonehenge.com> wrote:

>>>>>> "Mark" == Mark P <perl@imchat.com> writes:
>
>Mark> On 31 May 2000 23:33:04 GMT, dha@panix.com (David H. Adler) wrote:
>Mark> They didn't read that, and they never will read the reply or stop
>Mark> posting so your message has been a waste of time.
>
>Dave posts his because we want the www.deja.com record to show that
>this sort of post is objectionable, and that the objections are not
>challenged.  Other groups have failed to do this, and therefore lost
>the ability to challenge on the history of the publicly available
>record, which is sad.

Oh good.  I have a reason.  Thanks!  :-)

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"If you want a real optimist, look up Ray Bradbury. Guy's nuts.
He actually likes people." - David Brin


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

Date: 6 Jun 2000 17:30:49 GMT
From: Adam Trace Spragg <spragg@cs.ucdavis.edu>
Subject: PerlMud and Win32
Message-Id: <8hjcg9$mgr$1@mark.ucdavis.edu>

Has anyone gotten perlmud to work under Win98?  It doesn't like my fcntl.h
definitions...  I've tried all sorts of tricks, but nothing worked.

Can someone point me towards a starting point?

Adam


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

Date: Tue, 06 Jun 2000 09:48:32 -0700
From: JenX <jeniNOjeSPAM@hotbot.com.invalid>
Subject: PLEASE HELP: Perl for WWW
Message-Id: <01286a84.17ec51dd@usw-ex0101-005.remarq.com>

Hello,

I am totally new to this perl thing. I am a web designer looking
to learn scripting and programming languages that apply to the
web. One of them is perl. I have been on tons of web sites
looking for the basic information that nobody seems to have
about starting a perl file: For CGI on the web and for the sake
of teaching myself perl, how do i go about setting up and saving
a perl file? Should I embed the perl in an html file? Should I
save the file as a .pl? Do I need UNIX to do this? I have a PC
with Win95 on it. I was on Webmonkey trying to learn all this,
but they didn't give you any of this info!

Thank you for all your help! I appreciate this!

Jeni

* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



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

Date: Tue, 06 Jun 2000 19:01:09 +0200
From: Marco Natoni <blah@nospam.com>
Subject: Re: PLEASE HELP: Perl for WWW
Message-Id: <393D2E55.FFE0D7DA@nospam.com>

Jeni,

JenX wrote:
> I am totally new to this perl thing. I am a web designer looking
> to learn scripting and programming languages that apply to the
> web. One of them is perl. I have been on tons of web sites looking 
> for the basic information that nobody seems to have about starting 
> a perl file: For CGI on the web and for the sake of teaching 
> myself perl, how do i go about setting up and saving a perl 
> file? Should I embed the perl in an html file? Should I save the 
> file as a .pl? Do I need UNIX to do this? I have a PC with Win95 
> on it. I was on Webmonkey trying to learn all this, but they 
> didn't give you any of this info!

  Those questions, and many many other ones, will find an accurate
answer on CGI Programming on the World Wide Web, by Shishir Gundavaram,
published by O'Reilly, just for an example. ;)

  And, if you are in need of PERL basics, Learning PERL, by Randal
Schwartz & Tom Christiansen, or Programming PERL, by Larry Wall, Randal
Schwartz & Tom Christiansen, coming from O'Reilly too.

  Do not underestimate the power of the press-book:  The Net has still a
short but significant distance to run before to reach the experienced
world of books.


	Best regards,
		Marco


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

Date: Tue, 06 Jun 2000 10:14:05 -0700
From: JenX <jeniNOjeSPAM@hotbot.com.invalid>
Subject: Re: PLEASE HELP: Perl for WWW
Message-Id: <13d34cd0.1e966d0a@usw-ex0101-005.remarq.com>

Hello,

Thanks for the book suggestions. Right now, I am not looking to
buy books, but just for these answers. Do you or anyone else out
there know the answers to my questions? I can probably pick up
from there on webmonkey. I just need to know what format to save
my files in, so I can start workin'. =)

Thank you! I appreciate it!

Jeni

* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



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

Date: Tue, 06 Jun 2000 17:54:07 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: PLEASE HELP: Perl for WWW
Message-Id: <8hjdrm$bc8$1@nnrp1.deja.com>

In article <01286a84.17ec51dd@usw-ex0101-005.remarq.com>,
  JenX <jeniNOjeSPAM@hotbot.com.invalid> wrote:
> Hello,
>
> I am totally new to this perl thing. I am a web designer looking
> to learn scripting and programming languages that apply to the
> web. One of them is perl. I have been on tons of web sites
> looking for the basic information that nobody seems to have
> about starting a perl file: For CGI on the web and for the sake
> of teaching myself perl,

> how do i go about setting up and saving a perl file?

a perl file is essentially just a text file.  The very first line in the
file should be what is referred to as the shebang (#!) line:

#!/path/to/perl -w # -w is to get warnings

for the actual /path/to/perl, contact your system admin, or on a unix
box command line, type

which perl

type the file, save it.  If on Unix box, set permissions 755.

> Should I embed the perl in an html file?

not generally.

> Should I save the file as a .pl?

generally, you would save a script that is to be called directly (<FORM
ACTION="script.cgi" METHOD=POST>) as .cgi (or other as specified in the
configuration parameters of the web server (contact your web server
admin for details)

> Do I need UNIX to do this?

no.  If you develop on your Win95 box and deploy on a Unix box, be sure
to have Unix line endings instead of DOS line endings.

> I have a PC with Win95 on it.

http://www.activestate.com

> I was on Webmonkey trying to learn all this,
> but they didn't give you any of this info!
>
> Thank you for all your help! I appreciate this!
>

you might want to spend some time browsing the activestate.com,
www.cpan.org and www.perl.com sites, as well as getting a few books on
perl.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 06 Jun 2000 17:48:11 +0100
From: nobull@mail.com
Subject: Re: please??
Message-Id: <u9u2f6pxh0.fsf@wcl-l.bham.ac.uk>

"Helza" <helza@planet.nl> writes:

> Subject: please??

You posted a question with a sensible subject line.  

You didn't like the answers you got so you tried again with a stupid
one.

Why?

BTW: When you appear claim that your process is thrashing is this
actually true or was something lost in the translation?

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V9 Issue 3265
**************************************


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