[19797] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1992 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 23 18:05:42 2001

Date: Tue, 23 Oct 2001 15:05:12 -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: <1003874712-v10-i1992@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 23 Oct 2001     Volume: 10 Number: 1992

Today's topics:
    Re: CGI::Lite file upload corruption <<void@127.0.0.1>>
    Re: CGI::Lite file upload corruption <kristian.fischer@koehlershohn.de>
    Re: CGI::Lite file upload corruption <<void@127.0.0.1>>
    Re: CGI::Lite file upload corruption <kristian.fischer@koehlershohn.de>
        CPAN.pm complaining all the time <lmoran@wtsg.com>
    Re: Delete spaces at the end of a string <lmoran@wtsg.com>
        dynamic module (Lotto)
    Re: dynamic module <tsee@gmx.net>
    Re: dynamic module (Simon Hawketts)
    Re: dynamic module (Mark Jason Dominus)
        Embedded Perl Memory Cleanup (Colin Jennings)
        HELP  Net::SNMP set_request() method <tmciver@yottanetworks.com>
    Re: how can i make perl retreive a web page and save it <lmoran@wtsg.com>
    Re: how to gzip a file (web)? <nobody@nowhere.com>
    Re: how to gzip a file (web)? <tony_curtis32@yahoo.com>
    Re: Net::DNZ zone tranfer to file (Charles DeRykus)
    Re: Perl Vs. Java <anomie@my-deja.com>
    Re: Perl Vs. Java <darkon@one.net>
    Re: Perl Vs. Java <peterhi@shake.demon.co.uk>
        RegEx question parsing filename from a path (John Menke)
    Re: RegEx question parsing filename from a path <mbudash@sonic.net>
        SMTP AUTH info needed. <rs55862@nospamyahoo.com>
        text/html message <min_c_lee@yahoo.com>
        ualarm() emulation on win32 <tsee@gmx.net>
    Re: ualarm() emulation on win32 (Clinton A. Pierce)
    Re: ualarm() emulation on win32 <tsee@gmx.net>
    Re: ualarm() emulation on win32 (Clinton A. Pierce)
    Re: Webpage Passwords <brianf@maths.tcd.invalid.ie>
    Re: What the **** is WRONG with this!? (Jason Kohles)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 23 Oct 2001 18:20:13 GMT
From: "Josh" <<void@127.0.0.1>>
Subject: Re: CGI::Lite file upload corruption
Message-Id: <xxiB7.44062$1%.12043661@typhoon.nyroc.rr.com>

Okay, so if I hack Lite.pm like this, it works okay.  Is there anyway around
this with me not having to modify the CGI::Lite module (big portability
issue)?  If this is not a mistake in CGI::Lite, I'd definately consider it
an oversight.

Thanks,
Josh

***code snippet from CGI::Lite***
sub _store
{
    my ($self, $platform, $file, $convert, $handle, $eol, $field,
 $info, $seen) = @_;

    if ($file) {
 if ($convert) {
     $$info =~ s/\015\012/$eol/og  if ($platform ne 'PC');
     $$info =~ s/\015/$eol/og      if ($platform ne 'Mac');
     $$info =~ s/\012/$eol/og      if ($platform ne 'Unix');
 }

  binmode $handle; #I ADDED THIS
     print $handle $$info;

    } elsif ($field) {
 if ($seen->{$field} > 1) {
     $self->{web_data}->{$field}->[$seen->{$field}-1] .= $$info;
 } else {
     $self->{web_data}->{$field} .= $$info;
        }
    }
}
***end code***
"Kristian Fischer" <kristian.fischer@koehlershohn.de> wrote in message
news:3BD5AB91.FFB757C4@koehlershohn.de...
> Hallo
> "Josh <" wrote:
> >
> > I'm using CGI::Lite on ActiveState's Perl for ISAPI on MS IIS5.  What's
> > happening is that CGI::Lite is replacing all \n (Hex 0a) with \r\n (Hex
0d
> > 0a) in the uploaded binary files, which are MS Word or Excel files, and
that
> > corrupts them.  I was under the impression that CGI::Lite only performs
EOL
> > translation for mime types it has set, so I remove all mime types, as
both
> > clients and servers are all Windows machines, so EOL transaction
shouldn't
> > be necessary.
>
> It's not a mistake of the CGI::* moduls.
> You should read "perldoc -f binmode"
>
> Regards
>  Kristian




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

