[18650] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 818 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 2 03:05:56 2001

Date: Wed, 2 May 2001 00:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <988787108-v10-i818@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 2 May 2001     Volume: 10 Number: 818

Today's topics:
        $Response->printf ("my float rounded up to 2 dp."); <justin.devanandan.allegakoen@intel.com>
        attachments and sendmail /HELP/ (optional)
    Re: attachments and sendmail /HELP/ (David Efflandt)
    Re: attachments and sendmail /HELP/ <alb@albert-inc.com>
    Re: AUTOLOAD Clarification nobull@mail.com
    Re: Capturing the output of perl -c myfile.pl (Martien Verbruggen)
    Re: Chicago Perl Consultants Needed <jdblack@black.metronet.com>
        Concatenating mpegs <Brad.Morrison@mincom.com>
    Re: Hacker challenge. Can you break this script for me? <bart.lateur@skynet.be>
    Re: Hacker challenge. Can you break this script for me? <uri@sysarch.com>
    Re: Hacker challenge. Can you break this script for me? (Gwyn Judd)
    Re: Hacker challenge. Can you break this script for me? <godzilla@stomp.stomp.tokyo>
    Re: How to: Create Regex which extracts N number of wor (Richard J. Rauenzahn)
        HTML::LinkExtor problem <zakaria1@hotmail.com>
    Re: Listing files on client end? (Tad McClellan)
    Re: one-line stderr, stdout redirection <uri@sysarch.com>
    Re: perl script for changing file names and extensions (Tad McClellan)
    Re: Question about float to hex (Richard J. Rauenzahn)
    Re: Question about float to hex <dodger@necrosoft.net>
    Re: Questions about sleep function <jdblack@black.metronet.com>
    Re: Questions about sleep function (David Efflandt)
    Re: R-E Perl Code <cave@pertus.com.pl>
        radio_group and params (DEDSRD)
    Re: Strange string -> num conversion (Richard J. Rauenzahn)
    Re: submission script help! <dodger@necrosoft.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 2 May 2001 14:38:29 +0800
From: "Just in" <justin.devanandan.allegakoen@intel.com>
Subject: $Response->printf ("my float rounded up to 2 dp.");
Message-Id: <9coa1c$d7p@news.or.intel.com>

Dear all,

I am using PerlScript to present a report on an asp.
Perl is good for me, up until the point (pun intended), where I get stuck.
If one of you kind souls could point me in the right direction, I'd be very
much obliged.

I have a float variable that needs displaying, it has no fixed dp length,
but I want it rounded up or down to 2 dp, and displayed.

$Response->Write displays it as a horridly long float, and what I would like
here is printf functionality.

FAQ points me to POSIX. But all I see in there is ceil and upper, and I dont
really
want to make the distinction, I want Perl to do it for me.

Has some creative person come up with a substitution that evaluates and
rounds to x dp?
Or is there another module floating (pun intended) around specifically for
this?

Thanks in advance.




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

Date: Wed, 02 May 2001 02:43:29 GMT
From: not@ALLSANE.COM (optional)
Subject: attachments and sendmail /HELP/
Message-Id: <3aef742c.363487155@news-server.tampabay.rr.com>

Below is a pretty simple program that takes in form data through
CGI.pm and a hash split then writes the data to the browser then saves
the file attachment to the server.  The program then emails the
information to (in this case me) someone.  PROBLEM-- I want to attach
the new file to the e-mail.  I can't seem to find any documentation on
the feature of sendmail.  can somebody sho me how to do this..

Thanks.
Thomas







#!/usr/bin/perl

use strict;
use CGI qw/:standard/;
$|++;

my %form;
@form{param()}=map(param($_),param);

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

  open (OUT, ">$form{FILE}") or die "Could not open $form{FILE} for
wrinting\n";
  my $buf;
  while(read($form{FILE}, $buf,2048)){
    print OUT $buf;
}
close OUT;

print "Name: $form{NAME}<br>";
print "Other: $form{OTHER}<br>";
print "File: $form{FILE} SAVED<br>";


 open MAIL, "|/usr/sbin/sendmail -t";
                print MAIL "To: master\@2brothers.net\n";
                                print MAIL "From:
script\@2brothers.net\n";
                                print MAIL "Subject: This is the
