[18991] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1186 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 25 06:05:32 2001

Date: Mon, 25 Jun 2001 03:05:09 -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: <993463509-v10-i1186@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 25 Jun 2001     Volume: 10 Number: 1186

Today's topics:
    Re: .htaccess help required (Rafael Garcia-Suarez)
    Re: .htaccess help required <jason@uklinux.net>
        Access OracleDB from MS-DOS via LDAP <thomas.binggeli@ubs.com>
    Re: Checking for duplicates before appending to file <goldbb2@earthlink.net>
    Re: fastest way to count lines in a bunch of files. <somewhere@in.paradise.net>
    Re: How can I get rid  of lines with garbage in a large <der.prinz@gmx.net>
    Re: How i Install Perl module in NT platform <pne-news-20010625@newton.digitalspace.net>
    Re: How to detect 'Out of Space' <pne-news-20010625@newton.digitalspace.net>
    Re: I have a large file, with garbage inside ; How can  (Rafael Garcia-Suarez)
    Re: loading enviroment variables <goldbb2@earthlink.net>
        lookbehind <dg@sfs.nphil.uni-tuebingen.de>
        mod perl , cgi weirdness mbower@ibuk.bankgesellschaft.de
    Re: MySQL Question <todd@designsouth.net>
        Newsgroup where I can post my code of a PerlShop? (Lars)
    Re: one liner ... simple question <hafner-usenet@ze.tu-muenchen.de>
        passing arrays in shared memory <mquinn@talk21.com.nospam>
    Re: passing arrays in shared memory <hafner-usenet@ze.tu-muenchen.de>
    Re: passing arrays in shared memory (Anno Siegel)
    Re: Perl Project <todd@designsouth.net>
        Perl variable <nobody@nowhere.com>
    Re: Perl variable <m.grimshaw@salford.ac.uk>
        problem on install perl module on NT platform (Eli)
    Re: Problem reading large files (dumb question?) <pne-news-20010625@newton.digitalspace.net>
    Re: Problem reading large files (dumb question?) <goldbb2@earthlink.net>
    Re: simulating multi-thread (Rafael Garcia-Suarez)
    Re: Unix filepath completion within perl? <george.stevens@baesystems.com>
    Re: Unix filepath completion within perl? <somewhere@in.paradise.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 25 Jun 2001 07:19:16 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: .htaccess help required
Message-Id: <slrn9jdphc.gog.rgarciasuarez@rafael.kazibao.net>

Umair Tariq Bajwa wrote in comp.lang.perl.misc:
} I am designing and developing database. To access database the user
} enters his login and password that are in usersfile created through
} htpasswd command. Is there a way to connect to mysql database and check
} for a valid user and password instead of going through that file?
} Actually so many people are going to use that database and I think using
} password file is not a good idea.

Yes, you're probably right, but this is a question related to the
configuration of your web server, not to Perl. Apache can do something
like that automatically for you, so your programs won't have to check
the password themselves. Ask in one of the
comp.infosystems.www.servers.* groups.

-- 
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


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

Date: Mon, 25 Jun 2001 10:58:32 +0100
From: Jason Clifford <jason@uklinux.net>
Subject: Re: .htaccess help required
Message-Id: <Pine.LNX.4.30.0106251057551.30766-100000@s1.uklinux.net>

On Sat, 23 Jun 2001, Umair Tariq Bajwa wrote:

> I am designing and developing database. To access database the user
> enters his login and password that are in usersfile created through
> htpasswd command. Is there a way to connect to mysql database and check
> for a valid user and password instead of going through that file?
> Actually so many people are going to use that database and I think using
>
> password file is not a good idea.
> Does anyone know how to do that? Any help will be greatly appreciated.

You need a mysql authentication module for your web server.

For apache use mod_auth_mysql.

Jason



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

Date: Mon, 25 Jun 2001 09:20:20 +0200
From: "Thomas Binggeli" <thomas.binggeli@ubs.com>
Subject: Access OracleDB from MS-DOS via LDAP
Message-Id: <9h6opd$4573@svfiction.flur.zuerich.ubs.ch>

hi all

i shold access a Oracle DB server from DOS via LDAP. i found infos, that
there are libs for perl V5 to access a LDAP server....

how i can do that ?

it's not easy to get infos about old stuff like MS-DOS and perl V5.