Date: Tue, 23 Oct 2001 21:07:12 +0200
From: Kristian Fischer <kristian.fischer@koehlershohn.de>
Subject: Re: CGI::Lite file upload corruption
Message-Id: <3BD5BFE0.25131037@koehlershohn.de>

Hallo Josh

"Josh <" wrote:
> 
> Okay, so if I hack Lite.pm like this, it works okay.  Is there anyway around
> this with me not having to modify the CGI::Lite module (big portability
> issue)?  If this is not a mistake in CGI::Lite, I'd definately consider it
> an oversight.

First, I'm not very familar with CGI::Lite. (normaly using CGI.pm
instead)
I think you can use  
my $fh = set_file_type('handle');
This will give you a reference to the filehandle of the uploaded file,
then do the "binmode($fh);" in your script.

Regards
 Kristian


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

Date: Tue, 23 Oct 2001 19:53:30 GMT
From: "Josh" <<void@127.0.0.1>>
Subject: Re: CGI::Lite file upload corruption
Message-Id: <_UjB7.44401$1%.12097833@typhoon.nyroc.rr.com>

Thanks, I was thinking about that.  My concern is if you get the filehandle
after the file has already been written to disk.  I'll play around with it
and see what happens.

Thanks again,
Josh


"Kristian Fischer" <kristian.fischer@koehlershohn.de> wrote in message
news:3BD5BFE0.25131037@koehlershohn.de...
> First, I'm not very familar with CGI::Lite. (normaly using CGI.pm
> instead)
> I think you can use
> my $fh = set_file_type('handle');
> This will give you a reference to the filehandle of the uploaded file,
> then do the "binmode($fh);" in your script.
>




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

Date: Tue, 23 Oct 2001 22:25:56 +0200
From: Kristian Fischer <kristian.fischer@koehlershohn.de>
Subject: Re: CGI::Lite file upload corruption
Message-Id: <3BD5D254.9200E7BB@koehlershohn.de>

Hallo Josh

"Josh <" wrote:
> 
> Thanks, I was thinking about that.  My concern is if you get the filehandle
> after the file has already been written to disk.  I'll play around with it
> and see what happens.

Uuups your right.
I'm looking at the Documentation from CGI::Lite at the moment and I
think I was wrong.
Using set_file_type('handle') in front of parse_form_data changes the
output from parse_form_data, nothing else.
Please excuse my stupid answer.

Regards
 Kristian


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

Date: Tue, 23 Oct 2001 17:05:29 -0400
From: Lou Moran <lmoran@wtsg.com>
Subject: CPAN.pm complaining all the time
Message-Id: <8hmbtt0pl6eg04hdg6d2hgooifr06nfmrn@4ax.com>

On a RH 6.2 machine whenever I run:

# perl -MCPAN -e 'install Some::Module'

CPAN complains that I don't have Net::FTP and could I install it
really soon and if I just install Bundle::libnet everything will be
fine, including Net::FTP.

Dutifully I have installed Bundle::libnet which CPAN admits I have
everytime I try to install it (again,) but it always complains about
Net::FTP but won't let me install Net::FTP!

Everything I ask of:

perl -MCPAN -e 'install Some::Module'

installs OK but it always wants me to hurry up and install Net::FTP.

What am I doing wrong and how can I fix it?


--
TMTOWTDI: My way tends to be wrong...
lmoran@wtsg.com


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

Date: Tue, 23 Oct 2001 16:38:17 -0400
From: Lou Moran <lmoran@wtsg.com>
Subject: Re: Delete spaces at the end of a string
Message-Id: <89lbttkhaf5g4so325gcufctj6c1e4p3s4@4ax.com>