stuff\n";
                                print MAIL "Reply-To:
nowhere\@2brothers.net\n\n";
                                print MAIL "
$form{NAME}
$form{OTHER}
$form{FILE}

\n\n";
                close MAIL;



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

Date: Wed, 2 May 2001 03:27:22 +0000 (UTC)
From: see-sig@from.invalid (David Efflandt)
Subject: Re: attachments and sendmail /HELP/
Message-Id: <slrn9euvkp.i3j.see-sig@typhoon.xnet.com>

On Wed, 02 May 2001 02:43:29 GMT, optional <not@ALLSANE.COM> wrote:
> Below is a pretty simple program that takes in form data through
> CGI.pm and a hash split then writes the data to the browser then saves
> the file attachment to the server.  The program then emails the
> information to (in this case me) someone.  PROBLEM-- I want to attach
> the new file to the e-mail.  I can't seem to find any documentation on
> the feature of sendmail.  can somebody sho me how to do this..

MIME::Lite works well with CGI.pm file uploads.  But you might need to 
install it yourself and include:  use lib '/path_to/mymodules';
first to tell Perl where you put the 'MIME' dir containing 'Lite.pm'.

-- 
David Efflandt  (Reply-To is valid)  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/


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

Date: Wed, 02 May 2001 06:13:53 GMT
From: Alain BARBET <alb@albert-inc.com>
Subject: Re: attachments and sendmail /HELP/
Message-Id: <3AEFA5A1.29620A9A@albert-inc.com>

> ...  I can't seem to find any documentation on
> the feature of sendmail.  can somebody sho me how to do this..

Take a look in MIME::Lite and MIME::Lite::HTML documentation.
HTH,
--
Alain


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

Date: 30 Apr 2001 19:27:40 +0100
From: nobull@mail.com
Subject: Re: AUTOLOAD Clarification
Message-Id: <u9hez6z1ib.fsf@wcl-l.bham.ac.uk>

"Jason Hurst" <jasonh@colubs.com> writes:

> I'm having problems understanding the autoload method.  I understand the
> principle as to how it works: when a method isn't defined, it goes to the
> autoload method instead.  My confusion is when you're extending a module
> that has an autoload function and your new module ALSO has an autoload
> function.  Can I access the SUPER::AUTOLOAD if the function doesn't exist in
> my new module.

It's messy.  There was a very good thread here on this a few  weeks
back. "Polite AUTOLOAD sub?"

BTW: Can you explain how you failed to find this in your Usenet search?

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Wed, 02 May 2001 02:43:13 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Capturing the output of perl -c myfile.pl
Message-Id: <slrn9eut21.4mi.mgjv@verbruggen.comdyn.com.au>

On Tue, 01 May 2001 21:31:35 +1000,
	Jfreeman <jfreeman@tassie.net.au> wrote:
> 
>          Because it has proven impossible to capture the output from perl -c
> here is what I currently use:

Has it proven to be impossible, or couldn't you find a way to do it?

#!/usr/local/bin/perl -w
use strict;
my $p = $ARGV[0] || $0;
my @lines = `perl -c $p 2>&1`;
print @lines;

Or isn't this what you mean?

The perlopentut documentation has some info on redirection. So does
the section on qx// in the perlop documentation.

Martien
-- 
Martien Verbruggen                      |
Interactive Media Division              | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Tue, 01 May 2001 21:04:17 -0500
From: "W.W.J.D. Black" <jdblack@black.metronet.com>
Subject: Re: Chicago Perl Consultants Needed
Message-Id: <010520012104170512%jdblack@black.metronet.com>


Hash: SHA1

In article <x7r8y9em2d.fsf@home.sysarch.com>, Uri Guttman
<uri@sysarch.com> wrote:

}>>>>> "WWJDB" == W W J D Black <jdblack@black.metronet.com> writes:
}
}  WWJDB> 
}  WWJDB> Hash: SHA1
}
}for this, you needed pgp signing?
}
}  WWJDB> In article <9cjqj9$rs9@spamz.news.aol.com>, Jason C. Hill
}  WWJDB> <jhill@technoslave.net> wrote:
}
}  WWJDB> }Don't make me skin you alive for making these lame posts about
}  WWJDB> potatoes!!!  }
}
}  WWJDB> Didn't Dan Q. get in trouble for spelling taters like that?
}
}no, he got in trouble for spelling the singular with a trailing e (the
}plural does have an e). in fact he corrected a kid in a classroom and
}added the e to the word on the blackboard while on camera. a classic
}moment.
}

