[19800] in Perl-Users-Digest
Perl-Users Digest, Issue: 1995 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 24 06:05:37 2001
Date: Wed, 24 Oct 2001 03:05:10 -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: <1003917910-v10-i1995@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 24 Oct 2001 Volume: 10 Number: 1995
Today's topics:
Almost there on Sorting <diehard@nospam.userve.co.uk>
Compatibility with PWS 4.0 <eang@pacific.net.sg>
Re: Delete spaces at the end of a string <pne-news-20011024@newton.digitalspace.net>
Re: Encrypting in one program and Decrypting in another <bernard.el-hagin@lido-tech.net>
Re: Hash to Array? <pne-news-20011024@newton.digitalspace.net>
Hiding the content of a Perl Script (Kalin)
Re: Hiding the content of a Perl Script <bernard.el-hagin@lido-tech.net>
Re: How to display text file in cgi-bin? <michealo@ozemail.com.au>
Newbie cgi pm <cnk@dodo.com.au>
Re: Newbie cgi pm <dave@dave.org.uk>
Re: Newbie cgi pm <goldbb2@earthlink.net>
Re: output problem table format <hugo@fractalgraphics.com.au>
perl program not printing out to console (freddy loo)
Re: perl program not printing out to console <wyzelli@yahoo.com>
Re: perl program not printing out to console <mgjv@tradingpost.com.au>
Re: Perl Vs. Java <please@no.spam>
Re: Perl Vs. Java <tim@vegeta.ath.cx>
Reading parameter from a string <robert_loui@yahoo.com>
Re: Reading parameter from a string <bernard.el-hagin@lido-tech.net>
Re: Reading parameter from a string <simon.oliver@umist.ac.uk>
reading pipes <jwills@orange.net.au>
Re: reading pipes <goldbb2@earthlink.net>
Re: Regular expression stumps me ... <f.galassi@e-mind.it>
Re: SDBM_File size limit? <mgjv@tradingpost.com.au>
Split on Win32 (Gregski)
Re: Split on Win32 <bernard.el-hagin@lido-tech.net>
Re: Split on Win32 <simon.oliver@umist.ac.uk>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 24 Oct 2001 10:24:21 +0100
From: "Diehard Duck" <diehard@nospam.userve.co.uk>
Subject: Almost there on Sorting
Message-Id: <1003915475.5356.0.nnrp-02.9e98e2c7@news.demon.co.uk>
Hi All,
I've almost cracked my sorting problem.
The display.cgi program I'm using to generate search results does the sort
function. I didn't write the script, I'm just adapting it.
Basically, the script puts the search results into a hash %search_results.
It then does this:
=====
if (%search_results)
{
&table_header;
$result = $starting_point;
foreach $result($start_point..$end_point)
{
!$search_results{$result_map{$result}} and next;
$last_displayed = $result;
@field = split (/\|/, $search_results{$result_map{$result}});
if ($bgcount > 1)
{$bgcolor=$bgcolor2;$bgcount=1;}
else
{$bgcolor=$bgcolor1;$bgcount=2;}
&table_row;
}
=====
So it's generating a table for each result (I set the table up earlier in
the script).
However, I have taken the hash and sorted it by price into an array
@srsorted_results. Basically I want the above code instead of using the
results from the hash, to use the results from the array.
Any ideas?
Cheers,
--
Šiehard ŠuēK
------------------------------
Date: Wed, 24 Oct 2001 14:33:09 +0800
From: "Frank McGuire" <eang@pacific.net.sg>
Subject: Compatibility with PWS 4.0
Message-Id: <9r5na9$ibe$1@violet.singnet.com.sg>
Hi all,
I've installed activeperl (I download msi file) the latest version, I've
downloaded from activestate website. And I try to install under Win98/PWS
4.0. Installation successfully. But when I try to run helloworld.pl from
http://localhost/cgi-bin/helloworl.pl. I should wait very long and after
certain time error come out DNS Error bla..bla..bla... If I checked at the
background processing of my Win98 there's a perl program keep running. I've
tried to execute at the command prompt by type "perl helloworld.pl" and it
works fine. Does anyone of you have any idea of my problem ? Thank you for
your help in advance.
Regards,
Franky
------------------------------
Date: Wed, 24 Oct 2001 07:33:51 +0200
From: Philip Newton <pne-news-20011024@newton.digitalspace.net>
Subject: Re: Delete spaces at the end of a string
Message-Id: <uajctt4r99ull5lgj2dk1l64a3hml37f8r@4ax.com>
On Tue, 23 Oct 2001 16:38:17 -0400, Lou Moran <lmoran@wtsg.com> wrote:
> On Tue, 23 Oct 2001 08:32:33 +0200, Philip Newton
> <pne-news-20011023@newton.digitalspace.net> wrote wonderful things
> about sparkplugs:
>
> >Now please don't post TOFU any more :)
>
> TOFU?
>
> something about top posting?
Yes. Originates from de.* and standards for "Text oben, Fullquote unten"
-- in other words, someone who top-postes and includes the entire
previous posting (generally including signatures and all).
They don't, in general, like it any more than many of the Big8 groups.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
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: 24 Oct 2001 07:06:47 GMT
From: Bernard El-Hagin <bernard.el-hagin@lido-tech.net>
Subject: Re: Encrypting in one program and Decrypting in another program
Message-Id: <slrn9tcpo5.3nk.bernard.el-hagin@gdndev25.lido-tech>
On 23 Oct 2001 17:06:40 -0700, Anand Ramamurthy <anand_ramamurthy@yahoo.com>
wrote:
> I need help with encrypt & decrypt
>
> 1. I encrypt a text string (passwd) in one program (xx.pl) and store it
> in a config file (this this possible).
> 2. I read the config file in another program (yy.pl) later and decrypt
> the text string.
>
> What is the best method I can use? Any specific Crypt module that will
> help me to achieve this?
Why don't you search CPAN?
search.cpan.org
Even a Google search would get you there.
Cheers,
Bernard
------------------------------
Date: Wed, 24 Oct 2001 07:33:52 +0200
From: Philip Newton <pne-news-20011024@newton.digitalspace.net>
Subject: Re: Hash to Array?
Message-Id: <sdjcttk06a95vkmc1silnplu0vammegktp@4ax.com>
On 24 Oct 2001 03:32:09 GMT, gorilla@elaine.furryape.com (Alan Barclay)
wrote:
> In article <3bd5820b@news.microsoft.com>,
> Jürgen Exner <jurgenex@hotmail.com> wrote:
> >You cannot sort hashes because there is no sequence in hashes. Hashes don't
> >have a first, a last, or a next element. The very sentence "sorting a hash"
> >is meaningless.
>
> Unless you're using Tie::DxHash, which implements a hash which preseves
> the insertion order.
I know of Tie::IxHash.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
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: 24 Oct 2001 00:58:32 -0700
From: kalin@vivax-tech.com (Kalin)
Subject: Hiding the content of a Perl Script
Message-Id: <3d878861.0110232358.5ab3d1bb@posting.google.com>
Hi,
I'm working on a project that requires the content of the Perl Scripts
not to be seen. I was wondering if there is a way to do that?
Let me know if you know a solution.
Thanks,
Kalin
------------------------------
Date: 24 Oct 2001 08:00:25 GMT
From: Bernard El-Hagin <bernard.el-hagin@lido-tech.net>
Subject: Re: Hiding the content of a Perl Script
Message-Id: <slrn9tcssn.3nk.bernard.el-hagin@gdndev25.lido-tech>
On 24 Oct 2001 00:58:32 -0700, Kalin <kalin@vivax-tech.com> wrote:
> Hi,
>
> I'm working on a project that requires the content of the Perl Scripts
> not to be seen. I was wondering if there is a way to do that?
>
> Let me know if you know a solution.
This is a FAQ.
Cheers,
Bernard
------------------------------
Date: Wed, 24 Oct 2001 14:31:53 +1000
From: "nathan" <michealo@ozemail.com.au>
Subject: Re: How to display text file in cgi-bin?
Message-Id: <NrrB7.235$Fi4.14453@ozemail.com.au>
you dont put the text file in the cgi-bin for a start, make sure it's in
it's own folder
Jerry McEwen <mail@mail.com> wrote in message
news:ggp1ttsppuvef1ofkpeijqf64q15mfpnnt@4ax.com...
> I have a shopping cart several levels deep in my cgi-bin directory and
> orders get written to a file in a sub-folder. We have SSL and I want
> my client to be able to access orders.txt via https, but Perl (or
> maybe the server's config?) prevents the file from being displayed.
>
> My host tells me that I will have to get a script to display it, but I
> can't find one. Any thoughts? Thanks!
------------------------------
Date: Wed, 24 Oct 2001 15:38:59 +1000
From: "Chris Mance" <cnk@dodo.com.au>
Subject: Newbie cgi pm
Message-Id: <3bd65334$1@news.comindico.com.au>
I have been trying to place a cgi pm form inside a generated html 3 table.
Does anyone know the format for this. Also how are the parameters set for td
tr tags etc.
I just get errors like "Bad name after state1" when I try to embed a form
tag as below. and whenever I try to set td width or height or font, same
thing just errors.
below is just a copy of Lincoln Steins help file on cgi pm.
Id be greatful if some one could help.
Thanks Chris Mance
*******************
use CGI qw(:standard :html3);
print
table({-border=>'0',width=>'600',align=>'center',cellpadding=>'0',cellspacin
g=>'0' },
caption('Table 1'),
TR([th(['name1','Power']),
td(['$query->textfield('state1','',35,50);', 'Low']),
td(['C', 'Medium']),
td(['Java', 'Medium']),
td(['Perl', 'High'])
]
)
);
------------------------------
Date: Wed, 24 Oct 2001 07:08:10 +0100
From: Dave Cross <dave@dave.org.uk>
Subject: Re: Newbie cgi pm
Message-Id: <3BD65ACA.67E61C47@dave.org.uk>
Chris Mance wrote:
>
> I have been trying to place a cgi pm form inside a generated html 3 table.
> Does anyone know the format for this. Also how are the parameters set for td
> tr tags etc.
> I just get errors like "Bad name after state1" when I try to embed a form
> tag as below. and whenever I try to set td width or height or font, same
> thing just errors.
> below is just a copy of Lincoln Steins help file on cgi pm.
> Id be greatful if some one could help.
> Thanks Chris Mance
> *******************
> use CGI qw(:standard :html3);
> print
>
> table({-border=>'0',width=>'600',align=>'center',cellpadding=>'0',cellspacin
> g=>'0' },
> caption('Table 1'),
> TR([th(['name1','Power']),
> td(['$query->textfield('state1','',35,50);', 'Low']),
> td(['C', 'Medium']),
> td(['Java', 'Medium']),
> td(['Perl', 'High'])
> ]
> )
> );
1/ There's no need to include both :standard and :html3 as :standard
includes :html3
2/ When using :standard, there's no need to use a $query object - and
besides, the code you show doesn't create one.
3/ You can't call a function from within a quoted string.
4/ To create valid HTML, all of your 'td' calls should be within 'TR's.
5/ You have a couple of spurious parentheses at the end.
use CGI qw(:standard);
print
table({border=>'0',width=>'600',align=>'center',cellpadding=>'0',
cellspacing=>'0' },
caption('Table 1'),
TR([th(['name1','Power']),
TR(td([textfield('state1','',35,50), 'Low'])),
TR(td(['C', 'Medium'])),
TR(td(['Java', 'Medium'])),
TR(td(['Perl', 'High'])));
Dave...
--
"Don't you boys know any _nice_ songs?"
------------------------------
Date: Wed, 24 Oct 2001 02:43:00 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Newbie cgi pm
Message-Id: <3BD662F4.583AB879@earthlink.net>
Chris Mance wrote:
>
> I have been trying to place a cgi pm form inside a generated html 3
> table.
> Does anyone know the format for this. Also how are the parameters set
> for td tr tags etc.
> I just get errors like "Bad name after state1" when I try to embed a
> form tag as below. and whenever I try to set td width or height or
> font, same thing just errors.
> below is just a copy of Lincoln Steins help file on cgi pm.
> Id be greatful if some one could help.
[SNIP]
Indenting helps make code readable and maintainable.
#!/usr/local/bin/perl -wT
# always, ALWAYS use -w and -T for cgi programs.
use strict; # always, ALWAYS use strict.
use CGI qw(:standard); # don't need :html3 since it's part of :standard.
print header, begin_html; # you forgot this :)
# Only sometimes are parens necessary.
# learn perl's precedence to know when.
print table { border=>0, width=>600, align=>center,
cellpadding=>0, cellspacing=>0 },
caption( "Table 1" ),
Tr [
th( ['name1','Power'] ), # these parens are necessary.
map td $_,
[textfield('state1','',35,50), 'Low'], # so are these.
['C', 'Medium'],
['Java', 'Medium'],
['Perl', 'High']
];
__END__
I would note that the html this outputs doesn't depend on any cgi
parameters -- you would be better off writing this as a plain html file,
rather than as generated html.
--
Klein bottle for rent - inquire within.
------------------------------
Date: Wed, 24 Oct 2001 13:40:57 +0800
From: hugo <hugo@fractalgraphics.com.au>
Subject: Re: output problem table format
Message-Id: <3BD65469.F06CFDBC@fractalgraphics.com.au>
Thanks to everyone for their help - my little data conversion program
works like a treat now.
Thanks again.
Cheers
Hugo
hugo wrote:
>
> Hi
>
> I have a problem with writing out an array in table format.
>
> I have an array of values where, for a certain repeat count, the values
> are related, ie
>
> @text (1, 2, 3, 4, 1a, 2a, 3a, 4a, 1b, 2b, 3b, 4b )
>
> Here the count is 4 as 1 is related to 1a and 1b, 2 to 2a and 2b etc.
>
> I would like to draw this table like this:
>
> 1 1a 1b
> 2 2a 2b
> 3 3a 3b
> 4 4a 4b
>
> In terms or array numbers I have to write out the values in the
> following sequence as output to a file is done left to right, line per
> line:
>
> 1 5 9
> 2 6 10
> 3 7 11
> 4 8 12
>
> I do know the value of the repeat count (which in this case is 4, but
> that can vary) and I do know the total number of values in my array as
> well of course.
>
> How do I do this?
>
> Any help greatly appreciated.
>
> Thanks
>
> Hugo
>
> --
> Dr Hugo Bouckaert
> R&D Support Engineer, Fractal Graphics
> 57 Havelock Street, West Perth 6005
> Western Australia 6009
> Tel: +618 9211 6000
> Email:hugo@fractalgraphics.com.au
> Web: http://www.fractalgraphics.com.au
--
Dr Hugo Bouckaert
R&D Support Engineer, Fractal Graphics
57 Havelock Street, West Perth 6005
Western Australia 6009
Tel: +618 9211 6000
Email:hugo@fractalgraphics.com.au
Web: http://www.fractalgraphics.com.au
------------------------------
Date: 23 Oct 2001 22:50:48 -0700
From: freddy.loo@accenture.com (freddy loo)
Subject: perl program not printing out to console
Message-Id: <c3470bcf.0110232150.4b885ed4@posting.google.com>
Hi,
My program is not printing out all the print "xxxxxx" commands. My
program does a recursive call. It only prints out for all the print
command in the topmost level. The subsequent recursive calls to
itself does not print the command.
Pls advise
Thanks
Fred
------------------------------
Date: Wed, 24 Oct 2001 15:37:41 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: perl program not printing out to console
Message-Id: <ELsB7.50$Ea3.548@wa.nnrp.telstra.net>
"freddy loo" <freddy.loo@accenture.com> wrote in message
news:c3470bcf.0110232150.4b885ed4@posting.google.com...
> Hi,
>
> My program is not printing out all the print "xxxxxx" commands. My
> program does a recursive call. It only prints out for all the print
> command in the topmost level. The subsequent recursive calls to
> itself does not print the command.
My ESP tells me you have a bug on line 17.
Wyzelli
--
push@x,$_ for(a..z);push@x,' ';
@z='092018192600131419070417261504171126070002100417'=~/(..)/g;
foreach $y(@z){$_.=$x[$y]}y/jp/JP/;print;
------------------------------
Date: Wed, 24 Oct 2001 05:58:51 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: perl program not printing out to console
Message-Id: <slrn9tcm4r.2qd.mgjv@verbruggen.comdyn.com.au>
On 23 Oct 2001 22:50:48 -0700,
freddy loo <freddy.loo@accenture.com> wrote:
> Hi,
>
> My program is not printing out all the print "xxxxxx" commands. My
> program does a recursive call. It only prints out for all the print
> command in the topmost level. The subsequent recursive calls to
> itself does not print the command.
Where's the code?
Can you please post some code that displays this behaviour? Make sure
that it compiles, is as short as possible, and starts with something
like:
#!/usr/local/bin/perl -w
use strict;
Martien
--
Martien Verbruggen | My friend has a baby. I'm writing
| down all the noises the baby makes so
Trading Post Australia Pty Ltd | later I can ask him what he meant -
| Steven Wright
------------------------------
Date: Wed, 24 Oct 2001 05:08:02 GMT
From: Andrew Cady <please@no.spam>
Subject: Re: Perl Vs. Java
Message-Id: <874rop4ogw.fsf@homer.cghm>
David Wall <darkon@one.net> writes:
> "Krishna Kumar" <krishna.kumar@rhii.com> wrote on 22 Oct 2001:
>
> > Can someone help me with this please? Or point me to a website
> > which brings out the differences between Java and Perl?
>
> No-one seems to have mentioned this yet, so....
>
> http://www.perl.com/pub/a/language/versus/java.html
>
> (I don't have an informed opinion, so I'll bow out of this thread.)
> (My *uninformed* opinion is that Java looks painful. :-)
I haven't learned and do not plan on learning java, as I understand it
is a crippled, slow, proprietary C++, but that article raises exactly
zero valid criticisms. The idea that java is more complex than perl
positively astounds. Perl is the most complex language of which I
know, and that is what makes it easy to use; common tasks have
built-in facilities to make them intuitive or unnecessary, whereas
simpler languages require these to be implemented by the programmer.
------------------------------
Date: Wed, 24 Oct 2001 09:55:07 GMT
From: Tim Hammerquist <tim@vegeta.ath.cx>
Subject: Re: Perl Vs. Java
Message-Id: <slrn9td4rm.3i7.tim@vegeta.ath.cx>
Me parece que David Wall <darkon@one.net> dijo:
[ snip ]
> (I don't have an informed opinion, so I'll bow out of this thread.)
> (My *uninformed* opinion is that Java looks painful. :-)
This _better_ informed opinion backs yours up. Java _is_ painful...at
least on my fingers. *lugs out Java manual [1]* The Welcome.java example
(a glorified "Hello World") is 6+ lines. Christ! 6 lines to print 2
words?! How many lines would it take simply to scan a file for a
certain record? Hmm, first we have to deal with opening files...
Let's skim the TOC, shall we?
Ch. 1 - Intro to Java (no code at all here)
Ch. 2 - The Java Programming Environment (...nor here)
Ch. 3 - Fundamental Programming Structures in Java
(Ahh! Actual real, live Java code!)
Ch. 4-11 (still no files)
Ch. 12 - Streams and Files (Oh my God! The 12th and final chapter!)
...and 10 pages into the chapter we actually see code that involves
opening a genuine file. (Of course, Java's ultra-verbose syntax requires
the single open statement to be drug out over several lines, making the
resulting statement resemble Lisp...but at least they indent. =)
The OP mentioned that some others in his org. insisted on Java for
text-processing...well, if it's not XML _and_ it doesn't have to scale real
high, I'd use Perl anyway. If it's XML _and/or_ needs to scale well,
I'd use Python. Both Perl and Python beat out Java for power,
development speed, and execution speed.
And if (God forbid!) you have any problems while programming, there are
literally millions of pages of documentation on Perl available online
and inside the standard distribution. There's support for Java, too,
but it's, hmm,
P - average cost to answer a Perl question
J - average cost to answer a Java question
Px = J
x = J/P and P = 1e-30 (or 0)
x = J/0
Ah, hell, I don't wanna do this! Lets let Java figure this out for me!
$ cat > DivZero.java
public class DivZero {
public static void main(String[] args) {
int x = 1/0;
System.out.println(x);
}
}
^D
$ javac DivZero.java # and wait...
$ java DivZero
Exception in thread "main" java.lang.ArithmeticException: / by zero
at DivZero.main(DivZero.java:3)
Huh?! Oh, yeah; I see that '/ by zero...'. Hmm. Ok, now Perl.
$ perl -e 'print 50/0, "\n";'
Illegal division by zero at -e line 1.
Oh! Much better. Let's see what else we can get from perl:
$ perl -Mdiagnostics -e 'print 50/0, "\n";'
Illegal division by zero at -e line 1 (#1)
(F) You tried to divide a number by 0. Either something was
wrong in your logic, or you need to put a conditional in to
guard against meaningless input.
Uncaught exception from user code:
Illegal division by zero at -e line 1.
$
Ok, computer math fails us (perl and java alike). However, we know from
basic function graphs that P approaches 0, x approaches infinity. So we
see that Java help is infinitely more expensive than Perl help.
Show your superiors that. ;)
(All in good fun! =)
Tim
[1] Core Java 1.2 - Vol. 1 - Fundamentals
Part of the Sun Microsystems Press Java Series
Pub. Sun Microsystems
(As the body states, it's lacking in some material, but you can
always buy the rest of the set!)
--
All language designers are arrogant. Goes with the territory...
-- Larry Wall
------------------------------
Date: Wed, 24 Oct 2001 10:12:05 +0200
From: "Robert" <robert_loui@yahoo.com>
Subject: Reading parameter from a string
Message-Id: <9r5rts$f1v$1@newstoo.ericsson.se>
Hi every one
Could some one please tell me how i could get my parameters from a string. i
have an input string like:
my $input = "This Input (Must be a Name ): "Robert"";
1- What should i do, if i only want to get Robert ? for example
my $this_name = "Robert";
2- And What should do if iwant to have,
my $which_input = "This Input";
my $what_type = "Must be a Name";
my $name = "Robert";
Thank in advance Robert
------------------------------
Date: 24 Oct 2001 08:42:59 GMT
From: Bernard El-Hagin <bernard.el-hagin@lido-tech.net>
Subject: Re: Reading parameter from a string
Message-Id: <slrn9tcvch.3nk.bernard.el-hagin@gdndev25.lido-tech>
On Wed, 24 Oct 2001 10:12:05 +0200, Robert <robert_loui@yahoo.com> wrote:
> Hi every one
>
> Could some one please tell me how i could get my parameters from a string. i
> have an input string like:
>
> my $input = "This Input (Must be a Name ): "Robert"";
Syntax error.
> 1- What should i do, if i only want to get Robert ? for example
>
> my $this_name = "Robert";
>
> 2- And What should do if iwant to have,
> my $which_input = "This Input";
> my $what_type = "Must be a Name";
> my $name = "Robert";
You're not very clear on what criteria you use to split the string,
but assuming ()s and : (and assuming no syntax error) try:
my $input = "This Input (Must be a Name ): 'Robert'";
my( $which_input, $what_type, $name ) =
$input =~ /^([^(]*?)\s*\(([^)]*?)\s*\)\s*:\s*'([^']*)'/;
Cheers,
Bernard
------------------------------
Date: Wed, 24 Oct 2001 10:02:29 +0100
From: Simon Oliver <simon.oliver@umist.ac.uk>
To: Robert <robert_loui@yahoo.com>
Subject: Re: Reading parameter from a string
Message-Id: <3BD683A5.719DD51C@umist.ac.uk>
First, you must escape your quotes around Robert or use qq{}:
my $input = "This Input (Must be a Name ): \"Robert\"";
Then something like this should work
my ($which_input, $what_type, $name) = $input =~ /(.*) \((.*) \):
"([^"]*)"/;
--
Simon
------------------------------
Date: Wed, 24 Oct 2001 16:26:54 +1000
From: Justin Wills <jwills@orange.net.au>
Subject: reading pipes
Message-Id: <3BD65F2E.57ECDE54@orange.net.au>
Ive got a perl script that in turn runs a shell script (init script)
that fires up a daemon. the problem is that the daemon fires up, and
then the controlling shell script goes zombie. I'm waiting for output
from the shell script, but I never get it. it never goes out of zombie
either. the code looks like the following:
if(open(RUNSCRIPT, "$prog|"))
{
@output=<RUNSCRIPT> ;
}
else
{
writelog("prob running $prog: $!");
}
print @output;
thanx for any help in advance
------------------------------
Date: Wed, 24 Oct 2001 02:51:00 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: reading pipes
Message-Id: <3BD664D4.6D56C7DF@earthlink.net>
Justin Wills wrote:
>
> Ive got a perl script that in turn runs a shell script (init script)
> that fires up a daemon. the problem is that the daemon fires up, and
> then the controlling shell script goes zombie. I'm waiting for output
> from the shell script, but I never get it. it never goes out of
> zombie either. the code looks like the following:
[snip]
The line @output=<RUNSCRIPT> won't complete until $prog exits.
What is $prog ?
--
Klein bottle for rent - inquire within.
------------------------------
Date: Wed, 24 Oct 2001 04:04:58 GMT
From: Fe <f.galassi@e-mind.it>
Subject: Re: Regular expression stumps me ...
Message-Id: <cadcttk0h460ptp9938k2emnj8ntm8su7e@4ax.com>
On 23 Oct 2001 16:44:23 -0700, marlon_jackson@yahoo.com (Marlon
Jackson) wrote:
m// s/// tr/// work like quote constructs q qq qx qw ... etc..
so you can choose customary delimiters
any nonwhitespace char may be used as delimiter hence the pipe is
perfectly valid.
but there are limitations.
-you must put a whitespace between the operator and the first
delimiter if it's in the \w class, or it would be interpreted as part
of an identifier
i.e. s_hello_hi_ must be s _hello_hi_
- you cant put a whitespace between the operator and the first
delimiter if it's #, or it would interpreted as a comment
i.e. m #hey# must be m#hey#
- if you use bracketing characters ()[]{}<> as delimiters you must
pair them
i.e. tr[a-z[A-Z[ must be tr[a-z][A-Z] , but you could mix them as in
tr[a-z]<A-Z>
- you can abbreviate the m// construct to // only if you use the slash
as delimiter
i.e. !hoho! must be m!hoho!
- if you use the single quote as delimiter, no interpolation happens
and that's really a feature
i.e. s'$var'myvar' is equal to s{\$var}{myvar}
...and there are probably more.
that said, i would stay away from alphanumeric delimiters
cos they can be pretty confusing
#!/usr/bin/perl
$_ = 'japh';
s s . s y yayydssexg;
print "$_ bottles of beer on the wall";
>I can't figure out what this line does:
>
> $build_dir =~ s|^.*/$source_root/||o;
>
>It seems like it's doing a substitution with an "o" modifier. But I
>don't know what the pipe chars do here. Aren't those usually used as
>ORs?
>
>Thanks, Marlon
------------------------------
Date: Wed, 24 Oct 2001 18:34:31 +1000
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: SDBM_File size limit?
Message-Id: <slrn9tcv8n.tne.mgjv@martien.heliotrope.home>
On Tue, 23 Oct 2001 11:48:45 -0500,
Bing Du <bing-du@tamu.edu> wrote:
> Running the Perl script attached below returns the following error:
>
> "sdbm store returned -1, errno 22, key "memo" at ./z.cgi line xxx."
>
> Basically, the scripts tries to store a hash with only one key 'memo'
> into a SDBM database and then retrieve it right away. But it failed
> when writing. Seems there is not any problem if the text written is not
> very long.
>
> Does SDBM have any size limit on each field?
$ man SDBM_File
[snip]
BUGS AND WARNINGS
There are a number of limits on the size of the data that
you can store in the SDBM file. The most important is
that the length of a key, plus the length of its associ
ated value, may not exceed 1008 bytes.
[SNIP]
If you're on a system that doesn't have man(1), the same can be achieved
with perldoc. If you have ActiveState Perl, there's also some HTML
installed for you. On Mac, use Shuck.
I would advise you to use DB_File instead.
Martien
--
|
Martien Verbruggen | life ain't fair, but the root
| password helps. -- BOFH
|
------------------------------
Date: 24 Oct 2001 01:50:11 -0700
From: gregm@eit.ltd.uk (Gregski)
Subject: Split on Win32
Message-Id: <dbbc3646.0110240050.62a6d232@posting.google.com>
I've spent an extensive amount of time looking for an answer to this
question, so I suspect it maybe something I've overlooked.
if I do:
$result = `nslookup -type=ns mydomain.com`;
arrline = split(/\n/,$result);
foreach (<@arrline>) { print "\nLine: $_ \n "; }
then why is split splitting on whitespaces? I've got round it by doing
$result =~ s/ /£/g;
arrline = split(/\n/,$result);
foreach (<@arrline>) { s/£/ /g; }
but it's crap, and it only works in this example because I know the
output only includes spaces. I'm really frustrated. Help.
Gregski
------------------------------
Date: 24 Oct 2001 08:56:41 GMT
From: Bernard El-Hagin <bernard.el-hagin@lido-tech.net>
Subject: Re: Split on Win32
Message-Id: <slrn9td067.3nk.bernard.el-hagin@gdndev25.lido-tech>
On 24 Oct 2001 01:50:11 -0700, Gregski <gregm@eit.ltd.uk> wrote:
> I've spent an extensive amount of time looking for an answer to this
> question, so I suspect it maybe something I've overlooked.
>
> if I do:
>
> $result = `nslookup -type=ns mydomain.com`;
> arrline = split(/\n/,$result);
Syntax error.
Anyway, try this instead:
my @arrline = `nslookop -type=ns mydomain.com`;
> foreach (<@arrline>) { print "\nLine: $_ \n "; }
I'm sure you meant:
foreach( @arrline ){
print "\nLine: $_\n";
}
The <> operator reads from a filehandle.
> then why is split splitting on whitespaces? I've got round it by doing
It's not. It doesn't compile so it can't be splitting on whitespaces.
Cheers,
Bernard
------------------------------
Date: Wed, 24 Oct 2001 10:16:33 +0100
From: Simon Oliver <simon.oliver@umist.ac.uk>
Subject: Re: Split on Win32
Message-Id: <3BD686F1.E93BD10E@umist.ac.uk>
my @lines = `nslookup -type=ns mydoamin.com`;
foreach (@lines) {
print "\nLine: $_";
}
------------------------------
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 1995
***************************************