On Tue, 23 Oct 2001 08:32:33 +0200, Philip Newton
<pne-news-20011023@newton.digitalspace.net> wrote wonderful things
about sparkplugs:

>Now please don't post TOFU any more :)

TOFU?

something about top posting?

--
TMTOWTDI: My way tends to be wrong...
lmoran@wtsg.com


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

Date: 23 Oct 2001 11:35:24 -0700
From: eplotto@cpm.com (Lotto)
Subject: dynamic module
Message-Id: <df044ab4.0110231035.55e9e3a3@posting.google.com>

Is there a way to "use" a module dynamically?  The sub I am writing (call it
sub X) is passed the name of another sub (sub Y) that it is to run.  Sub X
does not know what sub Y will be beforehand.  Sub Y is in a different file
(module) from sub X.  Sub Y will also be called many times (it is in a loop).
What would be the best way to go about this?

I tried using "Use," but since it does its magic during compile time I don't
think it is an option.  I've read that "use" should be used in place of
"require," does this mean that it also does its stuff at compile time?  I
also tried to read the code to be executed from the file into an "anonymous"
sub, but it complained about dynamic loading and IO.

Any ideas, or hints about where to look would be greatly appreciated.

Thanks much,
Lotto.
 .


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

Date: Tue, 23 Oct 2001 20:39:31 +0200
From: "Steffen Müller" <tsee@gmx.net>
Subject: Re: dynamic module
Message-Id: <9r4de0$n4$07$1@news.t-online.com>

"Lotto" <eplotto@cpm.com> schrieb im Newsbeitrag
news:df044ab4.0110231035.55e9e3a3@posting.google.com...
| Is there a way to "use" a module dynamically?  The sub I am writing (call
it
| sub X) is passed the name of another sub (sub Y) that it is to run.  Sub X
| does not know what sub Y will be beforehand.  Sub Y is in a different file
| (module) from sub X.  Sub Y will also be called many times (it is in a
loop).
| What would be the best way to go about this?
|
| I tried using "Use," but since it does its magic during compile time I
don't
| think it is an option.  I've read that "use" should be used in place of
| "require," does this mean that it also does its stuff at compile time?  I
| also tried to read the code to be executed from the file into an
"anonymous"
| sub, but it complained about dynamic loading and IO.

I use require for dynamic module loading. It works fine for me.

Steffen
--
$_=q;33352987319029872958319011313364356732192639127636833335345138283712
3712336415083973397340602842912;;s;\n;;;print"\n";$o=$_;push@o,substr($o,
$_*4,4)for(0..24);pop@o;for(@o){$i++;print' 'x(26-$i).(chr$_/29-$i)."\n"}





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

Date: Tue, 23 Oct 2001 19:02:08 GMT
From: simon@zombie.inka.de (Simon Hawketts)
Subject: Re: dynamic module
Message-Id: <slrn9tbfu0.5mt.simon@tuxtop.tuxnet>

Am D schrieb 
Lotto <eplotto@cpm.com> in comp.lang.perl.misc:

>Is there a way to "use" a module dynamically?  The sub I am writing (call it
>sub X) is passed the name of another sub (sub Y) that it is to run.  Sub X
>does not know what sub Y will be beforehand.  Sub Y is in a different file
>(module) from sub X.  Sub Y will also be called many times (it is in a loop).
>What would be the best way to go about this?
>
>I tried using "Use," but since it does its magic during compile time I don't
>think it is an option.  I've read that "use" should be used in place of
>"require," does this mean that it also does its stuff at compile time?  I
>also tried to read the code to be executed from the file into an "anonymous"
>sub, but it complained about dynamic loading and IO.
>
>Any ideas, or hints about where to look would be greatly appreciated.
>
>Thanks much,
>Lotto.
>.

I've written Object Oriented Perl which dynamically loads objects ( modules
) at run time by requiring the module in an eval block. I believe that Use is actually the
equivilent of require followed by import, so this works with Objects which
don't export subs. Don't know if you can do similar with ordinary modules
but perhaps you could objectify your code.

Cheers

Simon





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

