[17819] in Perl-Users-Digest
Perl-Users Digest, Issue: 5239 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 4 19:36:33 2001
Date: Thu, 4 Jan 2001 16:36:18 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <978654977-v9-i5239@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 4 Jan 2001 Volume: 9 Number: 5239
Today's topics:
Perl and Sybase mike_vitale@ml.com
Re: Perl and Sybase <mpeppler@peppler.org>
Perl based web server <newsonly@please.com>
Re: Perl based web server (Rafael Garcia-Suarez)
Re: Perl based web server <newsonly@please.com>
Re: Perl based web server <newsonly@please.com>
Re: Perl based web server <newsonly@please.com>
Re: Perl based web server <uri@sysarch.com>
Re: Perl based web server (Abigail)
Re: Perl based web server <newsonly@please.com>
Re: Perl based web server <johngros@Spam.bigpond.net.au>
Re: Perl based web server (Eric Bohlman)
Re: Perl based web server <iltzu@sci.invalid>
Re: Perl based web server (Randal L. Schwartz)
Re: Perl based web server <newsonly@please.com>
Re: Perl based web server <kalinabears@hdc.com.au>
Perl Code Question <sferguson@rationalconsulting.com>
Re: Perl Code Question (Martien Verbruggen)
Re: Perl Code Question <newsonly@please.com>
Re: Perl Code Question <stephen@twocats.dont-spam.demon.co.uk>
Perl DBI and Oracle (Brian Busche)
Perl documentation in Info files <godoy@conectiva.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 03 Jan 2001 21:19:45 GMT
From: mike_vitale@ml.com
Subject: Perl and Sybase
Message-Id: <930517$pb6$1@nnrp1.deja.com>
I am using DBI and want to call a stored proc and pass parameters to
it. Specifically, I am looping through a text file and calling and
insert proc to put the data in a table. Does anyone have any sample
code of calling an sp and passing parameters to it?
Thanks,
Mike
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Thu, 04 Jan 2001 07:40:50 -0800
From: "Michael Peppler" <mpeppler@peppler.org>
Subject: Re: Perl and Sybase
Message-Id: <t596c3t0kk8c94@corp.supernews.com>
In article <930517$pb6$1@nnrp1.deja.com>, mike_vitale@ml.com wrote:
> I am using DBI and want to call a stored proc and pass parameters to it.
> Specifically, I am looping through a text file and calling and insert
> proc to put the data in a table. Does anyone have any sample code of
> calling an sp and passing parameters to it?
You just call the proc as you would any other SQL statement... assuming
you're proc doesn't return any rows you could do:
while(<>) {
chomp;
@data = split(/,/, $_);
$dbh->do("exec the_proc \@name='$data[0]', \@userId=$data[1], ...");
}
(add appropriate error checking, and validate string quoting before
using!)
A future version of DBD::Sybase will let you use prepare() with ?
placeholders for stored proc execution.
Michael
--
Michael Peppler - Data Migrations Inc. - mpeppler@peppler.org
http://www.mbay.net/~mpeppler - mpeppler@mbay.net
International Sybase User Group - http://www.isug.com
Sybase on Linux mailing list: ase-linux-list@isug.com
------------------------------
Date: 03 Jan 2001 07:26:23 GMT
From: "David Cunningham" <newsonly@please.com>
Subject: Perl based web server
Message-Id: <92uk6v$9of@dispatch.concentric.net>
I've written a minimal perl based web server. It binds to an IP on port 80
and waits for requests. I can make it deliver http to a web browser but I
can't seem to figure out what needs to happen to deliver gifs or jpgs. The
web server sends the binary image data to the web browser but the browser
doesn't seem to recognize it. Do I need to append some sort of header to
the image file? Can you recommend a good book on this sort of thing?
Thanks.
--
<|>/\\/|<|>
------------------------------
Date: Wed, 03 Jan 2001 07:48:29 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Perl based web server
Message-Id: <slrn955maf.6uk.rgarciasuarez@rafael.kazibao.net>
David Cunningham wrote in comp.lang.perl.misc:
> I've written a minimal perl based web server. It binds to an IP on port 80
> and waits for requests. I can make it deliver http to a web browser but I
> can't seem to figure out what needs to happen to deliver gifs or jpgs. The
> web server sends the binary image data to the web browser but the browser
> doesn't seem to recognize it. Do I need to append some sort of header to
> the image file?
Yes :
Content-Type: image/gif
or
Content-Type: image/jpeg
as with CGI programs.
BTW, have you looked at the HTTP::Daemon module?
--
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: 03 Jan 2001 07:50:29 GMT
From: "David Cunningham" <newsonly@please.com>
Subject: Re: Perl based web server
Message-Id: <92ulk5$i13@dispatch.concentric.net>
You can tell from the code how I'm trying to deliver the file logo.jpg.
Basically if a broswer makes a request for logo.jpg from the server here it
will deliver the content of logo.jpg unaltered. This is what's not working.
#!/usr/bin/perl -w
require 5.002;
use strict;
BEGIN { $ENV{PATH} = '/usr/ucb:/bin' }
use Socket;
use Carp;
sub logmsg { print "$0 $$: @_ at ", scalar localtime, "\n" }
my $port = shift || 80;
my $proto = getprotobyname('tcp');
socket(Server, PF_INET, SOCK_STREAM, $proto) or die "socket: $!";
setsockopt(Server, SOL_SOCKET, SO_REUSEADDR, pack ("l", 1)) or die
"setsockopt: $!";
bind(Server, sockaddr_in($port, INADDR_ANY)) or die "bind: $!";
listen (Server, SOMAXCONN) or die "listen: $!";
logmsg "server started on port $port";
my $paddr;
$SIG{CHLD} = \&REAPER;
open (LOGO, "logo.jpg");
my @logo = <LOGO>;
close (LOGO);
for ( ; $paddr = accept(Client, Server); close Client) {
my ($port, $iaddr) = sockaddr_in($paddr);
my $name = gethostbyaddr($iaddr, AF_INET);
logmsg "connection from $name [", inet_ntoa($iaddr), "] at port $port";
my $request = <Client>;
$request =~ s/HTTP.*//g;
my $line;
if ($request =~ /logo/) {
foreach $line (@logo) {print Client $line}
} else {
print Client "<html><head><title>Perl Web Server</title></head>\n";
print Client "<center><u><h1>WOW</h1></u><p>\n";
print Client "<h3>A \"PERL\" based web server!</h3>Very Cool...\n";
print Client "<p>By the way, it appears you said $request </html>";
}
print "$request\n";
}
------------------------------
Date: 03 Jan 2001 08:00:43 GMT
From: "David Cunningham" <newsonly@please.com>
Subject: Re: Perl based web server
Message-Id: <92um7b$hsm@dispatch.concentric.net>
Thanks Rafael. Actually my problem was I wasn't calling binmode on the
filehandle. It all works now. You can check it out at
poweron.radiusweb.com. Perl server on ActiveState Win32. What a concept.
: )
I'll check out HTTP::Daemon. Sounds cool.
--
<|>/\\/|<|>
"Rafael Garcia-Suarez" <rgarciasuarez@free.fr> wrote in message
news:slrn955maf.6uk.rgarciasuarez@rafael.kazibao.net...
> David Cunningham wrote in comp.lang.perl.misc:
> > I've written a minimal perl based web server. It binds to an IP on port
80
> > and waits for requests. I can make it deliver http to a web browser but
I
> > can't seem to figure out what needs to happen to deliver gifs or jpgs.
The
> > web server sends the binary image data to the web browser but the
browser
> > doesn't seem to recognize it. Do I need to append some sort of header
to
> > the image file?
>
> Yes :
> Content-Type: image/gif
> or
> Content-Type: image/jpeg
> as with CGI programs.
>
> BTW, have you looked at the HTTP::Daemon module?
>
> --
> # Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: 03 Jan 2001 08:11:09 GMT
From: "David Cunningham" <newsonly@please.com>
Subject: Re: Perl based web server
Message-Id: <92umqt$dcp@dispatch.concentric.net>
Problem fixed. Thanks everyone!
(binmode not called but was needed.)
"David Cunningham" <newsonly@please.com> wrote in message
news:92uk6v$9of@dispatch.concentric.net...
> I've written a minimal perl based web server. It binds to an IP on port
80
> and waits for requests. I can make it deliver http to a web browser but I
> can't seem to figure out what needs to happen to deliver gifs or jpgs.
The
> web server sends the binary image data to the web browser but the browser
> doesn't seem to recognize it. Do I need to append some sort of header to
> the image file? Can you recommend a good book on this sort of thing?
>
> Thanks.
>
> --
> <|>/\\/|<|>
>
>
------------------------------
Date: Wed, 03 Jan 2001 08:12:01 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Perl based web server
Message-Id: <x7pui58372.fsf@home.sysarch.com>
>>>>> "DC" == David Cunningham <newsonly@please.com> writes:
DC> #!/usr/bin/perl -w
DC> require 5.002;
DC> use strict;
DC> BEGIN { $ENV{PATH} = '/usr/ucb:/bin' }
DC> use Socket;
DC> use Carp;
good beginning.
DC> my $port = shift || 80;
DC> my $proto = getprotobyname('tcp');
DC> socket(Server, PF_INET, SOCK_STREAM, $proto) or die "socket: $!";
DC> setsockopt(Server, SOL_SOCKET, SO_REUSEADDR, pack ("l", 1)) or die
DC> "setsockopt: $!";
DC> bind(Server, sockaddr_in($port, INADDR_ANY)) or die "bind: $!";
DC> listen (Server, SOMAXCONN) or die "listen: $!";
replace all that with a single call to IO::Socket.
DC> $SIG{CHLD} = \&REAPER;
DC> open (LOGO, "logo.jpg");
always check the result of open
DC> my @logo = <LOGO>;
think about that. the logo is a jpeg. would it have normal text lines?
so one you should binmode that handle (in case you ever run it on
winblows or vms). secondly, just slurp it in:
my $logo_data = do{ local( $/ ) ; <LOGO> } ;
DC> for ( ; $paddr = accept(Client, Server); close Client) {
DC> if ($request =~ /logo/) {
DC> foreach $line (@logo) {print Client $line}
now you can replace that with just
print Client $logo_data
DC> } else {
DC> print Client "<html><head><title>Perl Web Server</title></head>\n";
DC> print Client "<center><u><h1>WOW</h1></u><p>\n";
DC> print Client "<h3>A \"PERL\" based web server!</h3>Very Cool...\n";
DC> print Client "<p>By the way, it appears you said $request </html>";
use a here doc. i hate seeing multiple print, especially of html. then
you also lose the eye wilting backwhacks.
overall, not bad for a beginner. improve this to allow multiple
connections, overlapping I/O and you will have a real server. check out
IO::Select or Event.pm for help there.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: 3 Jan 2001 10:01:07 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Perl based web server
Message-Id: <slrn955u33.f94.abigail@tsathoggua.rlyeh.net>
David Cunningham (newsonly@please.com) wrote on MMDCLXXXII September
MCMXCIII in <URL:news:92uk6v$9of@dispatch.concentric.net>:
|| I've written a minimal perl based web server. It binds to an IP on port 80
|| and waits for requests. I can make it deliver http to a web browser but I
|| can't seem to figure out what needs to happen to deliver gifs or jpgs. The
|| web server sends the binary image data to the web browser but the browser
|| doesn't seem to recognize it. Do I need to append some sort of header to
|| the image file? Can you recommend a good book on this sort of thing?
Let's see, you claim to have written a web server, but you are totally
clueless about the basics of the HTTP protocol? Weird.
Anyway, your question has absolutely nothing to do with Perl. Go study
the RFC.
Abigail
--
$_ = "\nrekcaH lreP rehtona tsuJ"; my $chop; $chop = sub {print chop; $chop};
$chop -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()
-> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()
------------------------------
Date: 03 Jan 2001 10:55:29 GMT
From: "David Cunningham" <newsonly@please.com>
Subject: Re: Perl based web server
Message-Id: <92v0f1$8vr@dispatch.concentric.net>
>
> Let's see, you claim to have written a web server, but you are totally
> clueless about the basics of the HTTP protocol? Weird.
Yes, I wrote a web server. Note I said it was minimal. Actually I'm quite
knowledgeable about the basics of the HTTP protocol and some of it's quirks
as well. This is simply the first time I've examined transfering image
data.
> Anyway, your question has absolutely nothing to do with Perl. Go study
> the RFC.
I've managed to solve the problem without studying the RFC. Turns out this
was a Perl binmode issue. After calling binmode on the filehandle the
problem was solved. I think this has everything to do with Perl. If I was
to follow your advice I would have wasted my time.
Here is what I suspect. You spend your free hours at home alone. You have
few friends besides your computer. This makes you bitter. You have nothing
better to do than belittle and insult those who would hope to seek the
assistance of others to extend their own knowledge. They say misery loves
company. Perhaps you're hoping to make others feel miserable so you don't
feel so alone?
> Abigail
> --
> $_ = "\nrekcaH lreP rehtona tsuJ"; my $chop; $chop = sub {print chop;
$chop};
> $chop -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () ->
()
> -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () ->
()
------------------------------
Date: Wed, 03 Jan 2001 11:24:44 GMT
From: "John Boy Walton" <johngros@Spam.bigpond.net.au>
Subject: Re: Perl based web server
Message-Id: <0_D46.43109$xW4.347770@news-server.bigpond.net.au>
"Abigail" <abigail@foad.org> wrote in message
news:slrn955u33.f94.abigail@tsathoggua.rlyeh.net...
> Let's see, you claim to have written a web server, but you are totally
> clueless about the basics of the HTTP protocol? Weird.
The power of perl?
------------------------------
Date: 3 Jan 2001 13:25:25 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Perl based web server
Message-Id: <92v985$eo3$1@bob.news.rcn.net>
David Cunningham <newsonly@please.com> wrote:
>>
>> Let's see, you claim to have written a web server, but you are totally
>> clueless about the basics of the HTTP protocol? Weird.
> Yes, I wrote a web server. Note I said it was minimal. Actually I'm quite
> knowledgeable about the basics of the HTTP protocol and some of it's quirks
> as well. This is simply the first time I've examined transfering image
> data.
You know, I hardly consider myself "quite knowledgeable" about HTTP, but
even I know that HTTP responses have headers as well as bodies. Maybe you
know that too, but the code you offered showed no sign of it.
>> Anyway, your question has absolutely nothing to do with Perl. Go study
>> the RFC.
> I've managed to solve the problem without studying the RFC. Turns out this
> was a Perl binmode issue. After calling binmode on the filehandle the
> problem was solved. I think this has everything to do with Perl. If I was
> to follow your advice I would have wasted my time.
I think you still have problems, but they're being masked by browser
bugs. Have you tested your code on browsers other than MSIE? MSIE is
well-known for trying to guess at information that should be contained in
HTTP headers. Other browsers aren't as forgiving (and in some cases
MSIE's guessing causes it to behave incorrectly).
Strictly, the issue of text vs. binary mode isn't Perl-specific, since it
would arise if you were writing the server in C/C++ as well; the
distinction is actually handled by the C run-time library.
> Here is what I suspect. You spend your free hours at home alone. You have
> few friends besides your computer. This makes you bitter. You have nothing
> better to do than belittle and insult those who would hope to seek the
> assistance of others to extend their own knowledge. They say misery loves
> company. Perhaps you're hoping to make others feel miserable so you don't
> feel so alone?
All statements like this do is encourage people to instruct their
newsreaders to give your posts very low priority (due to the extremely
high traffic in this group, very few people can afford to read all the
posts. Therefore, almost everybody uses some sort of prioritization
system). Unfortunately for you, the people who are the most likely to do
that are also the people with the greatest Perl expertise.
------------------------------
Date: 3 Jan 2001 14:35:06 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Perl based web server
Message-Id: <978532196.9944@itz.pp.sci.fi>
In article <92v0f1$8vr@dispatch.concentric.net>, David Cunningham wrote:
>
>I've managed to solve the problem without studying the RFC. Turns out this
If you did, it was only by dumb luck.
Really, go read the RFC first. Abigail wasn't being rude when she
said that, she was giving very important advice. The RFC tells you
how an HTTP server should work. If you don't know how an HTTP server
should work, what you write won't be a real HTTP server, but just
some toy hack that works a little bit like real HTTP servers do.
The RFC won't bite you. The RFC is your friend.
--
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real! This is a discussion group, not a helpdesk. You post
something, we discuss its implications. If the discussion happens to
answer a question you've asked, that's incidental." -- nobull in clpm
------------------------------
Date: 03 Jan 2001 08:59:18 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Perl based web server
Message-Id: <m1wvcctvvc.fsf@halfdome.holdit.com>
>>>>> "Ilmari" == Ilmari Karonen <iltzu@sci.invalid> writes:
Ilmari> Really, go read the RFC first. Abigail wasn't being rude when she
Ilmari> said that, she was giving very important advice. The RFC tells you
Ilmari> how an HTTP server should work. If you don't know how an HTTP server
Ilmari> should work, what you write won't be a real HTTP server, but just
Ilmari> some toy hack that works a little bit like real HTTP servers do.
And first look at HTTP::Daemon, and see if that won't do everything
you need, or if you can just patch that to your needs.
If you find things it doesn't do, please let the maintainers know.
print "Just another Perl hacker,"
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: 03 Jan 2001 19:04:51 GMT
From: "David Cunningham" <newsonly@please.com>
Subject: Re: Perl based web server
Message-Id: <92vt4j$fo4@dispatch.concentric.net>
Great insights here! Thanks for your help Uri!
"Uri Guttman" <uri@sysarch.com> wrote in message
news:x7pui58372.fsf@home.sysarch.com...
> >>>>> "DC" == David Cunningham <newsonly@please.com> writes:
>
> DC> #!/usr/bin/perl -w
> DC> require 5.002;
> DC> use strict;
> DC> BEGIN { $ENV{PATH} = '/usr/ucb:/bin' }
> DC> use Socket;
> DC> use Carp;
>
> good beginning.
>
> DC> my $port = shift || 80;
> DC> my $proto = getprotobyname('tcp');
> DC> socket(Server, PF_INET, SOCK_STREAM, $proto) or die "socket: $!";
> DC> setsockopt(Server, SOL_SOCKET, SO_REUSEADDR, pack ("l", 1)) or die
> DC> "setsockopt: $!";
> DC> bind(Server, sockaddr_in($port, INADDR_ANY)) or die "bind: $!";
> DC> listen (Server, SOMAXCONN) or die "listen: $!";
>
> replace all that with a single call to IO::Socket.
>
> DC> $SIG{CHLD} = \&REAPER;
>
> DC> open (LOGO, "logo.jpg");
>
> always check the result of open
>
> DC> my @logo = <LOGO>;
>
>
> think about that. the logo is a jpeg. would it have normal text lines?
> so one you should binmode that handle (in case you ever run it on
> winblows or vms). secondly, just slurp it in:
>
> my $logo_data = do{ local( $/ ) ; <LOGO> } ;
>
> DC> for ( ; $paddr = accept(Client, Server); close Client) {
> DC> if ($request =~ /logo/) {
> DC> foreach $line (@logo) {print Client $line}
>
> now you can replace that with just
>
> print Client $logo_data
>
> DC> } else {
> DC> print Client "<html><head><title>Perl Web
Server</title></head>\n";
> DC> print Client "<center><u><h1>WOW</h1></u><p>\n";
> DC> print Client "<h3>A \"PERL\" based web server!</h3>Very
Cool...\n";
> DC> print Client "<p>By the way, it appears you said $request
</html>";
>
> use a here doc. i hate seeing multiple print, especially of html. then
> you also lose the eye wilting backwhacks.
>
> overall, not bad for a beginner. improve this to allow multiple
> connections, overlapping I/O and you will have a real server. check out
> IO::Select or Event.pm for help there.
>
> uri
>
> --
> Uri Guttman --------- uri@sysarch.com ----------
http://www.sysarch.com
> SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX
Consulting
> The Perl Books Page -----------
http://www.sysarch.com/cgi-bin/perl_books
> The Best Search Engine on the Net ----------
http://www.northernlight.com
------------------------------
Date: Thu, 4 Jan 2001 11:41:56 +1100
From: "Sisyphus" <kalinabears@hdc.com.au>
Subject: Re: Perl based web server
Message-Id: <VKP46.9$TU2.4004@vic.nntp.telstra.net>
Hi,
My 'minimal perl based' web server (created using IO::Socket, ActivePerl
613, on Windows 98) will successfully send a jpg or gif image to a browser.
Here is the relevant section of code that actually 'loads' the image into
'$data_to_send'.
use strict;
my $data_to_send;
my $file = "image.jpg" # for example
open (INPUT, $file) || die "can't open $file: $!";
binmode INPUT;
while (<INPUT>) {
# don't chomp
$data_to_send = "$data_to_send$_";
}
close(INPUT) || die "can't close $file: $!";
'$data_to_send' is then sent to the client.
My server, still very much in its infancy, is not hampered by protocol
issues. In its current configuration it responds to any request from any
client by sending 'image.jpg'. If that client happens to be a browser, then
the image is displayed by that browser.
Hope that helps.
Email me if you want to get back to me.
Cheers,
Rob
kalinabears@hdc.com.au
--
Visit our website at http://www.kalinabears.com.au
David Cunningham <newsonly@please.com> wrote in message
news:92uk6v$9of@dispatch.concentric.net...
> I've written a minimal perl based web server. It binds to an IP on port
80
> and waits for requests. I can make it deliver http to a web browser but I
> can't seem to figure out what needs to happen to deliver gifs or jpgs.
The
> web server sends the binary image data to the web browser but the browser
> doesn't seem to recognize it. Do I need to append some sort of header to
> the image file? Can you recommend a good book on this sort of thing?
>
> Thanks.
>
> --
> <|>/\\/|<|>
>
>
------------------------------
Date: Wed, 03 Jan 2001 06:44:22 GMT
From: Scott Ferguson <sferguson@rationalconsulting.com>
Subject: Perl Code Question
Message-Id: <386FD592.9B77B172@rationalconsulting.com>
I am using the following PERL statement:
system("$CT setview dev");
Problem - it will not return control the the script, but it executes
fine.
system("$CT setview dev &");
Problem - it will not execute, but it will return control to the script.
Any ideas on how to fix this?
Thanks,
Scott.
------------------------------
Date: Wed, 3 Jan 2001 17:59:45 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Perl Code Question
Message-Id: <slrn955jf1.edk.mgjv@martien.heliotrope.home>
On Wed, 03 Jan 2001 06:44:22 GMT,
Scott Ferguson <sferguson@rationalconsulting.com> wrote:
> I am using the following PERL statement:
>
> system("$CT setview dev");
>
> Problem - it will not return control the the script, but it executes
> fine.
>
> system("$CT setview dev &");
>
> Problem - it will not execute, but it will return control to the script.
>
> Any ideas on how to fix this?
Nope, but maybe $CT, whatever that is, expects some input from the
terminal or something like that? There isn't any problem with Perl's
system(), but there may be things that your $CT program expects that
aren't being provided for. How does it interact with you if you run ot
from the command line? Does it give you back the prompt immediately?
Does the documentation of that program maybe say anything aout needing a
terminal? maybe you need to use Expect or so.
Are you sure that the program has terminated when you expect it to
return control?
Martien
--
Martien Verbruggen | Since light travels faster than
Interactive Media Division | sound, isn't that why some people
Commercial Dynamics Pty. Ltd. | appear bright until you hear them
NSW, Australia | speak?
------------------------------
Date: 03 Jan 2001 07:18:08 GMT
From: "David Cunningham" <newsonly@please.com>
Subject: Re: Perl Code Question
Message-Id: <92ujng$f6m@dispatch.concentric.net>
What do you have $CT set to? If you're not sure then try inserting this
code into your script just before the "system" command like so:
print $CT; exit; <-------( You insert this line right here.)
system("$CT setview dev");
Now run your program. Whatever your script says, post it back here.
"Scott Ferguson" <sferguson@rationalconsulting.com> wrote in message
news:386FD592.9B77B172@rationalconsulting.com...
> I am using the following PERL statement:
>
> system("$CT setview dev");
>
> Problem - it will not return control the the script, but it executes
> fine.
>
> system("$CT setview dev &");
>
> Problem - it will not execute, but it will return control to the script.
>
> Any ideas on how to fix this?
>
> Thanks,
>
> Scott.
>
------------------------------
Date: Wed, 3 Jan 2001 09:49:10 -0000
From: "Stephen Collyer" <stephen@twocats.dont-spam.demon.co.uk>
Subject: Re: Perl Code Question
Message-Id: <978515429.19187.0.nnrp-02.9e98901a@news.demon.co.uk>
Scott Ferguson <sferguson@rationalconsulting.com> wrote in message
news:386FD592.9B77B172@rationalconsulting.com...
> I am using the following PERL statement:
>
> system("$CT setview dev");
It'd be nice if you gave us a hint as to what $CT contains, but
at a guess I'd say it's 'cleartool'.
>
> Problem - it will not return control the the script, but it executes
> fine.
>
> system("$CT setview dev &");
>
> Problem - it will not execute, but it will return control to the script.
Setting a new view in ClearCase creates a new process set to
the view in question, no ?
So I'd say that the first system fires off a shell whose
'cleartool setview' command creates a new shell which sits
there waiting for terminal input. This is what it is supposed to
do.
I guess the problem that you're trying to solve is that of setting the
view of your current Perl process. I don't know how to do that
from within a Perl script, but the obvious solution is to require
that users call your script from a shell whose view is already set,
and check this by doing a 'cleartool pwv' or whatever it is from
within the script.
Steve Collyer.
------------------------------
Date: 4 Jan 2001 17:35:10 GMT
From: cbb108c@email.mot.com (Brian Busche)
Subject: Perl DBI and Oracle
Message-Id: <932c8e$dal$1@newshost.mot.com>
Newbie question,
How do you set the ENV variable for the Oracle user name and passowrd?
------------------------------
Date: 03 Jan 2001 23:09:22 -0200
From: Jorge Godoy <godoy@conectiva.com>
Subject: Perl documentation in Info files
Message-Id: <kphf3g5dj1.fsf@dagon.conectiva>
Hi!
I'm very interested about where can I get or how can I create info
files from perl documentation.
Thanks!
--
Godoy. <godoy@conectiva.com>
Departamento de Publicações Conectiva S.A.
Publishing Department Conectiva Inc.
------------------------------
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 5239
**************************************