Ah yes, the singular, that's right.  But here's something funny about
the whole affair.  Danny boy
was also right
(look it up if you don't believe me)

But then, that's all for my political statements in this newsgroup.

jdb


Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBOu9rHmy/lre8y0dpEQJEzgCgvI/2Ygxpeb2oCk5JaleOcDyLXlgAoNGl
spDcsVY4/fHxkGjN6UUXdpe6
=HvLM
-----END PGP SIGNATURE-----


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

Date: 2 May 2001 02:24:11 GMT
From: "Brad Morrison" <Brad.Morrison@mincom.com>
Subject: Concatenating mpegs
Message-Id: <01c0d2ae$f7234480$b37711ac@A014941>

Hello,

I have a series of mpegs that belong to the same movie. I would like to
concatenate
these movies into the one mpeg file using Perl.

I have tried opening each mpeg in succession (in binmode), looping over the
contents, and printing (also using binmode on my output filehandle) each
line to the one mpeg file. However, while the resulting movie is the
correct size only the first movie plays. Presumably, there is some movie
length control data that defines the size of the movie.

A search on CPAN did not reveal anything useful.

So, is this possible without delving too deeply into the mpeg file spec?

Thanks kindly in advance,

Brad



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

Date: Wed, 02 May 2001 01:09:19 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Hacker challenge. Can you break this script for me?
Message-Id: <ugnuetcre9t5lq6l1pco7b3gpjs5cmeva7@4ax.com>

Jfreeman wrote:

>It is next to impossible to strip a # char and everything following it until the
>end of that line (EOL) without causing a compilation error unless the #....EOL
>is a real comment.

Oh yeah?

	s#a#b#;
	/a//m#b#;

This is valid Perl.

	s
	/a//m

So is this.

-- 
	Bart.


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

Date: Wed, 02 May 2001 04:03:29 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Hacker challenge. Can you break this script for me?
Message-Id: <x7hez4e6sc.fsf@home.sysarch.com>

>>>>> "AS" == Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> writes:

  AS> According to Jfreeman  <jfreeman@tassie.net.au>:

  >> It is next to impossible to strip a # char and everything following it
  >> until the end of that line (EOL) without causing a compilation error
  >> unless the #....EOL is a real comment.

  AS> This assumption is incredibly naive.  This bit

  AS>     my $length = $#var;
  AS>     $var = 456;

  AS> will compile just fine after you cut off the "comment".  It will leave
  AS> a nasty bug too, especially if $var happens to be a scalar ref at the
  AS> time.  Except for the coexistence of $var with @var (yes, Uri, that's
  AS> bad praxis :), this code is by no means remarkable.

well, intentionally bad code that breaks a stupid program is good. i see
no reason for this thing and won't lift a finger to help. a better way
would be to run it through deparse but that is known to be broken in
places.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info:     http://www.sysarch.com/perl/OOP_class.html


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

Date: Wed, 02 May 2001 05:14:01 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Hacker challenge. Can you break this script for me?
Message-Id: <slrn9ev9pf.rj.tjla@thislove.dyndns.org>

"mein Luftkissenfahrzeug ist voll von den Aalen"
said Bart Lateur (bart.lateur@skynet.be) in 
<ugnuetcre9t5lq6l1pco7b3gpjs5cmeva7@4ax.com>:
>Jfreeman wrote:
>
>>It is next to impossible to strip a # char and everything following it until the
>>end of that line (EOL) without causing a compilation error unless the #....EOL
>>is a real comment.
>
>Oh yeah?
>
>	s#a#b#;
>	/a//m#b#;
>
>This is valid Perl.
>
>	s
>	/a//m

Actually I like this example:

#!/usr/bin/perl -w
use strict;
use Fcntl qw/:seek/;

my $stripped = 1;

# Is this a comment?
# CODE
# $stripped = 0
# CODE

seek DATA, 0, SEEK_SET;

while (<DATA>)
{
    next unless /^# CODE/ ... /^# CODE/;
  
    s/^#//;
    eval;
}

if ($stripped)
{
    print "Hey, you stripped my comments!\n";
}

__END__

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Reserve your abuse for your true friends.
             -- Larry Wall in <199712041852.KAA19364@wall.org>


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

Date: Tue, 01 May 2001 23:13:15 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Hacker challenge. Can you break this script for me?
Message-Id: <3AEFA57B.77A90E86@stomp.stomp.tokyo>

Uri Guttman wrote:
 
> Anno Siegel wrote:
> >  Jfreeman  wrote:
 
> > > It is next to impossible to strip a # char and everything following it
> > > until the end of that line (EOL) without causing a compilation error
> > > unless the #....EOL is a real comment.
 
> > This assumption is incredibly naive.  This bit
 
> >     my $length = $#var;
> >     $var = 456;
 
> > will compile just fine after you cut off the "comment".  It will leave
> > a nasty bug too, especially if $var happens to be a scalar ref at the
> > time.  Except for the coexistence of $var with @var (yes, Uri, that's
> > bad praxis :), this code is by no means remarkable.

> well, intentionally bad code that breaks a stupid program is good. i see
> no reason for this thing and won't lift a finger to help. a better way
> would be to run it through deparse but that is known to be broken in
> places.


Ahhh... come on Uri. You are a natural for this kind of stuff!
Despite your bad disposition, you are a true Perl guru.
Asking Perlies to hack a script is analogous to declaring
open season on yourself. Lock and Load, Uri!

I'll give you one to work with. Call for a module in a test
script which cannot be loaded into INC and run his comment
stripper. Wallah! 

Actually, his comment stripper does fairly much everything
it should. However, I am not so sure his overall approach
is all that logical. No need to compile a script in order
to strip comments. Certainly needs to run separate processes
or, write his programs as I do in my native tongue, Choctaw.

Heh! Uri, don't even think about using my hacking method
displayed today. It is way too ingenious and, too easy.
Ain't I a stinker?

Poor Freeman, probably feels like forty-thousand headmen
whooped him with ugly sticks.


Godzilla!
--
Forty-Thousand Headmen    ... and moi rocking on my cello!
  http://la.znet.com/~callgirl5/headmen.mid


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

Date: 1 May 2001 20:10:00 GMT
From: nospam@hairball.cup.hp.com (Richard J. Rauenzahn)
Subject: Re: How to: Create Regex which extracts N number of words before target word
Message-Id: <988747796.671523@hpvablab.cup.hp.com>




"BarryK" <notmyrealemail@example.com> writes:
>That's quite brilliant. Most elegant.

Thanks -- and thanks for updating your munging!  One last request for
now -- give up the habit of top posting.  It really annoys the locals,
and you're likely to get more help when you don't annoy the locals.

For a quoting guide:  http://www.netmeister.org/news/learn2quote2.html

>I tried to extend this to also include 2 words after the word, but this
>mucks up the elegant code
>
>===
>
>$_ = "word1 word2 word3 word4 cat word5 word6 word7";
>
>s/(\w+\W+){2}cat(\w+\W+){2}/Z/xg;
>
>print $_;

I'll give you a hint because you're really close -- look up the meanings
of \w and \W in the perlre man page and adjust what you added
accordingly.

(You do understand the purpose of the ()'s, right?  The {2} applies to
the entire sub expression within the ()'s.)

Rich


-- 
Rich Rauenzahn ----------+xrrauenza@cup.hp.comx+ Hewlett-Packard Company
Technical Consultant     | I speak for me,     |   19055 Pruneridge Ave. 
Development Alliances Lab|            *not* HP |                MS 46TU2
ESPD / E-Serv. Partner Division +--------------+---- Cupertino, CA 95014


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

Date: Tue, 01 May 2001 21:16:10 -0400
From: zaki <zakaria1@hotmail.com>
Subject: HTML::LinkExtor problem
Message-Id: <3AEF5FDA.F606110B@hotmail.com>

Hi,
i was using a program that uses HTML::Extor and  it works fine in
windows and i also tried it with redhat before with no problem. When i
copied it to my mandrake 8.0 and try to run it, it complains about
HTML/Tagset.pm not found in @INC...i went back to windows to look for
this module but i didnt find it, so it was working fine without it...i
dont understand what the problem can be? please help.


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

Date: Tue, 1 May 2001 23:40:54 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Listing files on client end?
Message-Id: <slrn9ev0e6.juh.tadmc@tadmc26.august.net>

Scott Shannon <sshannon@acc.com> wrote:
>
>Hi. I'd like to know the simplest way, using a perl cgi script, to list
                                                     ^^^
>the files (placed, say, in a
>special public accesible directory), on the *clients* end
                                              ^^^^^^^


CGI programs don't do anything on clients. They run on servers.

Clients are just I/O devices from the point of view of a CGI program.

What you want cannot be done. This is a good thing. A very good thing.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Wed, 02 May 2001 03:57:30 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: one-line stderr, stdout redirection
Message-Id: <x7k840e72b.fsf@home.sysarch.com>

>>>>> "BL" == Bart Lateur <bart.lateur@skynet.be> writes:

  BL> Rudolf Polzer wrote:
  >> Can you still use IO::Select when you have >30 open sockets? 

  BL> I'm not sure, but:

  >> select() does
  >> not work because the bit vector can only hold fileno()s in 0..31.

  BL> Heh? "perlfunc -f select" reveals a lot of text that explicitly and
  BL> consistently talks about vec(). This means that the bit vectors are
  BL> actually strings. You set/reset bits in the bytes of those strings. The
  BL> maximum length of the bitmask thus is virtually unlimited.

early versions of select(2) used a single integer for the bit vecotr
which limited it to 32 file descriptors. some later version of BSD
expanded it to a bit list (made of a byte array). it provided macros to
directly set/clear/test any bit (similar to vec) in that array. perl's
select maps directly to that call and the way to mung the bit vectors is
vec. the limit of the number of handles you can use is a kernel limit
(see ulimit) of the maximum open file descriptors you can have in a
process (typically 256 or 1k but it can be raised in various OS
dependent ways). select itself does not have any limits.

BTW, many unix kernels like solaris don't support select in the kernel,
instead they provide the SYS V poll(2) call. they provide a library
interface to convert select calls to poll. poll doesn't use a bit
vector, rather it uses an array of structures and is considered a much
better interface than select.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info:     http://www.sysarch.com/perl/OOP_class.html


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

Date: Tue, 1 May 2001 23:44:09 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: perl script for changing file names and extensions
Message-Id: <slrn9ev0k9.juh.tadmc@tadmc26.august.net>

js <web.foi@mbs.gov.on.ca> wrote:
>
>I have searched the net for a perl script to change the name and
>extension of a file with no luck.
>
>can anyone give me some pointers !


Yes. If you cannot find a Perl program to do what you want, then
write a Perl program that does what you want.

:-)


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 1 May 2001 22:50:59 GMT
From: nospam@hairball.cup.hp.com (Richard J. Rauenzahn)
Subject: Re: Question about float to hex
Message-Id: <988757459.310084@hpvablab.cup.hp.com>

toaster <toaster@nomail.org> writes:
>
>I have a question about casting floating point value
>to hex value.In C we can declare a union like:
>union{
>float a;
>unsign long b;
>} tmp;
>
>And print tmp.b by using:printf("%x",tmp.b); then
>we get the a hex value of this floating value in 
>IEEE 754 format. But in perl , I can't use the same
>way to get a hex IEEE754 value. I have tried to use
>the pack&unpack function, but it seems that the pack&
>unpack function can only handle int value. 
>And I have tried to use the ">>" operator, it failed,too.

How about this:

perl -e'print sprintf("0x%x", unpack("L", pack("f", 42.1234)))'

This assumes that your f and L datatypes on your machine are the same
length.  On my machine, both are 4 bytes, and gives the same results as
this C program:

#include <stdlib.h>
#include <stdio.h>

union { float a ; long b } tmp;

int main (int argc, char **argv)
{
   printf("%d==%d\n", sizeof(float), sizeof(long));
   tmp.a = 42.1234;
   printf("0x%x\n", tmp.b);
}

Rich
-- 
Rich Rauenzahn ----------+xrrauenza@cup.hp.comx+ Hewlett-Packard Company
Technical Consultant     | I speak for me,     |   19055 Pruneridge Ave. 
Development Alliances Lab|            *not* HP |                MS 46TU2
ESPD / E-Serv. Partner Division +--------------+---- Cupertino, CA 95014


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

Date: Wed, 02 May 2001 04:03:35 GMT
From: "Dodger" <dodger@necrosoft.net>
Subject: Re: Question about float to hex
Message-Id: <rGLH6.43603$B22.10575766@news1.rdc2.pa.home.com>

"Richard J. Rauenzahn" <nospam@hairball.cup.hp.com> wrote in message
news:988757459.310084@hpvablab.cup.hp.com...
> toaster <toaster@nomail.org> writes:
> perl -e'print sprintf("0x%x", unpack("L", pack("f", 42.1234)))'

Not bad, but I do have to ask: why are we saying print sprintf?



--
Dodger
www.dodger.org
www.necrosoft.net
www.gothic-classifieds.com





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

Date: Tue, 01 May 2001 21:07:55 -0500
From: "W.W.J.D. Black" <jdblack@black.metronet.com>
Subject: Re: Questions about sleep function
Message-Id: <010520012107553582%jdblack@black.metronet.com>


Hash: SHA1

In article <uRDH6.6212$R2.4601933@newsrump.sjc.telocity.net>, JohnB
<john@art-ave.com> wrote:

}This is a two parter:
}
}1.)  I'm trying to write a script that will output some content, pause and
}print some more. I've tried to use the sleep function, only that causes my
}script to sleep before the output reaches the browser (I've heard that's due
}to buffering). This means while the script is on the server sleeping, I
}still haven't received the first output of the script (before the sleep
}function).
}
}2.) I'd also like to have the script sleep, clear the browser of output
}before the script slept, and print new data.. and repeat it
}