Date: Tue, 23 Oct 2001 19:34:49 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: dynamic module
Message-Id: <3bd5c659.5e29$380@news.op.net>

In article <df044ab4.0110231035.55e9e3a3@posting.google.com>,
Lotto <eplotto@cpm.com> wrote:
>Is there a way to "use" a module dynamically?  The sub I am writing (call it
>sub X) is passed the name of another sub (sub Y) that it is to run.  Sub X
>does not know what sub Y will be beforehand.  Sub Y is in a different file
>(module) from sub X.  Sub Y will also be called many times (it is in a loop).
>What would be the best way to go about this?

sub X {
  my ($y) = @_;
  my $y_file = figure_out_where_this_is($y);
  require $y_file;
  &$y;  # call subroutine y
}

>I've read that "use" should be used in place of "require," 

Did you also read *why* 'use' whould be used in place of 'require'?
Does the reason apply to your present situation?

>does this mean that it also does its stuff at compile time?  

No; 'require' takes place at run time.

>I also tried to read the code to be executed from the file into an
>"anonymous" sub, but it complained about dynamic loading and IO.

Your program had a bug.  Perl programs do this every day.  If you had
shown the code you used, someone might have been able to suggest how
to fix it.

>Any ideas, or hints about where to look would be greatly appreciated.

I hope this is helpful.


-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: 23 Oct 2001 14:39:49 -0700
From: colin_jennings@intercept.com (Colin Jennings)
Subject: Embedded Perl Memory Cleanup
Message-Id: <f352b7b.0110231339.22e2870d@posting.google.com>

I have Perl embedded in a C application.  The memory that is used when
running a perl script is not cleaned up after the perl script has
finished executing.  The memory stacks up after scripts are run over
and over.  I've changed the perl destruct level and the memory still
does not get cleaned up.  The memory will get cleaned when I close my
C application, but that's not a solution.  Anybody have any experience
or similar results with embedding perl?  Or has anybody tried anything
that doesn't work so that I can continue to narrow this down.  Thanks.


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

Date: Tue, 23 Oct 2001 12:40:17 -0500
From: "Tony McIver" <tmciver@yottanetworks.com>
Subject: HELP  Net::SNMP set_request() method
Message-Id: <E1A2FA8C29D2FBA3.A6DAFFB59BAEE5E7.929C0E53DB194AD9@lp.airnews.net>

Could you send me a generic example of using a single set_request() method
to send multiple trio's of (OID,   ASN.1 type,  value). I know how to send a
single trio using the set_request() method but not how to send two or more
trio's in a single set_request() method.  I am confused as to how you would
do this.





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

Date: Tue, 23 Oct 2001 16:34:35 -0400
From: Lou Moran <lmoran@wtsg.com>
Subject: Re: how can i make perl retreive a web page and save it to my website?
Message-Id: <71lbttciae7e7rt0r24aeo4hlr852irddb@4ax.com>

On Fri, 19 Oct 2001 08:03:34 GMT, Bart Lateur <bart.lateur@skynet.be>
wrote wonderful things about sparkplugs:

>Lou Moran wrote:
>
>>#!/usr/bin/perl -w
>>use LWP::Simple;
>>getprint ("http://www.yahoo.com") ;
>
>getprint() will print it. get() will simply retrieve it. getstore() will
>save it as a file, which is what the OP asked for.
>
>	use LWP::Simple;
>	getstore($url, $file);
>
>It returns the HTTP status, which should be 200 in case of success.

This would explain all the useless .txt files strewn about my
harddrive :)

(to do -- read perldoc LWP::Simple)


--
TMTOWTDI: My way tends to be wrong...
lmoran@wtsg.com


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

Date: Wed, 24 Oct 2001 05:29:40 +1000
From: "Gregory Toomey" <nobody@nowhere.com>
Subject: Re: how to gzip a file (web)?
Message-Id: <9wjB7.854$c5.9538@newsfeeds.bigpond.com>

