[11970] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5571 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 5 13:07:19 1999

Date: Wed, 5 May 99 10:01:32 -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           Wed, 5 May 1999     Volume: 8 Number: 5571

Today's topics:
    Re: procedure to convert sec to HH:MM:SS format <gellyfish@gellyfish.com>
    Re: procedure to convert sec to HH:MM:SS format (Larry Rosler)
    Re: procedure to convert sec to HH:MM:SS format (Tad McClellan)
        Q: checking defined/usable handles? <sf@tellux.de>
    Re: Read vs. <STDIN> <vvb@ibm.net>
    Re: Read vs. <STDIN> <tchrist@mox.perl.com>
    Re: Read vs. <STDIN> <uri@sysarch.com>
    Re: Reading extremely large files a chunk at a time (Tad McClellan)
        s///ge & $` (Andrew Allen)
    Re: Security:HowTo not pass UserID/Password as hidden v dstorrs@megazone.bigpanda.com
        setting PATH in BEGIN clause (Andreas Karrer)
    Re: setting PATH in BEGIN clause (Bart Lateur)
        Showfile.pl or .cgi <rlally1@nycap.rr.com>
        ssh module <bkrichar@unity.ncsu.edu>
    Re: syswrite() lies <jdf@pobox.com>
    Re: The Perl Index Project <sb@sdm.de>
        UNIX GUI Perl Debugger <keith.a.humphrey@ac.com>
    Re: UNIX GUI Perl Debugger <dgris@moiraine.dimensional.com>
    Re: UNIX GUI Perl Debugger <tchrist@mox.perl.com>
    Re: UNIX GUI Perl Debugger <cmcurtin@interhack.net>
    Re: UNIX GUI Perl Debugger (Andrew Allen)
    Re: Win98 asscoiations <mcti@my-dejanews.com>
    Re: Win98 asscoiations <memberjh@yahoo.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 5 May 1999 16:18:23 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: procedure to convert sec to HH:MM:SS format
Message-Id: <3730613f@newsread3.dircon.co.uk>

peter <godzila@freemail.nl> wrote:
> Hello,
> 
> Can some one tell me how can I convert sec to a normal time format
> hh:mm:ss.
> For example I have a perl script which put the output of a connection in
> sec 603 in a variable.
> Now I want to display this outcome in this format 00:10:03.
> 
> 

Of course with a moments thought and a look at the perlop and perlfunc
manpages might have suggested something like:


$timestring = sprintf("%02d:%02d:%02d",
                      int ($sec /3600 ),
                      int(($sec % 3600 ) / 60 ),
                      $sec % 60 );


I'd say thats the plodders way - someone will come with something a lot
more exciting before long I'm sure.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>



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

Date: Wed, 5 May 1999 08:59:21 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: procedure to convert sec to HH:MM:SS format
Message-Id: <MPG.119a0ab48f9445c99899ce@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <3730613f@newsread3.dircon.co.uk> on 5 May 1999 16:18:23 
+0100, Jonathan Stowe <gellyfish@gellyfish.com> says...
 ...
> $timestring = sprintf("%02d:%02d:%02d",
>                       int ($sec /3600 ),
>                       int(($sec % 3600 ) / 60 ),
>                       $sec % 60 );

Redundant use of int()!  :-)

> I'd say thats the plodders way - someone will come with something a lot
> more exciting before long I'm sure.

It'll be a long wait, I think.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 5 May 1999 07:39:43 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: procedure to convert sec to HH:MM:SS format
Message-Id: <vlapg7.9q5.ln@magna.metronet.com>

peter (godzila@freemail.nl) wrote:

: Can some one tell me how can I convert sec to a normal time format
: hh:mm:ss.
: For example I have a perl script which put the output of a connection in
: sec 603 in a variable.
: Now I want to display this outcome in this format 00:10:03.


   There are 60 seconds in a minute.

   There are 60 minutes in an hour.

   Perl has division and modulus operators.

   Just do the arithmetic  :-)


   What part are you stuck on?


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Wed, 05 May 1999 18:13:26 +0200
From: Sebastian Frankfurt <sf@tellux.de>
To: sf@tellux.de
Subject: Q: checking defined/usable handles?
Message-Id: <37306E26.4A0AB9B0@tellux.de>