tnx for your help






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

Date: Mon, 25 Jun 2001 03:27:07 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Checking for duplicates before appending to file
Message-Id: <3B36E7CB.BACEB030@earthlink.net>

David Soming wrote:
> 
> Hi,
> I would like to check for duplicates in my database before appending:
> open (EMAILS, ">>address.txt");

	open( EMAILS, ">>", "address.txt" )
		or die "Could not open address.txt in rw mode: $!";

Always, yes, always, check the return value of open.

> flock(EMAILS, 2);
> print EMAILS "$email\n";
> flock(EMAILS, 8);
> close (EMAILS);

Hard coded constants?  Eww.
	use Fcntl qw(:flock);
	flock EMAILS, LOCK_EX
		or die "Could not gain flock for address.txt: $!\n";
	print EMAILS, $email, "\n";
	flock EMAILS, LOCK_UN;
	close EMAILS or die "close(address.txt) : $!\n"; # disk full?

> 
> This is a whole new ball game and "struggling" to say the least. I would
> appreciate it if anyone can help me incorporate some code to the existing
> above.
> I have this tangled mess...
> 
> open(EMAILS,"address.txt");
> @address=<EMAILS>;
> close(EMAILS);

Just because you are just reading is no reason not to lock the file.
And wouldn't it be better to open the file in read/write mode?

	open( EMAILS, ">>", "address.txt" )
		or die "Could not open address.txt in rw mode: $!";
	flock EMAILS, LOCK_EX
		or die "Could not gain flock for address.txt: $!\n";

> 
> $add = grep{ /$email{'address'}/i } @email;

grep in a scalar context?  Bleh.

	while( <EMAILS> ) {
		next unless /^\Q$email{address}\E$/i;
		print <<"\t\tHEREDOC"
The email address you entered, <B>$email{address}</B>
is already in our mailing list.
		HEREDOC
		exit;
	}
	# after the while loop, we should be at the EOF...
	# which coincidentally is right where we want to write to.
	print EMAILS $email{address}, "\n";
	close EMAILS or die "close(address.txt) : $!\n"; # disk full?
	exit;

There's no need to explicitly unlock the file, since that should
automatically happen when the file is closed.

Note that I'm allowed to indent the string HEREDOC due to the fact that
the indent (the \t\t) is part of the string being searched for.  If you
change the indentation, do it in both places.  If your newsreader strips
tabs, umm... get rid of the \t\t before the first string HEREDOC, or
something.

> if (@add) {
>  $errormessage = "The address you entered, <B>$email{'address'}</B> is
> already in our mailing list";
> }
> exit;

-- 
The longer a man is wrong, the surer he is that he's right.


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

Date: Mon, 25 Jun 2001 18:37:43 +1000
From: "Tintin" <somewhere@in.paradise.net>
Subject: Re: fastest way to count lines in a bunch of files.
Message-Id: <cMCZ6.128$zT3.700465@news.interact.net.au>


"Prarie Dawn" <prariedawn @hotmail.com> wrote in message
news:993451325.48915@atlas.corp.au.home.com...
> Could you use grep?...
>
> $num_lines = `grep -c ^ file.txt`;

Interesting use of grep.  I assumed it would be slower than 'wc  -l', but
doing some simple benchmarks on a P166 running Mandrake 8 using a 110000
line file, had grep running slightly faster.




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

Date: Mon, 25 Jun 2001 12:02:04 +0200
From: "Stefan Weiss" <der.prinz@gmx.net>
Subject: Re: How can I get rid  of lines with garbage in a large file . HELP!!!
Message-Id: <3b370bc8$1@e-post.inode.at>

"None" <rig01@yahoo.com> wrote:

> I have a large file, with garbage inside (some lines have garbage),
> How can I get rid  of these lines with garbage.

Hm, hard one. Usually it's garbage in - garbage out...

Try this:

open (IN, "<infile") or die $!;
open (OUT, ">outfile") or die $!;
while (<IN>) {
    print OUT unless /garbage/;
}
close OUT or die $!;
close IN;


Seriously, I have no idea what you mean by "garbage". If you could
elaborate a little we might actually be able to help you.


cheers,
stefan





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