This is not really a perl solution, but then I'm not real sure what you
are trying to do exactly. 
I am assuming (dangerous I know) that this script is loading a web page
(since you mention
browser).  How about trying the HTML refresh statement in the web page
you create.  You can control
   quite a bit with that little thingy.

jdb


Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBOu9r+Gy/lre8y0dpEQK8YQCfUmcDlHDcBJ4WnwK/68PIqE3BybsAniuM
VgzaUjLy2/yXSY4Pxz/jVe1M
=eJi0
-----END PGP SIGNATURE-----


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

Date: Wed, 2 May 2001 03:47:17 +0000 (UTC)
From: see-sig@from.invalid (David Efflandt)
Subject: Re: Questions about sleep function
Message-Id: <slrn9ev0q4.i3j.see-sig@typhoon.xnet.com>

On Tue, 1 May 2001 15:24:30 -0400, JohnB <john@art-ave.com> wrote:
> This is a two parter:
> 
> 1.)  I'm trying to write a script that will output some content, pause and
> print some more. I've tried to use the sleep function, only that causes my
> script to sleep before the output reaches the browser (I've heard that's due
> to buffering). This means while the script is on the server sleeping, I
> still haven't received the first output of the script (before the sleep
> function).

If you are not ending your output with a newline, you might try 
unbuffering your output by setting $| = 1;  But the server output might be 
buffered or it might be a browser that does not display anything until it 
gets the complete page, or at least enough to render it.