Hello,

I am getting some handles via IPC::Open3 and save them in variables.
And now I could print something out into the IN-Handle of that process.


[...]

IPC::Open3('READER', 'WRITER', '', "$program 2>&1\n");  # ok
$p_in  = *READER;                                       # ok
$p_out = *WRITER;                                       # ok

[...]

print $p_out "some nice output\n"; # ok if other process is running
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   if the process I opened via IPC::Open3 has been
terminated before this call, my 'print' is waiting
for hours.

So, there are (I think) two solutions:

1) I have to check, if the handle '$p_out' is usable
   -> 'defined($p_out)' is not working, cause it will
      look if '$p_out' is defined and not the handle it
      represents.

or

2) I have to check, if the other process is still running


Has anyone an idea?


thanx,

Sebastian Frankfurt



P.S.: Please reply also to my email account in addition the newsgroup...


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

Date: Wed, 5 May 1999 17:31:11 +0200
From: "Vincent Vanbiervliet" <vvb@ibm.net>
Subject: Re: Read vs. <STDIN>
Message-Id: <37305512@news.uk.ibm.net>

Thanks Larry.

However - and I realize this is more CGI then perl - I do have the
impression that when a form gets sent, there is alway exactly one line, even
when CRLF chars are used (they're packed to %0d%0a...) So I guess it's the
same, although the error checking you use is interesting. Do you know of any
condition that would cause the read to fail, and still have a valid use for
the errormsg (I mean: if the connection between the user and server is lost,
there's not much point in sending back an answer that this happened... since
there is no connection anymore)

BTW: I tried using CGI:PM, but I find it much easier to use straight perl -
I didn't understand a thing, and it looks to me that one has to learn a lot
more to use the module correctly. But hey, I'm used to write HTML (so I
don't really need the easy html writing), and my previous server used rexx,
which was a lot slower and harder to code than perl.

Vincent Vanbiervliet
http://learn.ibm.be


Larry Rosler <lr@hpl.hp.com> wrote in message
news:MPG.1199f7c8438cad999899cc@nntp.hpl.hp.com...
> [Posted and a courtesy copy sent.]
>
> In article <37303863@news.uk.ibm.net> on Wed, 5 May 1999 15:28:47 +0200,
> Vincent Vanbiervliet <vvb@ibm.net> says...
> > whenever you read on using Perl for CGI, this is the syntax used for
reading
> > the input of a POST-ed form:
> >          read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
> > This works, but when I just learned Perl (or rather: could modify
scripts to
> > fit my needs :-) I could never remember this line. So I discoverd I
could
> > also use:
> >          $buffer=<STDIN>;
> > These two lines read both the same from STDIN - or in this case whatever
the
> > user filled in in the form.
> >
> > As these two lines seem to do the same, can anyone explain IF there is a
> > difference, and if so, what it is and which is better to use?
>
> There is a big difference if the input consists of more than one line.
> The first (read) statement reads all of the input, while the second
> (<STDIN>) reads the first line only.
>
> By the way, the correct use of the first statement is:
>
> if (read(STDIN, $buffer, $ENV{CONTENT_LENGTH}) != $ENV{CONTENT_LENGTH})
> {
>     # Report an error and quit!  For example, ...
>     print "Content-type: text/plain\n\nError reading input!\n";
>     exit;
> }
>
> If you're going to do your own CGI interface, do it right!  But 'the
> books' don't tell you this.  :-(
>
> --
> (Just Another Larry) Rosler
> Hewlett-Packard Company
> http://www.hpl.hp.com/personal/Larry_Rosler/
> lr@hpl.hp.com




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

Date: 5 May 1999 10:11:14 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Read vs. <STDIN>
Message-Id: <37306da2@cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    "Vincent Vanbiervliet" <vvb@ibm.net> writes:
:BTW: I tried using CGI:PM, but I find it much easier to use straight perl -
:I didn't understand a thing, and it looks to me that one has to learn a lot
:more to use the module correctly. 

No.

    use CGI ':standard';

    $name   = param("name");
    @colors = param("colors");

---tom
-- 
I'm a programmer: I don't buy software, I write it.
    --Tom Christiansen


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

Date: 05 May 1999 12:22:24 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Read vs. <STDIN>
Message-Id: <x7zp3jxz9b.fsf@home.sysarch.com>

>>>>> "VV" == Vincent Vanbiervliet <vvb@ibm.net> writes:

  VV> Thanks Larry.  However - and I realize this is more CGI then perl
  VV> - I do have the impression that when a form gets sent, there is
  VV> alway exactly one line, even when CRLF chars are used (they're
  VV> packed to %0d%0a...) So I guess it's the same, although the error
  VV> checking you use is interesting. Do you know of any condition that
  VV> would cause the read to fail, and still have a valid use for the
  VV> errormsg (I mean: if the connection between the user and server is
  VV> lost, there's not much point in sending back an answer that this
  VV> happened... since there is no connection anymore)

do you know the difference between GET and POST? there is no requirement
for encoding in a post since it is sent via STDIN. so you can see \n
just fine there. therefore there is a big difference between <> and
sysread. also sysread is faster as it doesn't use stdio buffering.

and you are not reading from the client but from the server. so if you
get a read error, it could be useful to log it or even report back to
the server. it may not be a broken connection but something else like an
interrupted i/o call.

  VV> BTW: I tried using CGI:PM, but I find it much easier to use
  VV> straight perl - I didn't understand a thing, and it looks to me
  VV> that one has to learn a lot more to use the module correctly. But
  VV> hey, I'm used to write HTML (so I don't really need the easy html
  VV> writing), and my previous server used rexx, which was a lot slower
  VV> and harder to code than perl.

what about CGI.pm is not straight perl? what do you find hard about it?
you don't have to use all of its features. for parsing and handling a
cgi request it beats any roll your own (except if you insist on blazing
speed).

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Wed, 5 May 1999 07:03:54 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Reading extremely large files a chunk at a time
Message-Id: <qi8pg7.jn5.ln@magna.metronet.com>

adam moore (paxamr@unix.ccc.nottingham.ac.uk) wrote:

: I have written a script to convert single files from a large flat file
: database into XML.  Now I want to convert the whole database at one go.
: Each record is a series of lines 80 chars or less with a two letter ID tag
: at the start.  The end of each record is given by "//" on a line on it's
                                                    ^^^^^^^^^^^^^^

    Look up Perl's $/ (input record separator) in the perlvar.pod
    man page. I think it will help there.


: own (It's the SwissProt files http://www.expasy.ch, if you want to know).

: The individual file parser uses @inbuff=<INPUT> to read the file and then
: processes each line / group of lines with the same ID.  The whole database
: is >200Mb, so I obviously can't use that any more.  Is there any way to
: read each file up to "//" into @inbuff, then move on?


   Yep. See above.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 5 May 1999 15:17:21 GMT
From: ada@fc.hp.com (Andrew Allen)
Subject: s///ge & $`
Message-Id: <7gpne1$d3k$1@fcnews.fc.hp.com>

so the following code:

  perl5 -e '$a="abcd"; $a=~s/./print "$`-";"x"/ge;'

prints out:

  -a-ab-abc-

which I find surprising, at best. Obviously, the man behind the
curtains is doing the "substitutions" on the old string while building
the new string. But is there any way of getting the "real" $` (i.e.,
the one with the substitutions I've already made?)

If it's really supposed to work like this, I think perlvar should at
least document it. I'd like a little feedback before submitting the
request.

Oh, yeah:

  This is perl, version 5.005_02 built for PA-RISC1.1

Andrew


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

Date: Wed, 05 May 1999 16:14:39 GMT
From: dstorrs@megazone.bigpanda.com
Subject: Re: Security:HowTo not pass UserID/Password as hidden variables from page to page
Message-Id: <7gpqp9$o8l$1@nnrp1.dejanews.com>

Probably the easiest is to encrypt the userID/password and pass the
encrypted form.

Alternatively, you can have a login page where the user is assigned a
sessionID and the sessionID is passed in the hidden fields.  There are
modules on CPAN that will do this for you...don't remember the names,
but you might look for Apache::Session.  Last time I had to do this, I
rolled my own because we were building from the ground up and it was
easy enough to integrate.

        Hope this helps.

                   Dave Storrs

In article <372907CA.8CBC8E8D@blarg.net>,  nichols <nichols@blarg.net>
wrote:
> I have a web application that is written in Perl that accesses an
Oracle
>
> database that requires a user_id/password for each person.
>
> There is a login page that requires the user_id and password.   On
> subsequent pages, the user_id and password are passed as hidden
> variables..  Of course, this is a security hole.  The user can edit
the
> source html and see the password.  If you save it as a cookie, it is
> still viewable on the user's machine.
>
> What approach would you recommend to solve this problem?  Does anyone
> have sample code?
>
> Thanks for your help,
>
> Frankie
>
>

----- Posted via Deja.com, The People-Powered Information Exchange -----
------ http://www.deja.com/   Discussions * Ratings * Communities ------


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

Date: 5 May 1999 17:34:33 +0100
From: karrer@iis.ee.ethz.ch (Andreas Karrer)
Subject: setting PATH in BEGIN clause
Message-Id: <slrn7j0p89.bua.karrer@kuru.ee.ethz.ch>

I notice that in several examples in the perlipc man page
the PATH environment variable is set in the BEGIN clause, e.g.

         #!/usr/bin/perl -Tw
         use strict;
         BEGIN { $ENV{PATH} = '/usr/ucb:/bin' }
         use Socket;
         use Carp;
       ...

Is there a special reason to do this an not simply write

         $ENV{PATH} = '/usr/ucb:/bin';

There is certainly a reason to set LD_LIBRARY_PATH in a BEGIN clause,
but why PATH?

 - Andi


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

Date: Wed, 05 May 1999 16:52:43 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: setting PATH in BEGIN clause
Message-Id: <37317712.8334264@news.skynet.be>

Andreas Karrer wrote:

>I notice that in several examples in the perlipc man page
>the PATH environment variable is set in the BEGIN clause, e.g.
>
>         BEGIN { $ENV{PATH} = '/usr/ucb:/bin' }
>         use Socket;
>         use Carp;
>
>Is there a special reason to do this an not simply write
>
>         $ENV{PATH} = '/usr/ucb:/bin';

"use". If you try to do it without the BEGIN block, the use-d modules
don't use the newly set value.

	Bart.


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

Date: Wed, 05 May 1999 16:55:09 GMT
From: "Bob Lally" <rlally1@nycap.rr.com>
Subject: Showfile.pl or .cgi
Message-Id: <NJ_X2.18101$Dx6.403420@dfiatx1-snr1.gtei.net>

Hi:

Does anyone have showfile.pl (or .cgi) that they can email to me please
 rlally1@nycap.rr.com) .  I can not seem to find it on the net any place.

Thank you much.

Bob





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

Date: 5 May 1999 16:44:26 GMT
From: Brian Keith Richards <bkrichar@unity.ncsu.edu>
Subject: ssh module
Message-Id: <7gpsha$ofr$1@uni00nw.unity.ncsu.edu>

Are there any modules that support file transfer over ssh?

-- 
-Brian
--                                                    \:/_
 __________/|      North Carolina Music Central     ./\O,
(_|__|_____\|________ SkAnK lOnG aNd PrOsPeR          /\/
     |_|_____________)    ncmusic@pobox.com           :_
                    http://pobox.com/~ncmusic         \ \/
                                                      /_
                                                              


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

Date: 05 May 1999 12:15:45 -0400
From: Jonathan Feinberg <jdf@pobox.com>
To: elderr@us.ibm.com
Subject: Re: syswrite() lies
Message-Id: <m3iua75w7i.fsf@joshua.panix.com>

elderr@us.ibm.com writes:

> $srcfilesize=sysread(SRCFILE,$srcfiledata,10000000);  # read at most 10MB

That number is nowhere near 10MB.

> #write 2KB of data
> open(OUTFILE,">outfile.txt");
> $byteswritten=syswrite(OUTFILE,$srcfiledata,2048);  # write 2KB (hopefully)

This is a broken OS problem, best attacked with the binmode() builtin.

   perldoc -f binmode

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: 5 May 1999 12:55:08 GMT
From: Steffen Beyer <sb@sdm.de>
Subject: Re: The Perl Index Project
Message-Id: <7gpf3c$i9p$1@solti3.sdm.de>

In comp.lang.perl.misc silver <silver@silverchat.com> wrote:

> = What do you Think? =

> Would you use this?

VERY probably!

> Would you contribute?

Got no time, alas.

> Do you think it's a good idea?

Definitely!

> Am I being redundant with an existing project?

Not that I know of, except Internet Search Engines, provided some of the
books are already available online.

> Do you know of any reason phase 2 would fail, making this pointless
> right off the bat?

No, but the whole thing might turn out to be too much work for anybody.
That'd be a pity, though, since it's a very appealing project!

Keep up the great work and the numerous ideas you're providing to the
Perl community (this isn't the first posting of yours that I see and
find very interesting, BTW)!

Best regards,
-- 
    Steffen Beyer <sb@engelschall.com>
    http://www.engelschall.com/u/sb/whoami/
    http://www.engelschall.com/u/sb/download/
    http://www.perl.com/CPAN/authors/id/STBEY/
    http://www.oreilly.de/catalog/perlmodger/bnp/


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

Date: 5 May 1999 15:02:23 GMT
From: "Keith A. Humphrey" <keith.a.humphrey@ac.com>
Subject: UNIX GUI Perl Debugger
Message-Id: <01be9710$3454dbc0$85c77a95@soagpf08.cscoe.ac.com>

Are there any GUI Perl debuggers for a HPUX system ?


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

Date: 05 May 1999 09:22:58 -0600
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: UNIX GUI Perl Debugger
Message-Id: <m3hfpree25.fsf@moiraine.dimensional.com>

"Keith A. Humphrey" <keith.a.humphrey@ac.com> writes:

> Are there any GUI Perl debuggers for a HPUX system ?

xemacs

dgris
-- 
Daniel Grisinger          dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print 
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'


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

Date: 5 May 1999 10:08:09 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: UNIX GUI Perl Debugger
Message-Id: <37306ce9@cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    "Keith A. Humphrey" <keith.a.humphrey@ac.com> writes:
:Are there any GUI Perl debuggers for a HPUX system ?

vi.  

Actually, I can't figure out how to get TIOCSTI going on 
HP.  I wonder whether it's not supported, or you have
to do some funny stream thing.

--tom

#!/usr/bin/perl
# pvdb, a vi-aware front-end for the perl debugger 
# tchrist@perl.com
# v2.0-alpha, Fri Mar 26 08:40:54 MST 1999

use strict;
use POSIX qw(setsid);   # XXX: called unnecessarily sometimes
use Config;   		# XXX: called unnecessarily sometimes

$ENV{PATH} .= ":/etc";
my $FIONREAD;
my $TIOCSTI;

# XXX: this gets (at least :-) called twice
($FIONREAD, $TIOCSTI) = get_config(); 

if (defined $ARGV[0] && $ARGV[0] eq '-v') {
    shift;
    slave_vi(@ARGV);
} else {
    run_debugger(@ARGV);
} 
exit;

my(
    $file,
    $fifo,
    $iopid,
    $xtpid,
    $kidpid,
    $tty,
    @kidpids,
);

sub run_debugger { 
    $file = shift || die "usage: $0 file [args]\n";
    -r $file or die "can't read $file: $!";

    $fifo = "/tmp/pvd-fifo.$$";
    unlink $fifo;
    $SIG{INT} = 'IGNORE';
    #system("mknod $fifo p") and die "mknod failed";
    system("mkfifo $fifo") and die "mknod failed";  # XXX: wrong path?

    unless (defined ($iopid = fork)) {
	die "can't fork: $!";
    } 
    unless ($iopid) {
	POSIX::setsid();
	exec "xterm",   -ah,		# keep cursor bright
			-wf,		# wait to remap; XXX: doesn't work?
			-fg	=> 'Navy',
			-bg	=> 'Plum',
			-n 	=> "pvdb i/o",
			-T 	=> "pvdb i/o", 
			-fn     => "6x10",
			-geom	=> "85x25+3+4",
			-e 	=> 'sh', '-c', qq{
			    tty > $fifo; 
			    sleep 10000000;
			}; 

	die "can't exec xterm: $!";
    } 
    push @kidpids, $iopid;

    open(FIFO, "< $fifo");
    $tty = <FIFO>;
    close FIFO;

    unless (defined ($xtpid = fork)) {
	die "can't fork: $!";
    } 
    unless ($xtpid) {
	POSIX::setsid();  # wish I remembered why I did this
	exec "xterm",   
			-ah,
			-wf,
			-fg		=> 'Red',
			-bg		=> 'LightSkyBlue1',
			-n 		=> "pvdb edit",
			-T 		=> "pvdb edit", 
			-fn         	=> "6x10",
			-geom		=> "85x55+349+4",
			-e 		=> $0, "-v", $fifo;
	die "can't exec xterm: $!";
    } 

    push @kidpids, $xtpid;

    $| = 1;

    # i hate having to hide, but the compiler sees this on both runs
    # otherwise
    eval q{
	END { 
	    local $SIG{CHLD} = 'IGNORE';
	    unlink $fifo;
	    kill "TERM" => @kidpids;  # kill them; kill them all!
	}
    };
    die if $@;

    $SIG{CHLD} = sub {
	unless (wait() == -1) { 
	    print "Whoops, that debugger just exited.\n" ;
	    exit;
	}
    }; 

    unless (defined ($kidpid = open(KID, "-|"))) {
	die "can't fork: $!";
    } 

    open(FIFO, ">$fifo") || die "can't open $fifo: $!";
    select((select(FIFO), $| = 1)[0]);

    unless ($kidpid) { 
	$ENV{PERLDB_OPTS} = "LineInfo=$fifo";
	$SIG{INT} = 'DEFAULT';  # still needed?
	open(STDOUT, ">$tty") || die "can't open $tty: $!";
	open(STDERR, ">$tty") || die "can't open $tty: $!";
	open(STDIN,  "<$tty") || die "can't open $tty: $!";
	# XXX: darned -emacs kills readline!
	exec $^X, '-dS', $file, '-emacs', @_;
	die "Can't exec debugger: $!";  # XXX: went to other tty
    } 

    push @kidpids, $kidpid;
    while ($_ = getline(*KID)) {
	chomp;
	my($file, $line) = /^(?:\032\032)?(.*?):(\d+):(\d+)/;
	unless ($file =~ /\beval\b/) {
	    print FIFO "$file $line\n";
	}
    } 

}

# I've simply decided that stdio is not a friend of mine.
sub getline {
    my $fh = $_[0];
    my $buf = '';
    my $long = pack("L", 0);
    for (;;) { 
	my $smask = '';
	vec($smask, fileno($fh), 1) = 1;
	my $ok = select($smask, undef, undef, $buf ? 0.25 : undef);
	if (!$ok) {
	    return $buf if $buf;
	    warn "select: $!";
	    next;
	} 
	ioctl($fh, $FIONREAD, $long) or die "can't FIONREAD: $!";
	my $count = unpack("L", $long);
	die "count is empty" unless $count =~ /\d/;
	my $chars = '';
	sysread($fh, $chars, $count);
	$buf .= $chars;
	if ($buf =~ /DB<\d+> $/ or $buf =~ /\n/) { # XXX: no more DB< ?
	    return $buf;
	} 
    }
} 

sub slave_vi {
    my($tty,
       $pid, 
       $fifo,
    );

    unless (@_ == 1 and -p ($fifo = shift)) { die "usage: $0 fifo"; }

    my $editor = $ENV{EDITOR} || 'vi';

    $SIG{TTOU} = 'IGNORE';

    chomp($tty = `tty`);
    open(TTY, "+> $tty") || die "no /dev/tty: $!";
    die "can't fork: $!" unless defined ($pid = fork);
    unless ($pid) {
	exec $editor;
	die "can't exec $editor";
    }
    jam (":set ro\n");   # read only
    jam (":set nu\n");   # line numbers
    open (FIFO, $fifo) || die "can't open $fifo: $!";

    my $oldfile = '';
    kill "WINCH" => $pid;  # must resize cause xterm is confused

    eval q{
	END { unlink $fifo }
    };

    while (<FIFO>) {
	unless (s/^\032\032//) { 
	    print "GOT REGULAR INPUT: $_";   # XXX: what's this?
	    next; 
	} 
	chomp;
	my($file, $line) = split /:/;
	if ($file ne $oldfile && $file !~ /\beval\b/) {
	    # XXX: sometimes "unknown command" errors; why?
	    jam(":n +$line $file\n");  
	    $oldfile = $file;
	} else {
	    jam("${line}G");
	} 
    } 
}

# XXX: knows that TTY is open 
sub jam {
    for (split(//, $_[0])) {
        ioctl(TTY, $TIOCSTI, $_) || die "bad TIOCSTI: $!";
    } 
} 

sub get_config {
    use Config;
    if ($Config{archname} =~ /^i\d86-linux$/) {
	return (0x541b, 0x5412)
    } 
    elsif ($Config{archname} =~ /^OpenBSD.i\d86-openbsd$/) {
    	return (0x4004667f,0x80017472);
    } 
    elsif ($Config{archname} =~ /^sun4-sunos$/) {   # real sunos, not solaris
    	return (0x4004667f,0x80017472);  # coincidence? :-)
    }
    else {
	warn "No predefined sys values found";
    } 

    eval { require "sys/ioctl.ph" };
    my $fion = eval { &FIONREAD };
    my $tioc = eval { &TIOCSTI };
    if (2 == grep {defined} $fion, $tioc) {
	return ($fion, $tioc);
    } 
    print STDERR "No FIONREAD and TIOCSTI found in sys/ioctl.ph -- compiling...";
    my $cfile = "/tmp/fiotio";
    open(CSRC, "> $cfile.c") || die "can't open $cfile.c: $!";
    eval q{ END { unlink($cfile, "$cfile.c") } };
    print CSRC <<'EOF';
#include <sys/ioctl.h>
main() {
printf("%#x\n%#x\n", FIONREAD, TIOCSTI);
exit(0);
} 
EOF
    close CSRC or die "can't close $cfile.c: $!";
    system("cc -o $cfile $cfile.c")
	and die "can't compile $cfile.c";
    ($fion, $tioc) = split ' ', `$cfile`;
    die "can't run $cfile $fion $tioc: $?" if $?;
    print STDERR " using FIONREAD=$fion TIOCSTI=$tioc\n";
    return map { hex } ($fion, $tioc);

} 
-- 
   "Any technology distinguishable from magic is insufficiently advanced."


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

Date: 05 May 1999 12:27:20 -0400
From: Matt Curtin <cmcurtin@interhack.net>
Subject: Re: UNIX GUI Perl Debugger
Message-Id: <xlxhfpr8ot3.fsf@gold.cis.ohio-state.edu>

>>>>> On 5 May 1999 10:08:09 -0700,
    Tom Christiansen <tchrist@mox.perl.com> said:

Tom> Actually, I can't figure out how to get TIOCSTI going on HP.

There's a reason why HP-UX is pronounced "H-pukes". :-)

-- 
Matt Curtin cmcurtin@interhack.net http://www.interhack.net/people/cmcurtin/


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

Date: 5 May 1999 16:34:01 GMT
From: ada@fc.hp.com (Andrew Allen)
Subject: Re: UNIX GUI Perl Debugger
Message-Id: <7gprtp$eqr$1@fcnews.fc.hp.com>

Keith A. Humphrey (keith.a.humphrey@ac.com) wrote:
: Are there any GUI Perl debuggers for a HPUX system ?

Andrew E Page <aep@world.std.com> has been working on:

: ptkdb  A  Perl debugger with Graphical User Interface
: Compatible with Unix, Linux, Win95/NT

: You can find this utility with at:

: http://world.std.com/~aep/ptkdb

Haven't used it, but the screen dump looks nice :)

Andrew


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

Date: Wed, 05 May 1999 14:51:43 GMT
From: Lacrosse_20 <mcti@my-dejanews.com>
Subject: Re: Win98 asscoiations
Message-Id: <7gpltt$ji3$1@nnrp1.dejanews.com>

MS Personal Web Server sucks for trying to get ANY perl cgi programs to work.
If you can, use a different server.  If you can't, have you checked the
registry to make sure that the proper mapping was created?  To find out
exactly how, check the cgi part of the MS Personal Web Server documentation. 
It should cover all of the necessary steps.  There is no guarantee, however,
that it will work once you've got that implemented.

Also, one very important step that you may have missed that could easily
cause this grief is that you maybe forgot to print the content-type for your
output as shown below:

print "content-type: text/html\n\n";

this should be the first thing you print.

Hope this helps....good luck!

In article <925900270.10971.0.nnrp-03.9e983a8c@news.demon.co.uk>,
  "Andrew Brown" <andrew@chateaux.com> wrote:
> I have correctly associated .pl to be run by perl.exe as per the docs from
> Activestate but I still get the problem of the browser trying to download my
> script instead of running it.
>
> I'm using Win98 and MS Personal web server.
>
> Anyone know what I am doing wrong ?
>
> tia,
>
>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Wed, 5 May 1999 12:20:47 -0400
From: "Jane H." <memberjh@yahoo.com>
Subject: Re: Win98 asscoiations
Message-Id: <7gpr1m$90b@dfw-ixnews7.ix.netcom.com>

1. make sure the first thing you have in your script is:
  print "CONTENT-TYPE: text/html\n\n";

2. IF you still get the error, it's most likely your registry. For that you
will have to:

Start-> run-> regedit.exe
edit->find-> "Script Map"

and associate ".pl" with

YOUR PERL PATH\usr\local\bin\perl.exe %s %s



But FIRST, try step 1.  If AND ONLY IF, it doesn't work go on to step 2.
You DON'T WANT TO MESS WITH your registry UNNECESSARILY.  You could end up
having to reinstall everything, and I do mean EVERYTHING.


As for your question:

>> Anyone know what I am doing wrong ?

        Of course-- you're using Microsoft .  Isn't it obvious? :).




>In article <925900270.10971.0.nnrp-03.9e983a8c@news.demon.co.uk>,
>  "Andrew Brown" <andrew@chateaux.com> wrote:
>> I have correctly associated .pl to be run by perl.exe as per the docs
from
>> Activestate but I still get the problem of the browser trying to download
my
>> script instead of running it.
>>
>> I'm using Win98 and MS Personal web server.
>>
>> Anyone know what I am doing wrong ?
>>
>> tia,
>>
>>
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own




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

Date: 12 Dec 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 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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 5571
**************************************

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