"Dave Naden" <danade@wnt.sas.com> wrote in message
news:RqjVO5J1eJIu84juqasaaeDQsEgG@4ax.com...
> Hi Perls,
>
> Does anyone have a simple example of reading a text file, compressing
> it into gzip format, and writing it back out?  Even better, anyone
> know how this is done in a CGI context?
>
> Thank you all!
>
> Dave Naden
> SAS Institute

Here is a fragment from a program for unzipping a file.  CGI should not make
any difference. If you are more specific you can get a more specific answer.

gtoomey

foreach my $filename (glob('data/1998*.zip')) {
        foreach my $day (1..31) {
                my
$dayname=sprintf("%6.6s%02d.TXT",basename($filename),$day);
                open(INFILE, "unzip -apC $filename $dayname | ");
                while (<INFILE>) {
                 #read each line in the unzipped file







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

Date: Tue, 23 Oct 2001 14:53:07 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: how to gzip a file (web)?
Message-Id: <87n12i16cc.fsf@limey.hpcc.uh.edu>

>> On Tue, 23 Oct 2001 13:28:00 -0400,
>> Dave Naden <danade@wnt.sas.com> said:

> Hi Perls, Does anyone have a simple example of reading a
> text file, compressing it into gzip format, and writing
> it back out?  Even better, anyone know how this is done

  http://search.cpan.org/doc/PMQS/Compress-Zlib-1.14/Zlib.pm

> in a CGI context?

A perl program is a perl program.  As long as the program
has permission to read/write the file, it's the same.

hth
t
-- 
Oh!  I've said too much.  Smithers, use the amnesia ray.


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

Date: Tue, 23 Oct 2001 19:30:31 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Net::DNZ zone tranfer to file
Message-Id: <GLoBIv.MyD@news.boeing.com>

In article <bc06032.0110222021.68bfb0b1@posting.google.com>,
Eric Clope <cell_x@hotmail.com> wrote:
>Good evening,
>
>I would like to create a simple program that dumps a succesful zone
>transfer to a file.  I can get the command like dump on my shell but I
>would like it to go to a file. I do not want to use "dig @ axfr >
>file"... just good net::dns.
>
># basic frame i think
>use Net::DNS;
>$res = new Net::DNS::Resolver;
>$res->nameservers("ns.foo.com");
>@zone = $res->axfr("foo.com");
>  foreach $rr (@zone) {
>      $rr->print;
>  }
>
>I tried the following within the above script but I either get 111 or
>hash code dumps in my file.
>open (DOMAIN, "+>zone dump");
>print $rr-print;
>close (DOMAIN);

open (DOMAIN, "+<zone dump")   # See perldoc -f open re: +< vs. +> 
  or die $!;                   # check for success of open
{ 
  local *STDOUT = *DOMAIN{IO}; # perldoc -f local and perldoc perlref
  foreach my $rr (@zone) {
     $rr->print;
  }
}

--
Charles DeRykus


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

Date: Tue, 23 Oct 2001 12:02:28 -0700
From: "Jordan Reed" <anomie@my-deja.com>
Subject: Re: Perl Vs. Java
Message-Id: <3bd5be3b@monitor.lanset.com>

Actually, jakarta (http://jakarta.apache.org) has some pretty neat RegEx
stuff for Java based entirely on Perl syntax.  It's kind of fun creating
java classes called Perl5Pattern and the like.  Unfortunately, due to the
way Java's String object works, there are some pretty nasty performance
issues with it.

Luckily, Java 1.4 (still in beta) has built-in RegEx.  Looks like the folks
at Sun finally realized their text processes capabilities were pretty
limited.

Still, as nice as the features are, there's just a lot of overhead with them
compared to Perls text processing.  The right tool for the right job...

-jdr

"Rafael Garcia-Suarez" <rgarciasuarez@free.fr> wrote in message
news:slrn9ta3jq.4ia.rgarciasuarez@rafael.kazibao.net...
> Krishna Kumar wrote in comp.lang.perl.misc:
> > Folks at my work are talking about using Java as a standard instead of
Perl.
> >
> > I have no knowledge of Java to agree or disagree with this.
> >
> > They are trying to convince me that Java can do everything that Perl
can.
>
> Well, those languages are both Turing-complete.
> The question is : what language is good for which use ?
> Perl is much better at text processing (Java has no support for regexps
> and very poor string handling primitives) and system-programming.
> In fact it's very difficult to handle system calls within Java, because
> Java aims to be portable and hence does not provide basic system calls
> such as fork, chown or stat, to name a few.
>
> --
> Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
> perl -sleprint -- -_='Just another Perl hacker,'




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

Date: Tue, 23 Oct 2001 20:39:37 -0000
From: David Wall <darkon@one.net>
Subject: Re: Perl Vs. Java
Message-Id: <Xns9143A96305525darkononenet@207.126.101.97>

"Krishna Kumar" <krishna.kumar@rhii.com> wrote on 22 Oct 2001:

> Can someone help me with this please? Or point me to a website which
> brings out the differences between Java and Perl?

No-one seems to have mentioned this yet, so....

http://www.perl.com/pub/a/language/versus/java.html

(I don't have an informed opinion, so I'll bow out of this thread.)
(My *uninformed* opinion is that Java looks painful. :-)

-- 
David Wall
darkon@one.net


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

Date: Tue, 23 Oct 2001 21:41:41 +0100
From: "Peter Hickman" <peterhi@shake.demon.co.uk>
Subject: Re: Perl Vs. Java
Message-Id: <1003869767.16448.0.nnrp-01.9e980a61@news.demon.co.uk>

"Krishna Kumar" <krishna.kumar@rhii.com> wrote in message
news:u4VsWT0WBHA.169@hqp_news_nt1.corp.rhalf.com...
> No I think the assumption is Java is easier to learn than Perl.

I would dispute that vigorously. I can program Java, Perl, C, Fortran, COBOL
and
many more but Java is harder to learn and slower to develop in than Perl.
Why do you
think Perl programmers are paid less than Java programmers - because it is
easier
to turn someone into a productive programmer in Perl than in Java.





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

Date: 23 Oct 2001 13:59:22 -0700
From: jmenke@scsnet.csc.com (John Menke)
Subject: RegEx question parsing filename from a path
Message-Id: <3a2d73ac.0110231259.3a68e254@posting.google.com>

I need to extract the filename from a path statement

I will have something like this: 
"C:\ORACLE\ORADATA\DBNAME\TEMP01.DBF" in a variable named $filepath

how do I get just the TEMP01.DBF into a variable?

thanks,

john


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

Date: Tue, 23 Oct 2001 21:41:28 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: RegEx question parsing filename from a path
Message-Id: <mbudash-24AD02.14413123102001@news.sonic.net>

In article <3a2d73ac.0110231259.3a68e254@posting.google.com>, 
jmenke@scsnet.csc.com (John Menke) wrote:

> I need to extract the filename from a path statement
> 
> I will have something like this: 
> "C:\ORACLE\ORADATA\DBNAME\TEMP01.DBF" in a variable named $filepath
> 
> how do I get just the TEMP01.DBF into a variable?
> 
> thanks,
> 
> john

one way:

($filename) = $filepath =~ /^.+\\(.+)$/;

hth-
-- 
Michael Budash ~~~~~~~~~~ mbudash@sonic.net


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

Date: Wed, 24 Oct 2001 00:27:13 +0300
From: "Rami Saarinen" <rs55862@nospamyahoo.com>
Subject: SMTP AUTH info needed.
Message-Id: <9r4lo9$sqa$1@news.kolumbus.fi>

Hello,

I need to send some emails using a perl and smtp server that requires 
authentication. I tried to look around, but it seems that either the auth
extension  does not exist in perl or it is not documented.  I'd greatly
appreciate any pointers to scripts,  modules, whatever..  

Thanks in advance and sorry for the dumb question.

-- 
Rami Saarinen

if you want to contact me personally, please do remove the 
obvious bit from my email address.


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

Date: Tue, 23 Oct 2001 21:34:54 GMT
From: "Michael" <min_c_lee@yahoo.com>
Subject: text/html message
Message-Id: <2olB7.2384$Le.60376@sea-read.news.verio.net>

with MIMI:Lite, how do I write up a multi-part message
which is readable for both text-only and html-ready
email software, so the right format can pop up by itself?

Michael




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

Date: Tue, 23 Oct 2001 20:46:03 +0200
From: "Steffen Müller" <tsee@gmx.net>
Subject: ualarm() emulation on win32
Message-Id: <9r4dra$17d$00$1@news.t-online.com>

Hi,

for a project I'm currently working on, I need something similar to ualarm()
(from Time::HiRes). ualarm() works fine on Unix, but unfortunately, it isn't
portable to win32 which it needs to be for the application.

Can anybody give me a clue about how to implement or emulate such a
function?

The project is supposed to execute some untrusted code (no CGI, don't worry)
that might include endless loops and the like. I would like to implement
some timeout via ualarm to break those loops when necessary.

Thanks in advance for any help,

Steffen
--
$_=q;33352987319029872958319011313364356732192639127636833335345138283712
3712336415083973397340602842912;;s;\n;;;print"\n";$o=$_;push@o,substr($o,
$_*4,4)for(0..24);pop@o;for(@o){$i++;print' 'x(26-$i).(chr$_/29-$i)."\n"}





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

Date: Tue, 23 Oct 2001 20:06:29 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: ualarm() emulation on win32
Message-Id: <95kB7.196961$K6.94491014@news2>

[Posted and mailed]

In article <9r4dra$17d$00$1@news.t-online.com>,
	"Steffen Müller" <tsee@gmx.net> writes:
> Hi,
> 
> for a project I'm currently working on, I need something similar to ualarm()
> (from Time::HiRes). ualarm() works fine on Unix, but unfortunately, it isn't
> portable to win32 which it needs to be for the application.
> 
> Can anybody give me a clue about how to implement or emulate such a
> function?
> 
> The project is supposed to execute some untrusted code (no CGI, don't worry)
> that might include endless loops and the like. I would like to implement
> some timeout via ualarm to break those loops when necessary.

If you don't have to interrupt a system call or anything, use Timer::HiRes
inside the loop to check for too much time being used.

	Note the time
	While(condition) 
		if current time >= start time + alloted usecs, last
		do actual work here



-- 
    Clinton A. Pierce            Teach Yourself Perl in 24 Hours  *and*
  clintp@geeksalad.org                Perl Developer's Dictionary
"If you rush a Miracle Man,     for details, see http://geeksalad.org     
	you get rotten Miracles." --Miracle Max, The Princess Bride


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

Date: Tue, 23 Oct 2001 23:11:27 +0200
From: "Steffen Müller" <tsee@gmx.net>
Subject: Re: ualarm() emulation on win32
Message-Id: <9r4mau$g5s$00$1@news.t-online.com>

"Clinton A. Pierce" <clintp@geeksalad.org> schrieb im Newsbeitrag
news:95kB7.196961$K6.94491014@news2...

[snip]

| > The project is supposed to execute some untrusted code (no CGI, don't
worry)
| > that might include endless loops and the like. I would like to implement
| > some timeout via ualarm to break those loops when necessary.
|
| If you don't have to interrupt a system call or anything, use Timer::HiRes
| inside the loop to check for too much time being used.
|
| Note the time
| While(condition)
| if current time >= start time + alloted usecs, last
| do actual work here

Err, Time::HiRes, but other than that, I believe one of us is
misunderstanding the other. Maybe I haven't made myself clear enough.

In more detail: The program uses require to load a package (class) at
run-time (yeah, I know about use ;). The package cannot be edited. I would
do something like this if ualarm was availlable:

# pseudo code
$SIG{ALRM} = sub { slay($current) };

while ($current = each %objects) {
    ualarm( 500 );
    eval { $action = $current->act(); } or slay($current);
}

Thank you for your response,

Steffen
--
$_=q;33352987319029872958319011313364356732192639127636833335345138283712
3712336415083973397340602842912;;s;\n;;;print"\n";$o=$_;push@o,substr($o,
$_*4,4)for(0..24);pop@o;for(@o){$i++;print' 'x(26-$i).(chr$_/29-$i)."\n"}





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

Date: Tue, 23 Oct 2001 21:34:35 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: ualarm() emulation on win32
Message-Id: <LnlB7.197106$K6.94594654@news2>

[Posted and mailed]

In article <9r4mau$g5s$00$1@news.t-online.com>,
	"Steffen Müller" <tsee@gmx.net> writes:
>| > The project is supposed to execute some untrusted code (no CGI, don't
> worry)
>| > that might include endless loops and the like. I would like to implement
>| > some timeout via ualarm to break those loops when necessary.
> 
> Err, Time::HiRes, but other than that, I believe one of us is
> misunderstanding the other. Maybe I haven't made myself clear enough.
> 
> In more detail: The program uses require to load a package (class) at
> run-time (yeah, I know about use ;). The package cannot be edited. I would
> do something like this if ualarm was availlable:
> 
> # pseudo code
> $SIG{ALRM} = sub { slay($current) };
> 
> while ($current = each %objects) {
>     ualarm( 500 );
>     eval { $action = $current->act(); } or slay($current);
> }

I misunderstood you.  When you said you wanted to break a loop (which might
be endless) I thought a polling solution might work.

You just want to be able to wrap an arbitrary piece of code with an 
alarm/eval block with microsecond precision (that happens to be in a 
loop).  This has little if anything  to do with loops at all.  In fact,
you're not even "breaking" the loop shown above.  :)

Good luck at finding a signaling mechanism in Win32.

-- 
    Clinton A. Pierce            Teach Yourself Perl in 24 Hours  *and*
  clintp@geeksalad.org                Perl Developer's Dictionary
"If you rush a Miracle Man,     for details, see http://geeksalad.org     
	you get rotten Miracles." --Miracle Max, The Princess Bride


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

Date: 23 Oct 2001 20:29:09 +0100
From: Brian Foley <brianf@maths.tcd.invalid.ie>
Subject: Re: Webpage Passwords
Message-Id: <9r4ge5$25ss$1@salmon.maths.tcd.ie>

* Scott Bell <news@scottbell.org> on Tue, 23 Oct 2001 14:28:21 +0100 wrote:
> I don't understand why people are saying this has nothing to do with
> perl, the webpage is a CGI script written in the perl language.

You can do something similar to what you want in perl, but I dont know
how you would go about manipulating headers.  Have a two field web
form with username and password.  Store encrypted passwords on your
server in a hash associated with their respective usernames.  Then
read up about the crypt() function in perl.  You should of course put
the password protection at the top of all subsequent cgi pages in case
people figure out how to skip around the login page.

Use for example:
unless($passwords{'joe'} eq (crypt($FORM{'guesspass'}, $passwords{'joe'})))
exit; (or go back to form page)

Something like:
my $salt = join '', ('.', '/', 0..9, 'A'..'Z', 'a'..'z')[rand 64, rand 64];
$pass = crypt($pass, $salt);

would generate pseudo random passwords, where $pass has been given a
value by (for example) the pwgen program, or similar.

But dont trust me, Im just a random bloke on a newsgroup.

Brian.


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

Date: 23 Oct 2001 21:07:05 GMT
From: usenet@jasonkohles.com (Jason Kohles)
Subject: Re: What the **** is WRONG with this!?
Message-Id: <slrn9tbms2.7i3.usenet@poseidon.mediabang.com>

On Tue, 23 Oct 2001 15:22:14 GMT, Graham W. Boyes wrote:
>Jason Kohles, you are hereby charged with writing the following:
>
>> 'mkd' is a dos command, you may have an alias that maps 'mkd' to
>> 'mkdir', but those aliases are not accessible when you use system().  I
>> think you meant 'mkdir'.
>
>Really?  I would have sworn my FTP program used mkd when it wanted to make a 
>directory.  I figured I could use a system command to do the same thing.
>
But you aren't talking to an ftp server, you are talking to a shell, otherwise
it would have worked.

-- 
Jason S Kohles
email@jasonkohles.com          http://www.jasonkohles.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 1992
***************************************


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