> 2.) I'd also like to have the script sleep, clear the browser of output
> before the script slept, and print new data.. and repeat it

Sounds like server push, which CGI.pm can do, but only works with the real
Netscape and Mozilla.  It does not work for any so called 'compatible'
user agents like MSIE.

Client pull works with most browsers, but then you would have to find some 
way to include any necessary data that you need to process in a query 
string of the URL in the meta refresh tag.

-- 
David Efflandt  (Reply-To is valid)  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/


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

Date: Wed, 02 May 2001 08:25:13 +0200
From: Mirek Rewak <cave@pertus.com.pl>
Subject: Re: R-E Perl Code
Message-Id: <ao9vets7qumgmoof4m0ed1dsn6a7dff5hg@4ax.com>

On Tue, 01 May 2001 07:47:41 GMT, in comp.lang.perl.misc you wrote:

>
>The source for perl is available at
>http://www.perl.com/pub/language/info/software.html#sourcecode.  No
>reverse engineering necessary!
>
>As far as reverse engineering Perl code, you may want to pick up a book
>on Perl.  Here's a site with good recommendations:
>http://www.perl.com/pub/language/critiques/index.html.
>

I'm afraid you didn't understood what I meant (maybe I said it not too
much clearly). I need a CASE tool that would translate Perl code
(Object oriented) into a specified diagram. Mostly it will be class
diagram with classes (Perl modules) and their methods and attributes.
This tool may be wriiten in Perl, but my knowledge of Perl isn't too
much. It should search in Perl module for (public and private)
methods, class variables and other OO stuff.

