[10252] in Perl-Users-Digest
Perl-Users Digest, Issue: 3845 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 28 18:07:13 1998
Date: Mon, 28 Sep 98 15:00:19 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 28 Sep 1998 Volume: 8 Number: 3845
Today's topics:
Re: "select $variable" then print to it? (Larry Rosler)
Re: format help <gellyfish@btinternet.com>
gethostbyaddr <u.wisser@luna-park.de>
Re: gethostbyaddr <uri@camel.fastserv.com>
Re: Help with system() on NT <george.kuetemeyer@mail.tju.edu>
Re: Help! How to run a UNIX process in background <jason.holland@dial.pipex.com>
Re: how do I get array slice of multidim. array???? (Charles DeRykus)
Re: Input Separator Matching <gellyfish@btinternet.com>
open2 and open3 errors mwwenzel@my-dejanews.com
Re: open2 question mwwenzel@my-dejanews.com
Re: Perl & Java - differences and uses <arcege@shore.net>
Re: Perl and viruses (Mark-Jason Dominus)
Perl setup (behinds the scenes) jscar@my-dejanews.com
Re: Please take a look at my site <henry@dotrose.com>
Re: Porting Unix perl script to winNT servers (Ethan H. Poole)
Re: re-direct standard error (Tad McClellan)
Re: re-direct standard error <gellyfish@btinternet.com>
Re: Scrolling text box? <gellyfish@btinternet.com>
Shell Command...... sblenkhorn@my-dejanews.com
STDIO redirection & child process (Stephen Elias)
Re: weird telnet problem mwwenzel@my-dejanews.com
Re: Where can I find a member() function? (Tad McClellan)
Re: Where can I find a member() function? (Larry Rosler)
Re: Where can I find a member() function? <gellyfish@btinternet.com>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 28 Sep 1998 14:30:00 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: "select $variable" then print to it?
Message-Id: <MPG.10799fb59b203879897ca@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and a copy mailed.]
In article <Pine.HPP.3.96L.980928205552.18068A-100000@club.eng.cam.ac.uk>
on Mon, 28 Sep 1998 21:04:30 +0100, Nigel Parker <95ncp@eng.cam.ac.uk>
says...
>
> Does anyone know how I can select a variable and print to it? Similar to
> how you would "select STDOUT" or "select MAIL" then print to those.
$variable = sprintf $format, whatever...;
> I want to build up a big "$variable" then send it to my uucoding routine,
> and then "print MAIL $uu_coded_variable".
>
> I've taught myself perl in the last few weeks, so there may be an easy
> solution which I've not come across! There's a lot to be printed so
> something like $message = $message."Some more text.\n"; isn't really a
> a very nice solution.
$message .= "Some more text.\n";
is a bit nicer, and
join "", $string1, $string2, ...;
is nicer yet.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 28 Sep 1998 21:28:42 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: format help
Message-Id: <6uov2a$13v$1@gellyfish.btinternet.com>
On Mon, 28 Sep 1998 10:50:55 -0700 Jaime Diaz <jamdiaz@klaskycsupo.com> wrote:
> I am trying to get info on formatting using perl.
> for example in unix if i want reformat the output of the df -k
> command
> open (test, "/etc/tester"); ##tester is df output
> while (<test>) {
> ($one,$two,$three) = split(' ');
> write >out;
> }
> format STDOUT =
> @<<<< @<<<<<<<< @<<<<<<<<
> $one,$two,$three
> I want to create column headers in the format ..for example
> Total Megabytes
> ----------------
> any ideas..
As it happens I was just thinking about tarting up the little 'df'
script that I trot out once in a while so here you go:
#!/usr/bin/perl
open(DF,"/bin/df -k |") || die "Cant execute df - ";
format STDOUT_TOP =
Disk Usage Report
Filesystem Mountpoint Free MB Free %
-------------------------------------------------------
.
format STDOUT =
@<<<<<<<<<<< @<<<<<<<< @>>>>> @>>>>>
$filesystem, $mountpoint, $avail, $left
.
while(<DF>)
{
next if (/mounted/i);
($filesystem,$blocks,$used,$avail,$capacity,$mountpoint) = split(' ',$_);
$capacity =~ s/%//g; # my df puts a percent sign after capacity
$left = 100 - $capacity;
$avail = sprintf("%d.2",$avail / 1024) ;
write STDOUT;
}
close(DF) || die "Error in df";
__END__
Which produces the following:
Disk Usage Report
Filesystem Mountpoint Free MB Free %
-------------------------------------------------------
/dev/hda1 / 123.2 67
/dev/hda4 /usr 696.2 66
/dev/hdb1 /DOS 48.2 24
/dev/hda3 /home 537.2 98
Nothing to it really.
Check out the perlform manpage for more on the subject.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Mon, 28 Sep 1998 23:10:56 +0200
From: Ulrich Wisser <u.wisser@luna-park.de>
Subject: gethostbyaddr
Message-Id: <360FFB60.10D6AE1A@luna-park.de>
Hello,
I have a lot of ip-numbers in a file and I want to translate
them to hostnames. This is my code:
$x1 = 192;
$x2 = 41;
$x3 = 13;
$x4 = 118;
$addr = pack("C4", $x1,$x2,$x3,$x4);
$name1 = gethostbyaddr($addr, AF_INET);
$name2 = gethostbyaddr("$x1.$x2.$x3.$x4", AF_INET);
print unpack("C4", $addr),"\n$addr\nName1: $name1\nName2: $name2\n";
But I don't get any hostname $name1 and $name2 are both undef.
Thanks
Ulli
--
------------------------------------------------------------
luna-park Tel./Fax: +49-228-634580
Ulrich Wisser u.wisser@luna-park.de
Am Roemerkastell 22 http://www.luna-park.de
D-53111 Bonn
------------------------------------------------------------
------------------------------
Date: 28 Sep 1998 17:58:56 -0400
From: Uri Guttman <uri@camel.fastserv.com>
To: Ulrich Wisser <u.wisser@luna-park.de>
Subject: Re: gethostbyaddr
Message-Id: <sar1zovx5jz.fsf@camel.fastserv.com>
>>>>> "UW" == Ulrich Wisser <u.wisser@luna-park.de> writes:
UW> $x1 = 192; $x2 = 41; $x3 = 13; $x4 = 118;
UW> $addr = pack("C4", $x1,$x2,$x3,$x4); $name1 =
UW> gethostbyaddr($addr, AF_INET);
UW> $name2 = gethostbyaddr("$x1.$x2.$x3.$x4", AF_INET);
UW> print unpack("C4", $addr),"\n$addr\nName1: $name1\nName2:
UW> $name2\n";
this works. just input the full ip address as a string. you don't need
the pack and unpack stuff
use Socket ;
$ip = '192.41.13.118' ;
$host = gethostbyaddr( inet_aton( $ip ), AF_INET ) ;
print $_ ;
print "$ip host '$host'\n" ;
hth,
uri
--
Uri Guttman Fast Engines -- The Leader in Fast CGI Technology
uri@fastengines.com http://www.fastengines.com
------------------------------
Date: Mon, 28 Sep 1998 17:04:27 -0400
From: George Kuetemeyer <george.kuetemeyer@mail.tju.edu>
Subject: Re: Help with system() on NT
Message-Id: <360FF9DB.B8805B8C@mail.tju.edu>
scottw7562@my-dejanews.com wrote:
> I read the docs and apparently the `backtick` method is not supported under
> NT ?? otherwise I should be able to capture and supress the output of the
> command.
>
The `backtick` method *does* work with NT.
------------------------------
Date: Mon, 28 Sep 1998 22:06:59 +0000
From: Jason Holland <jason.holland@dial.pipex.com>
To: Chakravarthy KM Nalamotu <kittu@Hawaii.Edu>
Subject: Re: Help! How to run a UNIX process in background
Message-Id: <36100883.BFDB06B8@dial.pipex.com>
Uuuuhh, I'm tired...
Try this:
system( 'program' );
or:
if( fork ) { # Parent process
; # Do other stuff
} else { # Child process
exec( 'program' ); # Execute command, replacing current process
}
Goodnight
--
sub jasonHolland {
my %hash = ( website =>
'http://dspace.dial.pipex.com/jason.holland/',
email => 'jason.holland@dial.pipex.com' );
}
------------------------------
Date: Mon, 28 Sep 1998 21:00:48 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: how do I get array slice of multidim. array????
Message-Id: <F00IDD.39n@news.boeing.com>
In article <6uoiva$7e6$1@news-1.news.gte.net>,
Steve Maring <smaring@gte-es.com> wrote:
>I have a two dimensional array from which I wish to delete a row.
>
>In the one dimensional case I can say:
>@array[$i..($sizeofarray-1)] = @array[($i+1)..($sizeofarray-1)];
>
>and $array[$i] will be deleted with subsequent entries shifted up.
>
>Given $array[$i][$j] and a desire to delete a given $i, the same
>approach
>does not work.
>
perldoc -f splice
hth,
--
Charles DeRykus
------------------------------
Date: 28 Sep 1998 21:46:53 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Input Separator Matching
Message-Id: <6up04d$142$1@gellyfish.btinternet.com>
On 28 Sep 1998 17:48:53 GMT Eric Sheng <shenge@ece.ucdavis.edu> wrote:
> Hi all,
> I have a question on the input separator $/. Instead of trying to
> matching the word "ERROR:", I want to match only if it is at the begining
> of line: /^ERROR:/. But I don't know how to set the $/ variable to
> indicate match only "ERROR:" that start at the begining of line.
> Any ideas anyone?
You've lost me totally here chief.
If you just want to match lines that begin with error you can just do:
while(<>) # assume input from STDIN for example
{
next unless /^ERROR:/;
# do something with line
}
if you start messing with $/ then you are effectively altering what Perl
thinks of as being a line and as far as I see thats not what you want
to do. Of course you could always set $/ = "ERROR:" ;-}
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Mon, 28 Sep 1998 21:43:31 GMT
From: mwwenzel@my-dejanews.com
Subject: open2 and open3 errors
Message-Id: <6uovu3$8mc$1@nnrp1.dejanews.com>
When open2() or open3() fails because the exec of the program to run fails,
is there a way to catch it?
I have been using the following as a work-around:
use open3()
do a select on the error file handle with a 1 sec timeout
if select returns 1 then there is an error
I have tried $pid = open2(....) or die ....
I have also tried it in an eval block ... nothing seems to work.
Mark
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Mon, 28 Sep 1998 21:19:04 GMT
From: mwwenzel@my-dejanews.com
Subject: Re: open2 question
Message-Id: <6uoug8$75u$1@nnrp1.dejanews.com>
All you need is a newline after your 2+2.
Mark
In article <slrn7087l5.3l0.asher@localhost.localdomain>,
asher@magicnet.net wrote:
> The following code works:
> #!/usr/bin/perl
> require 'open2.pl';
> &open2(RDR,WTR,"bc");
> print WTR "2+2\nquit\n";
> while(<RDR>) {
> print;
> }
>
> If you do it this way, you have to re-open the pipe for each calculation,
> which may not be acceptable.
>
> On 19 Sep 1998 15:49:46 GMT, Eric M Yeh <emy457@merle.acns.nwu.edu> wrote:
> >Hi, I'm having trouble with the open2 command. I need to have my perl
> >program write and read from a command such as 'bc'. I tried this code but
> >the program never stops...
> >
> >use IPC::Open2;
> >use Symbol;
> >
> >$WTR = gensym();
> >$RDR = gensym();
> >$pid = open2($RDR, $WTR, 'bc');
> >print $WTR "2+2";
> >$line = <$RDR>
> >
> >
> >then I try to print $line ...
> >
> >anyhelp is appreciated...
> >thanks
> >
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Mon, 28 Sep 1998 21:51:05 GMT
From: "Michael P. Reilly" <arcege@shore.net>
Subject: Re: Perl & Java - differences and uses
Message-Id: <dxTP1.972$_c5.9086446@news.shore.net>
In comp.lang.python Zenin <zenin@bawdycaste.org> wrote:
: Which brings us back to practical design problems and examples.
: Below is an practical example of Perl code, using OO, functional,
: and procedural paradigms. Now, I would like to see what the
: pure OO model/algorithm would look like. Not a retyping of this
: algorithm in Java or Python (we've been through that one with the
: Perl to Python CGI example), but the same problem solved using
: whatever the best OO style for such a problem might be. Why? Simply
: because the main argument of this thread (ok, of George) has been
: that in most practical, real world usage, the OO paradigm can
: create such easier to read, maintain, extend, understand, etc code
: then can be done with other paradigms, or god forbid using multiple
: paradigms (which George has explicitly stated is a bad idea in any
: form). So, for all intents please consider this example a
: functional spec only, and not a design spec. With this functional
: spec in hand, I would like to see the OO design spec that fits this
: application.
: #!/usr/local/bin/perl
:
: use strict;
: use Tk;
:
: my $MW = new MainWindow;
:
: {
: my $Button = 0;
:
: sub makeMeAnAlertButton {
: my $frame = shift;
: my $showText = shift;
: my $button = ++$Button;
:
: $frame->Button (
: -text => "($button) Push me" . ($button > 1 ? " too!" : "..."),
: -command => sub {
: my $alert = $frame->Toplevel();
: $alert->Label (-text => $showText)->pack;
: $alert->Button (
: -text => "ok $button",
: -command => sub { $alert->destroy() },
: )->pack();
: },
: )->pack();
: return $button;
: }
: }
:
: for (
: my $button = makeMeAnAlertButton ($MW, "default");
: print("button $button>"), my $alertText = <STDIN>;
: ) {
: $button = makeMeAnAlertButton ($MW, $alertText);
: }
:
: MainLoop;
: __END__
I'm not going to get into the debate, but it was put out to come up
with a practical example of the above spec using OOPS, in Python or
Java. Here is my Python solution, with extensions for having a roman
numeral counter instead of just an arabic counter. You might have to
correct me from what you gave - I don't have Perl/Tk (and don't plan on
getting it either), but I have been working with Tk for about four
years, so I think this is correct from your spec. Note that I would
not normally be creating the buttons while reading the input, but your
spec suggested getting the counter number from the button: this was an
assumption as to the value of the $button object in Perl/Tk.
Oh, and I hope I got the roman numeral generator right, it's been
probably ten years since I wrote one and I didn't have a lot of time
this morning (but enough time to look up the reference in Webster's
tho; learn something new every day :)
-Arcege
#!/usr/local/bin/python
from Tkinter import Frame, Button, Label, Toplevel
class Counter:
value = 0
def __init__(self):
self.__class__.value = self.__class__.value + 1
self.value = self.__class__.value
def __str__(self): return str(self.value)
def __cmp__(self, other): return cmp(self.value, other)
def __rcmp__(self, other): return cmp(other, self.value)
class RomanCounter(Counter):
# Webster's says that a v-bar is over the letters above 1000, so I'll
# use the uppercase
romans = { 10000: 'X',
5000: 'V', 1000: 'm',
500: 'd', 100: 'c',
50: 'l', 10: 'x',
5: 'v', 1: 'i'
}
def __str__(self):
# we assume that the value is not going to change
if hasattr(self, 'cache_str'):
return self.cache_str
v = self.value
r, s = 1, ''
while v:
v, b = divmod(v, 10)
t, f, o = self.romans[r*10], self.romans[r*5], self.romans[r]
if b == 0: pass
elif b == 1: s = o + s
elif b == 2: s = o*2 + s
elif b == 3: s = o*3 + s
elif b == 4: s = o + f + s
elif b == 5: s = f + s
elif b == 6: s = f + o + s
elif b == 7: s = f + o*2 + s
elif b == 8: s = f + o*3 + s
elif b == 9: s = o + t + s
r = r * 10
self.cache_str = s
return s
class AlertDialog(Toplevel):
def __init__(self, text, number):
Toplevel.__init__(self)
Label(self, text=text).pack()
Button(self, text='ok %s' % number, command=self.destroy).pack()
# or to use the tk_dialog interface:
#- from Dialog import Dialog, DIALOG_ICON
#- class AlertDialog(Dialog):
#- def __init__(self, text, number):
#- Dialog.__init__(self, None, {
#- 'title': 'Alert', 'text': text,
#- 'bitmap': DIALOG_ICON, 'default': '',
#- 'strings': ('ok %s' % number,)
#- })
class AlertButton(Button):
CounterClass = Counter
def __init__(self, master, text):
self.text = text
self.number = self.CounterClass()
Button.__init__(self, master, text=self.gettext(), command=self.alert)
def gettext(self):
if self.number > 1:
text = "(%s) Push me too!"
else:
text = "(%s) Push me..."
return text % self.number
def alert(self):
AlertDialog(self.text, self.number)
def __repr__(self):
return 'button %s' % self.number
class RomanAlert(AlertButton):
CounterClass = RomanCounter
class Control(Frame):
import sys
if len(sys.argv) > 1: alert = RomanAlert
else: alert = AlertButton
def __init__(self, master):
Frame.__init__(self, master)
self.button = None
self.button = self.new_alert()
self.button.pack()
try:
while 1:
self.button = self.new_alert()
self.button.pack()
except EOFError:
pass
def new_alert(self, text="default"):
if self.button is not None:
text = raw_input(`self.button` + '> ')
if not text:
raise EOFError # handle empty input
return self.alert(self, text)
if __name__ == '__main__':
control = Control(None)
control.pack()
control.mainloop()
------------------------------
Date: 28 Sep 1998 17:45:57 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Perl and viruses
Message-Id: <6up02l$6i6$1@monet.op.net>
In article <6uopob$h0f$2@csnews.cs.colorado.edu>,
Tom Christiansen <tchrist@mox.perl.com> wrote:
>In comp.lang.perl.misc, Jonathan Stowe <gellyfish@btinternet.com> writes:
>:identifying virii
>
>Could you please explain this "-us to -ii" rule that you are alleging here?
I didn't see the original article, but maybe he's forming the plural
of `virius'.
------------------------------
Date: Mon, 28 Sep 1998 21:33:00 GMT
From: jscar@my-dejanews.com
Subject: Perl setup (behinds the scenes)
Message-Id: <6uovad$7v3$1@nnrp1.dejanews.com>
Does anyone know of a book or FAQ or web site that has information about the
installation setup that occurs behinds the scenes with Perl. There is a reason
for the directory structure in say /usr/local/lib/perl5. What is the
significance of the auto subdirectory. How does that differ from the auto
directory of site_perl directory. How/where does @INC get initialized? How
do dynamically linked modules get loaded? There would seem to be a number of
behinds the scenes things that would be documented somewhere.
Anyone know where I could find this?
Thanks you.
Jon Scarbrough
Oakton Community College
Des Plaines, IL
scar@oakton.edu
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Mon, 28 Sep 1998 17:25:29 -0400
From: Henry Hartley <henry@dotrose.com>
Subject: Re: Please take a look at my site
Message-Id: <360FFEC9.AA4DD331@dotrose.com>
Kris Bernardic wrote:
> I would be most appreciative if some of you out there could take a look
> at a rough (and I mean rough) draft of my site. Check it out at:
>
> http://www.fit2print.com/high/index.html
>
> Keep in mind this is a very rough draft (alot of the links don't work
> yet). What I need to know is if this Java/CGI shopping cart system will
> work. Is the download time unrealistic? I'm planning on having 3 site
> versions: a fast page (with minimal graphics) and medium page (with
> black & white graphics) and a slow page (with full color graphics). So
> if this page(full color) has a tolerable download time then I know the
> others will work.
It loads fast enough for me but I have a high speed connection. The
shopping cart thing works although I'd like to see the shipping, etc. costs
before checkout. Perhaps ask for shipping method on the main page. If you
also ask for state there you can calculate sales tax at the same time.
Also, the prices in some of your "alt" tags don't match the text below the
magazines (and the PC Magazines don't have all the info in the alt tag.
Henry
------------------------------
Date: 28 Sep 1998 21:02:12 GMT
From: ehp@gte.net (Ethan H. Poole)
Subject: Re: Porting Unix perl script to winNT servers
Message-Id: <6uotgk$rr6$1@news-2.news.gte.net>
In article <360f8f3f.265844514@news.ericsson.se>,
bjorn.w.nilsson@edt.ericsson.se says...
>
>What can be a problem is if anything is encrypted with the UNIX crypt
>command. That is not supported on NT. This problem is addressed in the
>FAQ for the WWWBoard from Matts Script Archive:
>http://worldwidemart.com/scripts/faq/wwwboard.shtml
The ActiveState Perl port has supported the crypt() function since at least
5.001 (the earliest version I've used).
--
Ethan H. Poole | Website Design and Hosting,
| CGI Programming (Perl & C)..
========Personal========= | ============================
* ehp @ gte . net * | --Interact2Day--
http://home1.gte.net/ehp/ | http://www.interact2day.com/
------------------------------
Date: Mon, 28 Sep 1998 13:52:58 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: re-direct standard error
Message-Id: <aulou6.0tk.ln@flash.net>
Kyle Mattes (kyle.mattes@ac.com) wrote:
: I am in a WinNT environment, and need help with using the backquotes
: (backticks).
: I know that @logfile = `command` will redirect the standard OUTPUT to
: the array @logfile.
: How do I redirect the standard ERROR instead??
I don't know about M$ stuff, so I'm wondering if the answer in
the Perl FAQ doesn't work there.
Does it?
Perl FAQ, part 8:
"How can I capture STDERR from an external command?"
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 28 Sep 1998 20:52:20 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: re-direct standard error
Message-Id: <6uosu4$ve$1@gellyfish.btinternet.com>
On Mon, 28 Sep 1998 11:46:33 -0500 Kyle Mattes <kyle.mattes@ac.com> wrote:
> I am in a WinNT environment, and need help with using the backquotes
> (backticks).
> I know that @logfile = `command` will redirect the standard OUTPUT to
> the array @logfile.
> How do I redirect the standard ERROR instead??
In the first of the following examples you are just getting rid of
STDERR (for NT you would use NUL and you own favourite error)
In the second you are duping the STDOUT file handle to STDERR and
the closing STDOUT to prevent both getting mixed up. You might want
to reopen STDOUT to another filehandle if you dont want to just lose
the output.
#!/usr/bin/perl
# Just get rid of STDERR
open(STDERR,">/dev/null") || die "etc ...";
system('ls -l blah');
# put STDERR to STDOUT
open(STDERR,">&STDOUT") || die "dup failed ...";
close(STDOUT);
print `ls -l blah`;
__END__
You might check out the perlfunc documentation for open() for more on
this.
A thing to watch on NT (infact all MS Os's) is that because the command
interpreter doesnt care much for STDERR some of the basic commands wont
either and will blast error onto STDOUT.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: 28 Sep 1998 20:21:16 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Scrolling text box?
Message-Id: <6uor3s$t8$1@gellyfish.btinternet.com>
On Mon, 28 Sep 1998 14:33:59 -0400 Brian Enderle <benderle@mindspring.com> wrote:
> I would like to put a scrolling text box in one frame of my page. I
> have seen this done elsewhere only I cannot remember where. I would
> like it to read a list from a text file and just keep scrolling through
> that list while the user is surfing through other pages. I assume it
> would have to be either cgi or java.
Er, yes you probably would have to use Java or Javascript or
VBScript or Dynamic HTML or something and whilst you could do it with
a Perl CGI script I think that would be the last choice - think Server Push.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Mon, 28 Sep 1998 21:06:56 GMT
From: sblenkhorn@my-dejanews.com
Subject: Shell Command......
Message-Id: <6uotpf$6hb$1@nnrp1.dejanews.com>
Here was another approach I tried. It isn't the best way of doing things but
I am willing to try anything at this point!
$zip_exe = "d:\\www\\rp\\cgi-bin\\pkzip25 -add -sfx";
$dest_path =
"d:\\www\\rp\\cgi-bin\\documents\\".$dir_type."\\".$dir_name."\\".$file_name;
$files_path =
"d:\\www\\rp\\cgi-bin\\documents\\".$dir_type."\\".$dir_name."\\".$file_name.
"\\ *.*";
$system_call = "$zip_exe $dest_path $files_path";
system "$system_call";
THIS CODE BELOW WORKS.....CAN YOU SEE ANY DIFFERENCE OR SOMETHING OUT OF THE
ORDINARY??
$testdir = "d:\\www\\rp\\cgi-bin\\out.txt";
system "dir >$testdir";
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Mon, 28 Sep 1998 20:37:16 GMT
From: steven_elias@ml.com (Stephen Elias)
Subject: STDIO redirection & child process
Message-Id: <3611f250.281537659@news.ml.com>
Hello,
Is there a way to communicate with a child process via STDIN-STDOUT
using perl.
For instance
system("mycmd") ;
# mycmd is running, how do I pass it "commands" and read *it's* STDOUT
Note this is different from
@output = `mycmd` ; # one shot deal
thanks (using WIN32 Perl)
------------------------------
Date: Mon, 28 Sep 1998 21:19:03 GMT
From: mwwenzel@my-dejanews.com
Subject: Re: weird telnet problem
Message-Id: <6uoug6$75s$1@nnrp1.dejanews.com>
You are probably reading and expecting to get the login prompt. There is no
newline printed after the login prompt. This means that you cannot read it.
There may be a way to use raw mode in perl, but I haven't checked. I suggest
that you try using "expect". It is a scripting language designed to allow
interative programs to be used in non-interative ways.
Mark
In article <3609FDD4.86FED07C@earthlink.net>,
MadMonkey <samblack@earthlink.net> wrote:
> I finally figured out how to use IPC::open2 to talk to telnet. But when
> I connect to a remote host telnet spits this out:
> trying 111.111.11.1....
> connected to mymother.com ------- and then stops. It never gives me the
> login: prompt.
> Why does it just sit there? When I run it outside the script it works
> fine.
> Thanks
> J
>
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Mon, 28 Sep 1998 13:48:24 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Where can I find a member() function?
Message-Id: <ollou6.0tk.ln@flash.net>
Brian Kendig (fox-at-enchanter-net@SPAM.BLOCK) wrote:
: I want a subroutine which takes a scalar and a list as input, and
: returns true if a copy of the scalar exists in the list.
: This seems so basic and fundamental that I'm surprised not to find it
: mentioned in the camel book,
Because it is mentioned in the Frequently Asked Questions
(Perl FAQ, part 4):
"How can I tell whether an array contains a certain element?"
: but I can't even find any modules on CPAN
: which implement it! Are Perl hackers not supposed to think of lists
: this way?
No, Perl hackers check the docs before posting... ;-)
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 28 Sep 1998 14:13:46 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Where can I find a member() function?
Message-Id: <MPG.10799be7626149909897c9@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and a copy mailed.]
In article <907009401.526792@thrush.omix.com> on 28 Sep 1998 19:04:36
GMT, Zenin <zenin@bawdycaste.org> says...
...
> Inside member(), you'll have @$array_ref, or if you really
> want to be explicit, ${ @array_ref }, but that's ugly. :-)
Oops. @{ $array_ref }. And it's still ugly, though correct. :-)
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 28 Sep 1998 22:45:45 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Where can I find a member() function?
Message-Id: <6up3ip$160$1@gellyfish.btinternet.com>
On 28 Sep 1998 11:34:32 -0700 Brian Kendig <fox-at-enchanter-net@SPAM.BLOCK>
wrote:
> I want a subroutine which takes a scalar and a list as input, and
> returns true if a copy of the scalar exists in the list.
You mean something other than is described in perlfaq4:
How can I tell whether an array contains a ceertain element
> This seems so basic and fundamental that I'm surprised not to find it
> mentioned in the camel book, but I can't even find any modules on CPAN
> which implement it! Are Perl hackers not supposed to think of lists
> this way?
Infact its so basic and fundamental that it has become a Frequently Asked
Question.
> I would write a member() function myself, except I'm having trouble
> figuring out how to pass an array by reference rather than by value.
I wouldnt worry about that for now - read the perlref manpage and then
figure it out.
A possible way of doing this which springs from perlfaq4 could be this:
#!/usr/bin/perl
@stuff = qw(beer coke wine whisky water rum);
print "beer is there\n" if ismember("beer",@stuff);
print "lager is there\n" if ismember("lager",@stuff);
sub ismember
{
my ($thing,@stuff) = @_;
my %stuff = map { ($_,1) } @stuff;
$stuff{$thing};
}
__END__
Now this is not so good in a number of ways - building the list and
the hash in the sub is really wasteful when they are getting thrown
away again. But there you go you wanted a subroutine :)
The use of a hash in this circumstance is an idiom that you will see
quite frequently when a certain item is to be determined from some
list.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 3845
**************************************