[16666] in Perl-Users-Digest
Perl-Users Digest, Issue: 4078 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 21 09:05:44 2000
Date: Mon, 21 Aug 2000 06:05:15 -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: <966863115-v9-i4078@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 21 Aug 2000 Volume: 9 Number: 4078
Today's topics:
Re: [Q]s: sizeof in perl, ioctl.ph... <iltzu@sci.invalid>
Cookie problem (chrs in value) <ljg@star.le.ac.uk>
Re: Embedding Perl akdwivedi@hotmail.com
Re: finding out which program enters your script (Martien Verbruggen)
Re: form replies in HTML <iltzu@sci.invalid>
Hash List Comparing (ScapS)
Re: Hash List Comparing (Marcel Grunauer)
Help! How to solve the problem? hewuma@yahoo.com
how to generate unreadable from readable perl code (Anno Siegel)
Re: how to generate unreadable from readable perl code (Martien Verbruggen)
Re: how to generate unreadable from readable perl code (Anno Siegel)
Re: how to generate unreadable from readable perl code (Rafael Garcia-Suarez)
HTML <mcnultya@NOSPAMnortelnetworks.com>
Re: IE is OK but NC4 is wrong (Martien Verbruggen)
Re: Opening new processes... <superman183@hotmail.com>
Re: Opening new processes... (Martien Verbruggen)
Re: Opening new processes... <superman183@hotmail.com>
Re: Opening new processes... (Anno Siegel)
Re: Opening new processes... nobull@mail.com
Parsing a variable (B Gannon)
Re: Parsing a variable <khaines@oshconsulting.com>
Re: Parsing a variable <lincolnmarr@nospam.europem01.nt.com>
PERL and FTP dob_3001@my-deja.com
Perl CGI/forms question arctic@pdinnen.plus.com
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 21 Aug 2000 11:39:23 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: [Q]s: sizeof in perl, ioctl.ph...
Message-Id: <966857633.6724@itz.pp.sci.fi>
In article <8mulbk$khv$1@panix3.panix.com>, kj0 wrote:
> $x = pack "L", 1;
> syswrite OUT, $x, $sizeof_x;
>
>Someone please tell me how one finds $sizeof_x (portably).
This has been discussed before. The discussion can be found at
http://x65.deja.com/=dnc/viewthread.xp?AN=644216009
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
"The screwdriver *is* the portable method." -- Abigail
Please ignore Godzilla and its pseudonyms - do not feed the troll.
------------------------------
Date: Mon, 21 Aug 2000 12:51:46 +0100
From: Liam Gretton <ljg@star.le.ac.uk>
Subject: Cookie problem (chrs in value)
Message-Id: <ant21114626eWhac@xmm4.xra.le.ac.uk>
Hi,
I'm trying to set a cookie where the value is a user's e-mail address. The
'@' symbol in the address is getting escaped to %40, but something's not
quite right because the browser is storing the cookie value as
ljg tar.le.ac.uk
(that's 40 spaces, and the 's' is missing) instead of
ljg%40star.le.ac.uk
Any idea what I'm doing wrong? perldoc CGI says that CGI.pm escapes and
unescapes as necessary, but something isn't working as expected here.
--
Liam Gretton ljg@star.le.ac.uk
Space Research Centre, http://www.src.le.ac.uk/
Physics and Astronomy Dept, phone +44 (0) 116 223 1039
University of Leicester, fax +44 (0) 116 252 2464
Leicester LE1 7RH, UK http://xmm4.xra.le.ac.uk/
------------------------------
Date: Mon, 21 Aug 2000 10:44:51 GMT
From: akdwivedi@hotmail.com
Subject: Re: Embedding Perl
Message-Id: <8nr170$vis$1@nnrp1.deja.com>
> > Larry Rosler <lr@hpl.hp.com> wrote:
> >
> >
> > ...
> >
> > > By the way, if you do this, you're going to end up mixing perl's
I/O
> > > buffering with C++'s, at least unless you use syswrite() and
sysread()
> > > under perl.
> >
> > I wonder if there is a problem. As the perl code and the C++ code
are
> > bound into one executable, wouldn't they each end up calling the
same
> > functions in te C I/O library, and using the same buffers?
>
> There's always the possibility that calls to the stream functions get
> mixed with direct system calls or other I/O calls. The C++ programmer
> doesn't know what Perl does internally (apart from looking at Perl's
> code, and that is something that shouldn't be necessary), and perl
> doesn't know what happens in the C++ program. Since this isn't really
> documented, you probably use it at your own peril, and probably make
it
> very unportable.
>
> I would avoid passing open file numbers around, and just pass the file
> name, and if you realy need to communicate this sort of information:
the
> file offset and anything else you need. Design a struct or class that
> has all this stuff, and make that your communication unit.
>
> Relying on both Perl internally, and your C++ and C libraries both to
not
> interfere with each other's file I/O is dangerous, unless you _know_
> what sort of I/O is being done in both.
>
> There might not be a problem, and there probably isn't, but I would
not
> want to take the risk. And what if the problem doesn't exist on
> platforms A and B, where you wrote and tested this? And you need to
port
> it to C, where it suddenly starts failing, mysteriously. You now have
> quite a lot of code to rewrite.
>
> Martien
> --
> Martien Verbruggen |
> Interactive Media Division |
> Commercial Dynamics Pty. Ltd. | Curiouser and curiouser, said Alice.
> NSW, Australia |
>
I know it's not wise to mix up the I/O calls. I should have rather
describe the problem first. My program has to read some usage data from
some input files and process them. based on certain user defined
criteria the program has to write the data in different files. For the
sake of flexibility, we don't want to hard code the file structure, user
criteria and the routing criteria in the C++ code. Rather I would like
my C++ code to interface with a perlscript which could be easilt edited
by the user. The script holds all the details of file structure, routing
etc.
The program typically reads from one input file and writes many output
files. The names location of the output files is determined by the C++
code. The PerlInterface (my C++ code) calls script to open files
(read/write), the perlscript opens the files n passes the filehandle to
Interface. The Interface then uses these filehandles to tell the script
to read the next chunk of data and to which file (fd) to write the
processed data. I know it's a typical application..
Anoop
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 21 Aug 2000 20:53:45 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: finding out which program enters your script
Message-Id: <slrn8q22hp.sqb.mgjv@martien.heliotrope.home>
[f'ups set]
On Mon, 21 Aug 2000 11:45:16 +0200,
Raymond J.W. Jacobs <king@sjako.demon.nl> wrote:
> As we all know it is a simple subroutine which let you find out from which
> reffering site a perlprogramm is accesed. I wonder if it is possible to find
> out from which programm on the clients-server your perlscript is being
> accesed. I imagine it works in the same way as "HTTP_REFERER".
I think it might _BE_ that particular environment variable that you're
talking about. Perl has nothing builtin to deal with the web or CGI. It
has to use the same interface (CGI) as any other programming language to
do this stuff.
> Of course I could look for the protocol being used. But I wonder what
> happens if you acces a url from a mailprogram like Outlook Express. Which
> protocol will it use? I guess http. But what I want to know if this url is
> accesed from Outlook Express or Internet explorer. (Or Netscape or Eudora,
> whatsoever)
If you run a CGI program, and it runs on behind a HTTP server (which is
what CGI is defined for), then the protocol will be HTTP, possibly over
SSL. It _cannot_ be anything else. The client can be anything it wants,
even some Microsoft abomination, but it _has_ to talk HTTP to get any
response from the server.
Maybe you are talking about the USER_AGENT or HTTP_USERAGENT environment
variable or something like that[1]
> 1. Could somebody help me with a list of possibilities to find out about
> environmental variables, where I can find the correct code.
They're the standard CGI environment variables. The contents, and their
reliability depend on your HTTP server. This is hardly the place to
provide you with correct information on the CGI specification.
> 2. Could somebody help me with a list of responses of the various
> commonly used programs like browsers, emailprograms, ftp-programs.
Responses? The client do not respond. They request. The server responds.
I have a hard tim eunderstanding what you are asking here.
If you want to discuss the CGI, HTTP, or browsers and HTTP clients, you
should be in one of the comp.infosystems.www.* groups. You ask questions
about Perl here, but questions about other things in the appropriate
place. You wouldn't ask your butcher to repair your car, would you? Even
if he/she was willing to do it? Same principle here: You ask the people
who are most likely to know best.
Read up on CGI. Start at http://www.cgi-resources.com/, and start at the
Documentation section.
Alternatively, and this may save you a lot of time, you could start
using the CGI.pm module. It still requires you to at least understand
how CGI works, and what it does and doesn't do, but at least it hides
all the nasties of the interface behind a nice and clean OO interface,
and protects you from making the same mistakes that almost everyone
makes.
Martien
[1] DO NOT correct me here if that's wrong. This is a Perl group, not a
CGI group. If someone wants the correct variable name, the rest of the
article points them to a place to go.
--
Martien Verbruggen |
Interactive Media Division | Failure is not an option. It comes
Commercial Dynamics Pty. Ltd. | bundled with your Microsoft product.
NSW, Australia |
------------------------------
Date: 21 Aug 2000 11:29:24 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: form replies in HTML
Message-Id: <966856769.3540@itz.pp.sci.fi>
In article <8mujvc$2s7$1@mawar.singnet.com.sg>, Kimochi3D wrote:
>Is it possible to receive html emails from a self made script? Is it as
>simple as placing the <HTML> tags into the output meant for the targeted
You need to add the appropriate MIME headers. From memory:
MIME-Version: 1.0
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
Of course, if you're not using the charset and encoding I gave above,
you need to change the lines to match whatever you are using.
Oh, and this isn't a Perl question. Followups set.
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
"The screwdriver *is* the portable method." -- Abigail
Please ignore Godzilla and its pseudonyms - do not feed the troll.
------------------------------
Date: Mon, 21 Aug 2000 11:52:22 GMT
From: ScapS@dds.nl (ScapS)
Subject: Hash List Comparing
Message-Id: <39a1172a.256561571@news.iae.nl>
Hi, is there anybody out there who can help me out??
I'd really like to know how I can use an expression to see
if a key/pair value in a hash exists.
An example will make it a lot clearer I guess =))
so here it comes:
I fill a hash with input from a User
But the User should fill at least the first 4 fields:
%hash=( "A" , "anton" , "B" , "ben" , "C","conrad", "D" , "donald" ,
"E", "");
Or the first 4 fields must be empty
%hash=("A" , "" , "B" , "" , "C", "" , "D" , "" , "E",
"doesnt_matter");
Anything in between should return an error page:
What would B the code if I'D like to say:
If the key/pair values of Element A and B and C and D are filled or
the key/pair values of Element A and B and C and D are NOT filled then
go
else return an error page
Thx a lot if you can help me out!!!
------------------------------
Date: Mon, 21 Aug 2000 12:05:59 GMT
From: marcel@codewerk.com (Marcel Grunauer)
Subject: Re: Hash List Comparing
Message-Id: <slrn8q26o8.2gl.marcel@gandalf.local>
On Mon, 21 Aug 2000 11:52:22 GMT, ScapS <ScapS@dds.nl> wrote:
>I'd really like to know how I can use an expression to see
>if a key/pair value in a hash exists.
print "error" if grep { not length } @hash{qw/A B C D/};
takes the list of hash values from the specified keys and tests if each
one has a length of 0 (i.e., is not filled), then returns those as a
list. If there is such a return list, it prints "error".
This is ok for small arrays or programs that aren't time-critical. It's
quite wasteful to go through the whole list, since you could stop after
finding one element that has length 0.
If, on the other hand, you want to have a list of keys whose values are
undefined, you'll have to modify this approach slightly:
my @empty = grep { not length $hash{$_} } qw/A B C D/;
Now @empty will contain a list of keys whose values have length 0.
Obviously, to test for hash keys whose values _are_ filled in, just
leave out the 'not' in the grep()'s test block.
--
Marcel Gr\"unauer - Codewerk plc . . . . . . . . . . . <http://www.codewerk.com>
Perl Consulting, Programming, Training, Code review . . . <marcel@codewerk.com>
mod_perl, XML solutions - email for consultancy availability
sub AUTOLOAD{($_=$AUTOLOAD)=~s;^.*::;;;y;_; ;;print} Just_Another_Perl_Hacker();
------------------------------
Date: Mon, 21 Aug 2000 11:27:46 GMT
From: hewuma@yahoo.com
Subject: Help! How to solve the problem?
Message-Id: <8nr3n4$2c0$1@nnrp1.deja.com>
Hi All!
I have a question.
My scripts run successfully in Linux. When run it in browser? Small one
is running well. But for the
large perlscript, I got following error message:
The page cannot be displayed
The page you are looking for is currently unavailable. The Web site
might be experiencing technical difficulties, or you may need to adjust
your browser settings.
(snip)
Cannot find server or DNS Error
Internet Explorer
How to solve the problem?
Hope anybody can answer my question
Hewu
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 21 Aug 2000 10:15:20 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: how to generate unreadable from readable perl code
Message-Id: <8nqvfo$uc9$1@lublin.zrz.tu-berlin.de>
Martien Verbruggen <mgjv@tradingpost.com.au> wrote in comp.lang.perl.misc:
>On Sat, 19 Aug 2000 09:42:27 +0200,
> Horst Wassenberg <horst@swid.de> wrote:
[...]
>> Hence, I would like to run a program that replaces my "long name var
>> names" with something like "$V00001" to "$V99999" or similar, that
>> replaces sub-names in a similar mannor, that deletes all comments,
>> removes all indenting white space etc.
>
>That is useless. Wouldn't stop anything.
Agreed.
>> => where can I find such a program?
>
>If that's all you want to do, and you control the source you need to
>transform: It's trivial to write that.
The way I understand the OP, he wants a program that finds and replaces
all identifiers in a Perl source. It would have to understand that
"tr%hash%HASH%" doesn't refer to the variable "%hash". Far from trivial.
Anno
------------------------------
Date: Mon, 21 Aug 2000 20:35:09 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: how to generate unreadable from readable perl code
Message-Id: <slrn8q21et.sqb.mgjv@martien.heliotrope.home>
On 21 Aug 2000 10:15:20 -0000,
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> Martien Verbruggen <mgjv@tradingpost.com.au> wrote in comp.lang.perl.misc:
>
> >If that's all you want to do, and you control the source you need to
^^^^^^^^^^^^^^^^^^^^^^^^^^
> >transform: It's trivial to write that.
>
> The way I understand the OP, he wants a program that finds and replaces
> all identifiers in a Perl source. It would have to understand that
> "tr%hash%HASH%" doesn't refer to the variable "%hash". Far from trivial.
I underlined a crucial part of my remark. I know fully well that parsing
Perl source in general is hard. However, _if_ you want to obfuscate
variables, you can write the code in such a way that it is easily
parseable. And you can do so without much trouble. Perl is hard to parse
because it allwos so many things. In real life code very few of the hard
to parse things occur.
Besides, anyone who uses %, @ or $ as a separator for s///, tr///, m//
or qq and related operators, should be taken outside behind the shed,
and summarily shot :)
Martien
--
Martien Verbruggen |
Interactive Media Division | Begin at the beginning and go on till
Commercial Dynamics Pty. Ltd. | you come to the end; then stop.
NSW, Australia |
------------------------------
Date: 21 Aug 2000 11:48:29 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: how to generate unreadable from readable perl code
Message-Id: <8nr4ud$ugb$1@lublin.zrz.tu-berlin.de>
Martien Verbruggen <mgjv@tradingpost.com.au> wrote in comp.lang.perl.misc:
>On 21 Aug 2000 10:15:20 -0000,
> Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>> Martien Verbruggen <mgjv@tradingpost.com.au> wrote in comp.lang.perl.misc:
>>
>> >If that's all you want to do, and you control the source you need to
> ^^^^^^^^^^^^^^^^^^^^^^^^^^
>> >transform: It's trivial to write that.
>>
>> The way I understand the OP, he wants a program that finds and replaces
>> all identifiers in a Perl source. It would have to understand that
>> "tr%hash%HASH%" doesn't refer to the variable "%hash". Far from trivial.
>
>I underlined a crucial part of my remark. I know fully well that parsing
>Perl source in general is hard. However, _if_ you want to obfuscate
>variables, you can write the code in such a way that it is easily
>parseable. And you can do so without much trouble. Perl is hard to parse
>because it allwos so many things. In real life code very few of the hard
>to parse things occur.
So you're saying there is a set of rules such that if a Perl source
is written accordingly it it easy to (for instance) recognize all
Perl identifiers and skip identical strings that aren't identifiers?
Not to speak of other requirements, like comment parsing, recognition
of quoted text, etc....
>Besides, anyone who uses %, @ or $ as a separator for s///, tr///, m//
>or qq and related operators, should be taken outside behind the shed,
>and summarily shot :)
Well, that might become one of the rules. How many others are there?
My guts feeling is, you'll end up with a set of rules that make it
very hard to code something meaningful without getting shot.
Anno
------------------------------
Date: Mon, 21 Aug 2000 11:48:37 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: how to generate unreadable from readable perl code
Message-Id: <slrn8q263c.5u1.rgarciasuarez@rafael.kazibao.net>
Anno Siegel wrote in comp.lang.perl.misc:
>
>The way I understand the OP, he wants a program that finds and replaces
>all identifiers in a Perl source. It would have to understand that
>"tr%hash%HASH%" doesn't refer to the variable "%hash". Far from trivial.
Even removing comments is non-trivial:
s#\#.*$##;# does not work
However, hacking on the basis of B::Deparse may help.
--
Rafael Garcia-Suarez
------------------------------
Date: 21 Aug 2000 10:21:15 GMT
From: Antony <mcnultya@NOSPAMnortelnetworks.com>
Subject: HTML
Message-Id: <8nqvqr$sl1$1@qnsgh006.europe.nortel.com>
Hi,
Is there a way to retrieve an HTML file from a location on the web using PERL?
I want to write a perl script to get this information and extract parts of it to update a local DB.
Cheers in advance,
Antony
------------------------------
Date: Mon, 21 Aug 2000 20:56:57 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: IE is OK but NC4 is wrong
Message-Id: <slrn8q22np.sqb.mgjv@martien.heliotrope.home>
> Subject: Re: IE is OK but NC4 is wrong
It is more likely the other way around, but this is not the place to
discuss that.
On Mon, 21 Aug 2000 17:58:49 +0900,
sang <laoxiu100@hotmail.com> wrote:
> It is OK in IE5
> but it is wrong in Netscape 4.73, i cannot get data.
If it is ok in one browser, but not in another, then there is no Perl
problem. You should probably read the perl FAQ part 9, which was
specifically written for these sorts of problems. Then you should have a
look at the HTML that is produced, and see what is different, or maybe
not correct. Perl seems to be doing its job
The Perl FAQ is installed on each hard drive that contains Perl:
# perldoc perlfaq
# perldoc perlfaq9
For the people with MS Win: start->programs->activestate->help or
something like that. It'll give you the same documentation, formatted a
HTML.
Martien
--
Martien Verbruggen |
Interactive Media Division | Hi, Dave here, what's the root
Commercial Dynamics Pty. Ltd. | password?
NSW, Australia |
------------------------------
Date: Mon, 21 Aug 2000 07:00:56 -0400
From: "Dave" <superman183@hotmail.com>
Subject: Re: Opening new processes...
Message-Id: <39a10cfd_3@news1.prserv.net>
Thanks for the input Martien....
Hmm, maybe you're right about the time difference thing...I guess I'm
thinking that it's better to start three processes simultaneously and get
everything back after maybe seven or eight seconds rather than to wait 3*six
or seven seconds, but I'm not familiar enough with how the processor would
handle those requests to know if what I think happen, would actually happen.
Yeah, I'm on a Linux box.
I did look at 'fork', but I get the impression that it's only going to kick
off another instance of the same script, rather than allow me to kick off
other scripts.....is that the case? or am I not fully understanding how fork
can be used......
Thanks again, hope you can come back to this thread and enlighten me some
more...Dave
------------------------------
Date: Mon, 21 Aug 2000 22:10:05 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Opening new processes...
Message-Id: <slrn8q270t.uou.mgjv@martien.heliotrope.home>
On Mon, 21 Aug 2000 07:00:56 -0400, Dave <superman183@hotmail.com>
wrote:
> Thanks for the input Martien....
>
> Hmm, maybe you're right about the time difference thing...I guess I'm
> thinking that it's better to start three processes simultaneously and
> get everything back after maybe seven or eight seconds rather than to
> wait 3*six or seven seconds, but I'm not familiar enough with how the
> processor would handle those requests to know if what I think happen,
> would actually happen.
It all depends on what these individual scripts do. If they are all very
CPU intensive, or if they all very heavily read or write to the same
disk or network interface, they will interfere with each other's
runtime,and probably will take longer to complete when run at the same
time. However, if one is CPU intensive, another one writes to disk 1,
and another one to disk2, and yet another one uses the network, then you
will benefit from running them at the same time. It really depends
strongly on the applications.
Another reason for wanting to fork off subprocesses would be to not
block on operations, i.e. the application's interface would be free to
respond to user requests or actions while other things are being done
behind the screens. I have a data input application somewhere that used
to do all of its database initialisation in a fork, just so that the
startup time would be (preceived to be) low. Operators could start
working with the application while it was still initialising.
> Yeah, I'm on a Linux box.
Good. Makes life easier than being on an NT box, although ActiveState
perl based on 5.6 seems to emulate fork with threads nowadays.
> I did look at 'fork', but I get the impression that it's only going to
> kick off another instance of the same script, rather than allow me to
> kick off other scripts.....is that the case? or am I not fully
> understanding how fork can be used......
Yes... Fork does kick off an instance of the same script which starts
executing at almost the same place as the parent. However, you can
distinguish between which is the child, and which the parent, so you can
do different things. If you want to run a totally different program,
you'd normally do an exec after that.
I just posted some code in another thread about a Tk application that
forks, I'll post some here as well. You will want to read the perlipc
manual page as well, and if you have the perl Cookbook, read parts of
chapters 16 and 17.
#!/usr/local/bin/perl -w
use strict;
sub REAPER
{
my $pid = wait;
# .. do things with $pid if necessary
$SIG{CHLD} = \&REAPER;
}
$SIG{CHLD} = \&REAPER;
spawn(\&child1);
spawn(\&child2);
# Wait for all the children to finish
wait;
# Do post processing here
exit 0;
sub child1
{
# Child 1 code
sleep 3;
print "Child one, pid $$\n";
return 0;
}
sub child2
{
# Child 2 code
sleep 1;
print "Child two, pid $$\n";
return 0;
}
# This is how we spawn
sub spawn
{
my $coderef = shift;
die "USAGE: spawn CODEREF"
unless $coderef && ref($coderef) eq 'CODE';
my $pid;
if (!defined($pid = fork))
{
die "cannot fork: $!";
return;
}
elsif ($pid)
{
# Only process even pids.
print "process $$ spawned child with pid $pid\n";
return; # Parent
}
# else I'm the child, go ahead
exit &$coderef(@_);
}
OUTPUT:
process 31654 spawned child with pid 31655
process 31654 spawned child with pid 31656
Child two, pid 31656
Child one, pid 31655
There are issues with buffering and all sorts of other things. Careful
reading of perlipc, and archives on this group should help. Getting the
Perl Cookbook or a good Unix programming book would also help. Don't
bother reading the Linux man pages, they suck.
Martien
--
Martien Verbruggen |
Interactive Media Division | Failure is not an option. It comes
Commercial Dynamics Pty. Ltd. | bundled with your Microsoft product.
NSW, Australia |
------------------------------
Date: Mon, 21 Aug 2000 08:33:18 -0400
From: "Dave" <superman183@hotmail.com>
Subject: Re: Opening new processes...
Message-Id: <39a122a4_2@news1.prserv.net>
Hey, I really appreciate you taking the time to explain everything.....thank
you.
The scripts are probably not too processor intensive, since each one would
only be going off and grabbing an html page from a predefined site, (each
script = one different site), and then the parent process would wait few
seconds and process the files retrieved, so I guess that running them
simultaneously would have some good time benefits probably.
Well, it's going to take me a while to digest the rest of the code which you
enclosed, but it looks like it will probably be very useful to me....so
thanks in advance, and thanks again for your time.
Best regards,
Dave
------------------------------
Date: 21 Aug 2000 12:44:12 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Opening new processes...
Message-Id: <8nr86s$uja$1@lublin.zrz.tu-berlin.de>
Martien Verbruggen <mgjv@tradingpost.com.au> wrote in comp.lang.perl.misc:
>On Mon, 21 Aug 2000 07:00:56 -0400, Dave <superman183@hotmail.com>
> wrote:
>It all depends on what these individual scripts do. If they are all very
>CPU intensive, or if they all very heavily read or write to the same
>disk or network interface, they will interfere with each other's
>runtime,and probably will take longer to complete when run at the same
>time. However, if one is CPU intensive, another one writes to disk 1,
>and another one to disk2, and yet another one uses the network, then you
>will benefit from running them at the same time. It really depends
>strongly on the applications.
It also depends on what else is happening on the machine. If you
are competing for resources, forking more processes can increase
your share (some may say, unfairly).
Anno
------------------------------
Date: 21 Aug 2000 13:42:02 +0100
From: nobull@mail.com
Subject: Re: Opening new processes...
Message-Id: <u94s4edbvp.fsf@wcl-l.bham.ac.uk>
"Dave" <superman183@hotmail.com> writes:
> print "about to make request 1...\n\n";
> open(FN,"|perl ../123/myshell1.pl > /dev/null 2>&1");
>
> print "about to make request 2...\n\n";
> open(FN,"|perl ../123/myshell2.pl > /dev/null 2>&1");
> but each new process is only kicked off when the previous one has finished,
If you open() with a filehandle that's already open Perl implicitly
close()s the filehandle first. If you close() a pipe filehandle it
Perl waits for the piped job to finish (and puts the exit status in
$?).
Use a different filehandle for each child process, or since you are
not actually interested in the output, use some mechanism other than
open(). Maybe system("command &").
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 21 Aug 2000 12:15:52 GMT
From: admin@kopnews.co.uk (B Gannon)
Subject: Parsing a variable
Message-Id: <8nr6ho$h0k$1@news.liv.ac.uk>
Hello
I have a varaible $a=mailto:someone@somewhere.com?Subject=Feedback.
How do I split $a into $b=someone@somewhere.com and $c=Feedback
Thanks
B Gannon
------------------------------
Date: Mon, 21 Aug 2000 05:43:40 -0600
From: Kirk Haines <khaines@oshconsulting.com>
Subject: Re: Parsing a variable
Message-Id: <39A115EC.73060843@oshconsulting.com>
B Gannon wrote:
>
> Hello
>
> I have a varaible $a=mailto:someone@somewhere.com?Subject=Feedback.
>
> How do I split $a into $b=someone@somewhere.com and $c=Feedback
my ($b,$c) = $a =~ /mailto:([^\?]+)\?subject=(.*)$/i;
The above may fail if the format of your variable is not always like
the example. Specifically, It assmes a 'mailto:' immediately
followed by something of interest. As soon as a '?' is encountered,
that thing of interest is at an end, and it expects to find that
'?', followed by 'subject=' and then a final thing of interest that
extends to the end of the string.
Kirk Haines
------------------------------
Date: Mon, 21 Aug 2000 14:40:32 +0200
From: "Lincoln Marr" <lincolnmarr@nospam.europem01.nt.com>
Subject: Re: Parsing a variable
Message-Id: <8nr7v8$3en$1@qnsgh006.europe.nortel.com>
> How do I split $a into $b=someone@somewhere.com and $c=Feedback
@split = split(/?/,$_);
$b = $split[0];
$c = $split[1];
I'm not sure but you may also need to escape the question mark (ie do \?
instead of just ? ). Hope this helps
--Lincoln
------------------------------
Date: Mon, 21 Aug 2000 10:51:09 GMT
From: dob_3001@my-deja.com
Subject: PERL and FTP
Message-Id: <8nr1in$vuj$1@nnrp1.deja.com>
Hi,
I want to use PERL to transfer a file from a NT or Win9x to a UNIX
machine. I've looked on CPAN and found TFTP and although this would
work it is not secure enough! Is there an alternative way to transfer a
file? The UNIX machine is not on the internal network so SAMBA will not
work.
We want to steer clear of FTP due to the size the log file gets (we do
a transfer every 3ish seconds).
Any pointers would be a great help!
James
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 21 Aug 2000 12:28:05 GMT
From: arctic@pdinnen.plus.com
Subject: Perl CGI/forms question
Message-Id: <8nr787$63v$1@nnrp1.deja.com>
ATM i am working on a project, a simple form with some Perl (Win32)
scripted validation writing to a flat file. This project involves my
looking at security issues, which i haven't got much experience in. I
have looked at various FAQs, including: -
http://www.go2net.com/people/paulp/cgi-security/safe-cgi.txt
http://www.perl.com/CPAN-local/doc/FAQs/cgi/wwwsf1.html
I would be interested in any other useful CGI/Perl security resources
thart people can reccomend.
My specific query is regarding the use of HTML forms. The scripts that
i have inherited generate the HTML of the form page from within the
script and then process the returned data within the same script. As
far as i can see it would be simpler to write the form as a straight
HTML page and only use Perl to validate and store the data. However i
might be missing something, can anyone suggest any security benefits to
either of these methods.
Thanks, Patrick Dinnen
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
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 4078
**************************************