Pozdrowienia
Mirek Rewak
cave@pertus.com.pl


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

Date: 02 May 2001 06:58:19 GMT
From: dedsrd@aol.com (DEDSRD)
Subject: radio_group and params
Message-Id: <20010502025819.10183.00001001@ng-xc1.aol.com>

I have a working script that takes in a textfield param('lenght')
and param('width') It's a .cgi combo form.
(the length is more of a top to bottom - portrait=8.5" and landscape=11" )
Been trying to add radio buttons easier for the user 
I can make it look ok
'30 X 42',
    radio_group(-name=>'sheet_size',
                -values=>['1260','864'],
                -default=>'1260',
                -nolabels=>1),
                '24 X 36',
But getting the new param()'s is something else
Ideally the text 30 X 42, a button, it's value 1260 and it length 42, 
and the text 24 X 36, a button, it's value and it's lenght 24 
Unlike the code above text,button,text,button would be better
Does it take genious to add another radio button labeled "other"in the same
group with two text fields
I been looking at docs,Perl Prg Ref,Camel, CGI/PERL, AND Ram no luck! 
Darrell




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

Date: 1 May 2001 20:36:49 GMT
From: nospam@hairball.cup.hp.com (Richard J. Rauenzahn)
Subject: Re: Strange string -> num conversion
Message-Id: <988749408.728555@hpvablab.cup.hp.com>