Date: Mon, 25 Jun 2001 09:22:42 +0200
From: Philip Newton <pne-news-20010625@newton.digitalspace.net>
Subject: Re: How i Install Perl module in NT platform
Message-Id: <kipdjtoa3g59q8k354bmg1v85tjl3senq1@4ax.com>

On 24 Jun 2001 00:59:00 -0700, ELI@PELEPHONE.CO.IL (Eli) wrote:

> ppm install Expect-1.11.tar 
> and i get error message 
> retrieving package Expect-1.11.tar 
> could not locate a PPM binary of Expect-1.11.tar  for this platform

If you want to use PPM to install a module, you shouldn't give a
version; you'll get the newest version that's been packaged for PPM. In
the case of Expect, that's apparently 1.10 (according to `ppm search
Expect`). So just

    ppm install Expect

shoul install version 1.10 for you. No need to download a .tar.gz or
anything; ppm will do that for you.

If you downloaded a .tar.gz distribution of a module, I don't think you
can (easily) install it with PPM; you'd need a make utility than, and
possibly a C compiler.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: Mon, 25 Jun 2001 09:26:29 +0200
From: Philip Newton <pne-news-20010625@newton.digitalspace.net>
Subject: Re: How to detect 'Out of Space'
Message-Id: <1rpdjt0k3mg4uc0cva6uljq0lkqs3ijdiq@4ax.com>

On Sat, 23 Jun 2001 18:06:13 GMT, clintp@geeksalad.org (Clinton A.
Pierce) wrote:

> The return value from open() will tell you if the file was created.

And the return value from close() will tell you whether you managed to
write all of your data to it :)

> The canonical way of checking this is:
> 
> 	open(FILE, ">test.file") || die "Cannot create: $!";

Well, I would argue that the form with 'or die' and with parentheses is
perhaps more common, so either might be called "canonical". YMMV,
TMTOWTDI, HAND.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: 25 Jun 2001 07:02:09 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: I have a large file, with garbage inside ; How can I get rid  of these lines
Message-Id: <slrn9jdoh9.gog.rgarciasuarez@rafael.kazibao.net>

Jim Monty wrote in comp.lang.perl.misc:
} None <rig01@yahoo.com> wrote:
} > I have a large file, with garbage inside (some lines have garbage),
} > How can I get rid of these lines with garbage.
} 
} This'll take the garbage out:
} 
}     perl -ine 'print unless /garbage/' large_file

You meant
  perl -i -ne 'print unless /garbage/' large_file

Of course, the OP should have defined "garbage". Lots of files look like
garbage, but aren't. Lots of files also don't look like garbage but are,
actually. But that's a topic for philosophers and marketroids.

-- 
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


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

Date: Mon, 25 Jun 2001 04:18:14 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: loading enviroment variables
Message-Id: <3B36F3C6.B6782887@earthlink.net>

Oliver Gardi wrote:
> 
> hi all
> 
> i'am a perl newby, writing my first scripts. Now I have the problem,
> that I wan't to use variables I declared in a special sh-script,
> something like a config-file. I don't have any problems to access this
> variables from other shell scripts by using the command '.
> /etc/conffile'. So, the variables are loaded into the current shell
> enviroment.

The shell's 'dot' command causes the file given as an argument to be
opened, then each line in it is executed by the shell.  Perl's
equivilant of this is "do".  Of course, the file given to do must
contain perl code, not shell code.

> As I tried the same thing in my Perl-Script (system(".
> /etc/conffile");), it wasn't really successfull. So I think, that the
> System-Calls out of Perl-Scripts open a new shell anyway, ignoring my
> '.' in front of the command.

perl is already a new process, and is not part of the shell.  So the
shell has started an instance of perl, and then system makes perl start
a new instance of the shell, which then sees the . command, opens and
reads and interprets the argument, and then exits, giving control back
to the perl program.  The . is seen, but not by who you want to see it.

> Has anyone an idea how I can load my variables in the script??

Two ways: first, load the thing [into your shell] before perl is run:

	bash$ . /etc/conffile
	bash$ perl myscript.pl arguments

and then access them from the %ENV hash inside of myscript.pl
Second, have code like the following:
	chomp my ($var1, $var2, $var3) = qx'
		. /etc/conffile
		echo $VAR_FOO
		echo $VAR_BAR
		echo $VAR_BAZ
	';
Note that the quoting character is ' so that the $ characters inside
don't need to be escaped.  If I'd used some other quoting character, it
might look something like this:
	chomp my ($var1, $var2, $var3) = qx[
		. /etc/conffile
		echo \$VAR_FOO
		echo \$VAR_BAR
		echo \$VAR_BAZ
	];

Note that, on perldoc's page describing the qx operator:
	http://www.perldoc.com/perl5.6/pod/perlop.html#qx%2fSTRING%2f
it says:
On some platforms (notably DOS-like ones), the shell may not be capable of dealing with multiline
commands, so putting newlines in the string may not get you what you want. You may be able to
evaluate multiple commands in a single line by separating them with the command separator
character, if your shell supports that (e.g. ; on many Unix shells; & on the Windows NT cmd shell).

Also, I'm not sure when perl knows to use "sh -c" to run the given
string, as opposed to parsing it itself.  I suppose that only simple
things (for some unknown definition of simple) are parsed by perl, and
the rest by the shell.  Given that I don't know what "simple" is, I
might do:
	my ($var1, $var2, $var3);
	my $pid = open BASH, "-|";
	defined $pid or die "Couldn't fork: $!";
	if( $pid ) { # parent
		chomp ($var1, $var2, $var3) = <BASH>;
		unless( close BASH ) {
			my ($sig, $ret) = ($? & 255, $? >> 8);
			print STDERR "Died due to sig $sig\n" if $sig;
			print STDERR "Exited with ret $ret\n" if $ret;
			print STDERR "Unexpected error: $!" if $!;
			exit 1;
		}
	} else {
		exec "/bin/sh", "-c", q[
			. /etc/conffile
			echo $VAR_FOO
			echo $VAR_BAR
			echo $VAR_BAZ
		];
		die "Couldn't exec /bin/sh: $!\n";
	}

This is almost certainly overkill, but there may be times when something
like this is wanted.  Certainly the open-as-fork is occasionally needed
if we need to lose permissions before exec'ing [like from setuid], and
maybe in other cases, too.

-- 
The longer a man is wrong, the surer he is that he's right.


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

Date: Mon, 25 Jun 2001 10:37:32 +0200
From: Dale Gerdemann <dg@sfs.nphil.uni-tuebingen.de>
Subject: lookbehind
Message-Id: <3B36F84C.19C689C5@sfs.nphil.uni-tuebingen.de>

I think that the Perl manual doesn't explain lookbehind properly:

  (?<=pattern)

      A zero-width positive lookbehind assertion. For example,
      /(?<=\t)\w+/ matches a word following a tab, without including
      the tab in $&. Works only for fixed-width lookbehind.
      (from: http://www.perl.com/pub/doc/manual/html/pod/perlre.html)

What's missing here is a statement of whether the left context is
checked in the original text or in the modified text. For example:

   $a = "baaa";

   $a =~ s/(?<=b)a//g;

   print "$a\n";  # Only one a was deleted, so this prints "baa"

You might think that the output would be simply "b", since after the
first "a" is deleted, then the second "a" has a "b" as it's left
context, etc. In any case, the manual doesn't rule out this
interpretation.

The classic reference on these sorts of problems with lookbehind and
lookahead is:

   Ronald Kaplan and Martin Kay (1994), "Regular Models of
   Phonological Rule Systems," Computational Linguistics, 20:3,
   pp. 331-378.

Kaplan and Kay describe a much richer (and more interesting) approach
to regular expressions than Perl. Still, I think that some of their
ideas ought to be applicable to languages like Perl.

-- Dale Gerdemann





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

Date: Mon, 25 Jun 2001 09:13:18 GMT
From: mbower@ibuk.bankgesellschaft.de
Subject: mod perl , cgi weirdness
Message-Id: <3b36fa4c.435492734@news>

I call the script below with one of 2 links...  it uses mod-perl and
Apache DBI.  I use a self written module to perform functions such as
database_open, database_close,  get_rows etc

Every now and then the value $tempvar gets an erroneous value from a
previously run script

If I alter the script so that I pass the value of $cgi_prog it seems
to correct the problem..but why ????   I use "my" with $cgi_prog so
shouldn't that keep the variable within the scope of this script ?





<A HREF='/cgi-perl/passwd_admin.pl?type=funds' TARGET=main>Funds</A>
<A HREF='/cgi-perl/passwd_admin.pl?type=riskarb' TARGET=main>Risk</A> 


print "Content-type:text/html\n\n";
print "<HTML>\n";
print "<BODY>\n";
use CGI qw(:standard);
use lib "/usr/local/apache/htdocs/cgi-perl";
use mb_module;

my $strSQL;
my $collection='';
$collection=param('type');
my $cgi_prog="/cgi-perl/passwd_admin.pl?type=$collection&";

&PrintEntryForm;

end of code............

sub PrintEntryForm {

    my $tempvar = "This is some text ".$cgi_prog." end of line";

}


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

Date: Mon, 25 Jun 2001 08:32:54 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: MySQL Question
Message-Id: <WGCZ6.4148$P5.1786613@news1.rdc1.tn.home.com>


> "Simon Stiefel" <SiStie@nuclear-network.com> wrote in message
> news:Pine.LNX.4.31.0106241205350.1062-100000@server.stiefel.priv...

> So, now all ID's with the status "r" should be fetched in an array.

> How can I do this?

read up on `perldoc DBI`

and use this pseudo-code:

$dbh = DBI->connect( ... );
$sth = $dbh->prepare("select ID from table where status = 'r'");
$sth->execute;
while (  ($ID) = $sth->fetchrow_array  ) {
 ....
}
$sth->finish;
$dbh->disconnect;






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

Date: Mon, 25 Jun 2001 10:02:58 GMT
From: Lars.Plessmann@gmx.de (Lars)
Subject: Newsgroup where I can post my code of a PerlShop?
Message-Id: <3b370bea.7853891@news.btx.dtag.de>

I want let check my code for stability, performance and security.
Is there any newsgroup where I can post a URL where you can get my
Perl Shop to check it?
I have some probs with the security i think...

thx
Lars


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

Date: 25 Jun 2001 11:16:56 +0200
From: Walter Hafner <hafner-usenet@ze.tu-muenchen.de>
Subject: Re: one liner ... simple question
Message-Id: <srju214ncl3.fsf@w3proj1.ze.tu-muenchen.de>

Walter Hafner <hafner-usenet@ze.tu-muenchen.de> writes:

> I want to convert a list to a hash, so that all the list values become
> keys in the hash.

 ...

Thanks to all who answered!

I'll benchmark the suggested solutions.

-Walter


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

Date: Mon, 25 Jun 2001 10:14:15 +0100
From: "Zinc" <mquinn@talk21.com.nospam>
Subject: passing arrays in shared memory
Message-Id: <9h6vik$9ul$1@pheidippides.axion.bt.co.uk>

Folks,

I'm having problems passing arrays via shared memory. I've set aside the
area of memory and have proved I can write and read a string. However when I
write an array I can't seem to read it even though data types are (I
believe) correct.

A sample of my code is below:

WRITER
======
@array = ('fred','jane','rod');
shmwrite($key, @array, 0, 60 ) || die "$!";

READER
======
shmread($pkey,@names,0,60) || die "$!";
print "NAMES is $names[0] $names[1] $names[2]\n";

Any suggestions please ?







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

Date: 25 Jun 2001 11:32:30 +0200
From: Walter Hafner <hafner-usenet@ze.tu-muenchen.de>
Subject: Re: passing arrays in shared memory
Message-Id: <srjr8w8nbv5.fsf@w3proj1.ze.tu-muenchen.de>

"Zinc" <mquinn@talk21.com.nospam> writes:

> Folks,
> 
> I'm having problems passing arrays via shared memory. I've set aside the
> area of memory and have proved I can write and read a string. However when I
> write an array I can't seem to read it even though data types are (I
> believe) correct.
> 
> A sample of my code is below:
> 
> WRITER
> ======
> @array = ('fred','jane','rod');
> shmwrite($key, @array, 0, 60 ) || die "$!";
> 
> READER
> ======
> shmread($pkey,@names,0,60) || die "$!";
> print "NAMES is $names[0] $names[1] $names[2]\n";
> 
> Any suggestions please ?

Serializing the data? Have a look at the "Storable" module on CPAN.

-Walter


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

Date: 25 Jun 2001 09:49:04 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: passing arrays in shared memory
Message-Id: <9h71eg$9cm$1@mamenchi.zrz.TU-Berlin.DE>

According to Zinc <mquinn@talk21.com.nospam>:
> Folks,
> 
> I'm having problems passing arrays via shared memory. I've set aside the
> area of memory and have proved I can write and read a string. However when I
> write an array I can't seem to read it even though data types are (I
> believe) correct.
> 
> A sample of my code is below:
> 
> WRITER
> ======
> @array = ('fred','jane','rod');
> shmwrite($key, @array, 0, 60 ) || die "$!";

Reading perldoc -f shmwrite, you will note that the second parameter
of shmwrite (where you have @array) is designated as "STRING".  This
indicates strongly that it will be used in scalar context and an
array in this position is useless (the number of elements will be
written to shared memory).

There are modules on CPAN that do what you want, do a search
on "IPC::Share" to find them.

[...]
 
Anno


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

Date: Mon, 25 Jun 2001 08:36:27 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: Perl Project
Message-Id: <fKCZ6.4149$P5.1787973@news1.rdc1.tn.home.com>

> > The work isnt that hard,
>
> Rewarding work is enjoyably hard. However, good grammar
> is even more hard to learn, as evidenced by you.
>

"more hard"? Yeah, grammar is tough, isn't it?




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

Date: Mon, 25 Jun 2001 11:49:29 +0200
From: "Thierry" <nobody@nowhere.com>
Subject: Perl variable
Message-Id: <9h71i0$fnm$1@s1.read.news.oleane.net>

Hi,

I want to get the output of of a call to  system()

with shell:
$ nb=`ps -ef|grep toto| wc -l`
$ echo $nb
3

with perl ???
something like nb=system(ps -ef|grep toto|wc -l)
the syntax is approximative, I am not a specialist

Thank for your help











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

Date: Mon, 25 Jun 2001 11:01:57 +0100
From: Mark Grimshaw <m.grimshaw@salford.ac.uk>
Subject: Re: Perl variable
Message-Id: <3B370C15.4B761B61@salford.ac.uk>



Thierry wrote:
> 
> Hi,
> 
> I want to get the output of of a call to  system()
> 
> with shell:
> $ nb=`ps -ef|grep toto| wc -l`
> $ echo $nb
> 3
> 
> with perl ???
> something like nb=system(ps -ef|grep toto|wc -l)
> the syntax is approximative, I am not a specialist
> 
> Thank for your help


As fas as I'm aware, system() only returns the ex it status of the call
to system().  You probably want to use backticks.


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

Date: 25 Jun 2001 00:29:38 -0700
From: ELI@PELEPHONE.CO.IL (Eli)
Subject: problem on install perl module on NT platform
Message-Id: <3e7e9299.0106242329.62ab66d1@posting.google.com>

HI FOLKS
about how to install perl module on NT platform
i have NT 4 with activePerl 5.6.0
have problem to install the module
for example :
i have the Expect-1.11.tar module
i run the following command
ppm install Expect-1.11.tar 
and i get error message 
retrieving package Expect-1.11.tar 
could not locate a PPM binary of Expect-1.11.tar  for this platform
any idea ???


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

Date: Mon, 25 Jun 2001 09:25:04 +0200
From: Philip Newton <pne-news-20010625@newton.digitalspace.net>
Subject: Re: Problem reading large files (dumb question?)
Message-Id: <topdjt45e4f7hqnr7720gla4ogkn7eo406@4ax.com>

On Sun, 24 Jun 2001 20:09:34 -0400, "Todd W" <trw@uakron.edu> wrote:

> 
> John W. Krahn <krahnj@acm.org> wrote in message
> news:3B351D91.42695172@acm.org...
> > "Richard J. Rauenzahn" wrote:
> 
> > > open OUT, ">d.dat" || die;
> >                      ^^^^^^
> > This doesn't do what you seem to think it does. You need to use "open()"
> > or "or". to get die to do anything. You should also include the $!
> > variable for a meaningful message.
> 
> that means this, right?
> 
> open OUT, ($foo || $bar);
> 
> using $foo as a filename if it is true, ortherwise using $bar...correct?

Essentially, yes. So it the string ">d.dat" were not true, then die
would be called, and its return value passed to the open call... except
that die() doesn't return. And since ">d.dat" is neither "" nor "0", die
will never get called in such code.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: Mon, 25 Jun 2001 03:33:47 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Problem reading large files (dumb question?)
Message-Id: <3B36E95B.3D31FCF7@earthlink.net>

Todd W wrote:
> 
> John W. Krahn <krahnj@acm.org> wrote in message
> news:3B351D91.42695172@acm.org...
> > "Richard J. Rauenzahn" wrote:
> 
> > > open OUT, ">d.dat" || die;
> >                      ^^^^^^
> > This doesn't do what you seem to think it does. You need to use
> > "open()" or "or". to get die to do anything. You should also include
> > the $! variable for a meaningful message.
> 
> that means this, right?
> 
> open OUT, ($foo || $bar);
> 
> using $foo as a filename if it is true, ortherwise using
> $bar...correct?

Right.  Except that ">d.dat" is always true, so the ||die part gets
optomized away (which is why Deparse doesn't show it).

-- 
The longer a man is wrong, the surer he is that he's right.


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

Date: 25 Jun 2001 07:16:27 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: simulating multi-thread
Message-Id: <slrn9jdpc2.gog.rgarciasuarez@rafael.kazibao.net>

Yossi wrote in comp.lang.perl.misc:
} 
} I have a Perl that doesn't support Multi-Threaded application.
} Is there a simple way to simulate it using full processes?

You could use fork() to launch new processes, copies of your running
program (if your platform supports it). I don't know whether you would
say it's "simple", however. See the perlipc manpage for details.

} The problem is that many times I write scripts that loop, and
} sometimes the action that are done foreach iteration may be done in
} parralel.

My suggestion would be not to use parallel processing when you don't
have to. This will not improve performance unless you have multiple
processors, and your OS is built to take advantage of them. Even in this
case, parallelizing a loop only makes sense when the operations inside
the loop take a long time to complete.

If you want to learn about multi-threaded programming, I suggest to use
the Java language, because it's API is simple and pedagogical.

-- 
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


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

Date: Mon, 25 Jun 2001 09:29:09 +0100
From: George Stevens <george.stevens@baesystems.com>
Subject: Re: Unix filepath completion within perl?
Message-Id: <3B36F655.93F45C0F@baesystems.com>



Anno Siegel wrote:

> According to George Stevens  <george.stevens@baesystems.com>:
> > Does anyone know a way of getting unix command line filepath completion
> > to work within a perl script?  I've tried inserting a
> > system ("set filec");
> > in the script, but it doesn't want to play!  The .cshrc has set filec in
> > as standard, but running the perl script somehow over-rides this.
>
> There is nothing to override.  Perl's IO is completely independent
> from what your shell does.
>

I did think so, but I wasn't sure.

> > The perl is being used in a install script, where the user enters the
> > filepath where they wish the software to be installed.
>
> The Text::Complete module (which you might have found via a CPAN
> search) does what you want:

Sorry, what's a CPAN search?


>
>     use Term::Complete;
>
>     my @filenames = do {
>         opendir my $d, '.' or die "Can't read current dir: $!\n";
>         readdir $d;
>     };
>     my $input = Complete( 'Enter file name > ', @filenames);

I'll give it a go, thanks.

>
> > cheers,
> > George
> >
> > PS I'm not a unix or  perl  guru, so answers in simple English, not
> > hieroglyphics please!
>
> Do you realize how arrogant that sounds?  "You people have this
> habit of using funny terms for no good reason.  Don't do that when
> you're talking to *me*"
>
> Anno

I apologise, it was certainly not intended to sound that way, I was merely
admitting complete and utter ignorance on my part.  I've been dropped in the
deep end to fix something, and I'm struggling.  Sorry if I've offended anyone.





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

Date: Mon, 25 Jun 2001 18:44:01 +1000
From: "Tintin" <somewhere@in.paradise.net>
Subject: Re: Unix filepath completion within perl?
Message-Id: <5SCZ6.129$9T3.688228@news.interact.net.au>


"George Stevens" <george.stevens@baesystems.com> wrote in message
news:3B36F655.93F45C0F@baesystems.com...
>
>
> Anno Siegel wrote:
>
> > > The perl is being used in a install script, where the user enters the
> > > filepath where they wish the software to be installed.
> >
> > The Text::Complete module (which you might have found via a CPAN
> > search) does what you want:
>
> Sorry, what's a CPAN search?

http://search.cpan.org/






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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 1186
***************************************


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