eins@durchnull.de writes:
>I post it here again:
>
>#include <stdlib.h>
>#include <stdio.h>
>
>int main (int argc, char **argv)
>{
> printf ("%f\n", atof ("0x12"));
> printf ("%f\n", atof ("0x1.2"));
>}
>
>which should normally print
>
>0
>0
>
>but prints on my computer
>
>18.000000
>1.125000

My linux (RedHat 6.x) installation ...

$ ./a.out
1.12500
1.25000
$ ldd ./a.out
   libc.so.6 => /lib/libc.so.6 (0x4001a000)
   /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
$ rpm -qf /lib/libc.so.6
   glibc-2.1.1-6


-- 
Rich Rauenzahn ----------+xrrauenza@cup.hp.comx+ Hewlett-Packard Company
Technical Consultant     | I speak for me,     |   19055 Pruneridge Ave. 
Development Alliances Lab|            *not* HP |                MS 46TU2
ESPD / E-Serv. Partner Division +--------------+---- Cupertino, CA 95014


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

Date: Wed, 02 May 2001 03:00:18 GMT
From: "Dodger" <dodger@necrosoft.net>
Subject: Re: submission script help!
Message-Id: <6LKH6.43490$B22.10537262@news1.rdc2.pa.home.com>

"Kat" <iou4evr@excite.com> wrote in message
news:AIhD6.5989$q51.55924@news1.gvcl1.bc.home.com...
> I did find out that I am unable to use setuid on my works server.  Are
there
> any free web sites that can handle this kind of stuff?  I'm a little out
of
> touch with that kind of thing.
>
> Thank-you for your help.

Are you certain? Many webservers will run binaries setuid but won't run
scripts setuid.
If UNIX/Linux:

Here's the wrapper script... (C)

#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
main () {
  fflush (stdout);
  execl ("/usr/bin/perl", "/usr/bin/perl", "-w",
         "/home/you/cgi-bin/yourscript.pl", 0);}

call it wrapper.c, for instance, then do this:
cc -o yourscript.cgi wrapper.c

then do this:
chmod u+s wrapper.c

and see if it works or not.

BTW, you are very possibly right. For instance, Corel Linux won't do setuid.
I'm not sure of which others won't, but they really should be boycotted.

I don't know much of anything about NT.

--
Dodger
www.dodger.org
www.necrosoft.net
www.gothic-classifieds.com





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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 818
**************************************


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