[18954] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1149 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jun 17 21:05:26 2001

Date: Sun, 17 Jun 2001 18: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: <992826308-v10-i1149@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 17 Jun 2001     Volume: 10 Number: 1149

Today's topics:
    Re: 2 questions about flock (Abigail)
    Re: hash array <goldbb2@earthlink.net>
    Re: help with regexp? <goldbb2@earthlink.net>
        I can't belive I'm asking this here... <kimmfc@mydeja.com>
        ISO advice on open source Perl browsers <kj0@mailcity.com>
        Mix JS variables with Perl (BUCK NAKED1)
    Re: Mix JS variables with Perl (BUCK NAKED1)
    Re: Mix JS variables with Perl <tony_curtis32@yahoo.com>
    Re: Mix JS variables with Perl (BUCK NAKED1)
        MultiPOP: leave messages larger than X on the server <bernie@fantasyfarm.com>
    Re: MultiPOP: leave messages larger than X on the serve <bwalton@rochester.rr.com>
        Perl2Exe Decompiler? <marc@hvc.rr.com>
    Re: Perl2Exe Decompiler? <kevin@vaildc.net>
    Re: Perl2Exe Decompiler? <marc@hvc.rr.com>
    Re: Perl2Exe Decompiler? <kevin@vaildc.net>
    Re: Problems with DB_File <bwalton@rochester.rr.com>
    Re: Protecting CGI-BIN Directory (Jon Bell)
    Re: Protecting CGI-BIN Directory <michael@NOSPAM.vilain.com>
    Re: Protecting CGI-BIN Directory <flavell@mail.cern.ch>
    Re: Protecting CGI-BIN Directory (Si Ballenger)
    Re: Removing ^M characters <ozette@ozette.net>
    Re: Rounding down a float <temp1@williamc.com>
    Re: sorting a list of files from a directory <goldbb2@earthlink.net>
    Re: Sorting hash <ed@krypton.mikroneuvos.fi>
    Re: too late error? <iltzu@sci.invalid>
        using lwp ?? <sjaaknabuurs@hetnet.nl>
    Re: What modules are being used? <goldbb2@earthlink.net>
    Re: windows 2000 <buggs-clpm@splashground.de>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 17 Jun 2001 18:16:12 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: 2 questions about flock
Message-Id: <slrn9ipsvc.dvi.abigail@tsathoggua.rlyeh.net>

fwaryhrjnm (sljhglj@lksdlg.fd) wrote on MMDCCCXLIII September MCMXCIII in
<URL:news:3b26f7d8@news2.mibx.net>:
;;  
;;  abigail@foad.org (Abigail) wrote:
;;  
;; >
;; >    7358: Fri Jun  8 22:51:04 2001: Start
;; >    7359: Fri Jun  8 22:51:04 2001: Start
;; >    7359: Fri Jun  8 22:51:05 2001: Asking for shared lock. 
;; >    7359: Fri Jun  8 22:51:05 2001: Got the shared lock. 
;;                                   59-LOCK_SH / 58-No Lock
;; >    7358: Fri Jun  8 22:51:05 2001: Asking for shared lock. 
;; >    7358: Fri Jun  8 22:51:05 2001: Got the shared lock. 
;;                                   59-LOCK_SH / 58-LOCK_SH
;; >    7359: Fri Jun  8 22:51:10 2001: Upgrading lock to exclusive lock.
;; >    7358: Fri Jun  8 22:51:10 2001: Upgrading lock to exclusive lock.
;; >    7359: Fri Jun  8 22:51:10 2001: Got the exclusive lock. 
;;                            >>     59-LOCK_EX / 58-LOCK_SH  <<
;; >    7359: Fri Jun  8 22:51:15 2001: Exiting, releasing locks. 
;;                                   59-LOCK_UN / 58-LOCK_SH
;; >    7358: Fri Jun  8 22:51:15 2001: Got the exclusive lock.
;;                                   59-No Lock / 58-LOCK_EX
;; >    7358: Fri Jun  8 22:51:20 2001: Exiting, releasing locks.
;;                                   59-No Lock / 58-LOCK_UN
;; >
;; >No deadlock.
;;  
;;  (see notes above, please correct if incorrect)
;;  
;;  Interesting, I though an exclusive lock blocked until there were no
;;  locks on the file (no LOCK_SH or LOCK_EX).  However the above suggests
;;  that the exclusive lock was granted while there was an existing shared 
;;  lock.

No, the lock was granted while the other process requested another lock -
and then the first lock will be dropped.

Suppose this wasn't the case - then you couldn't upgrade your own shared
lock to an exclusive one (unless you explicitely dropped the lock yourself),
after all, you are the one holding a shared lock, so the kernel won't grant
you an exclusive one.

;;         This has the same effect as being granted a shared lock on a file
;;  that has an exclusive lock.  Wouldn't this be an error condition.
;;  What code was used to produce the above, I don't have any posts before
;;  this one yet.


Eh, the code producing the output above was in the same post...




Abigail
-- 
$_ = "\nrekcaH lreP rehtona tsuJ"; my $chop; $chop = sub {print chop; $chop};
$chop -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()
-> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()


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

Date: Sun, 17 Jun 2001 17:43:59 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: hash array
Message-Id: <3B2D249F.24283429@earthlink.net>

Ren Maddox wrote:
> 
> On Sat, 26 May 2001, gisle@ActiveState.com wrote:
> 
> > mjd@plover.com (Mark Jason Dominus) writes:
> >
> >> In article <ndAP6.70962$I5.15872424@news1.rdc1.tn.home.com>,
> >> Todd Smith <todd@designsouth.net> wrote:
> >> >How do you ask a hash how big it used to be?
> >>
> >> Devel::Peek, perhaps.
> >
> > You can also get that number with code like this:
> >
> >   $size = do { local $hash{x} = 1; (split "/", %hash)[1] };
> 
> This has the side effect of leaving "x" around as a key in %hash.  The
> value is gone, because of the local, but the key is still there.

That sounds like a bug.

[benjamin@plant ~]$ perl -e 'sub x{local$_[0]=1}x$x{foo};print%x,"\n"'

[benjamin@plant ~]$ perl -e '{local $x{foo}=1}print%x,"\n"'
foo

I've use perlbug to create an error report.

> Actually, something strange seems to happen as a result of that
> "local".  The key survives the block even if it is explicitly deleted
> within the block.  I assume the "restore the old value" aspect of
> "local" is (re-)creating the key upon exit of the block.
> 
> #!/usr/bin/perl
> use strict;
> use warnings;
> my %hash;
> { local $hash{x} = 1; delete $hash{x} };
> print "After localized delete: ", keys %hash, "\n";
> { $hash{x} = 1; delete $hash{x} };
> print "After non-localized delete: ", keys %hash, "\n";
> __END__
> 
> --
> Ren Maddox
> ren@tivoli.com

-- 
The longer a man is wrong, the surer he is that he's right.


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

Date: Sun, 17 Jun 2001 19:29:28 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: help with regexp?
Message-Id: <3B2D3D58.8285B208@earthlink.net>

oza wrote:
> 
> This question suits to webserver newsgroups too, but I know there are
> lots of regexp guys here. so here is my question:
> 
> I will use Apaches rewrite module to translate the url in first line
> to the one in second line below:
> 
> www.mysite.com/top/scriptname/modename/idnum
> www.mysite.com/scriptname.php?mode=modename&id=idnum
> 
> Every url like the first one will be translated to second one in my
> website. Since almost all of the pages will be like this, performance
> of the regexp I use is important.
> 
> I consider these:
> /top/([^/]*)/([^/]*)/(.*)  /$1.php?mode=$2&id=$3 [L,R]
> 
> or
> /top/(.*)/(.*)/(.*)        /$1.php?mode=$2&id=$3 [L,R]
> 
> which one of these will perform better? Or will them work at all? Or
> do you recommend another one?

Assuming which *all* strings which contain /top/ are urls on your site,
and they are all well-formed, then yes, the first will work ok.  The
second may not work right if two urls are on one line, eg:
	<A href=/top/foo/a/b><IMG src=/top/bar/c/d></A>
The second would end make this into:
	<A href=/foo.php?mode=a/b><IMG src=/top/bar/c/&id=d></A>
When what you would really want here is:
	<A href=/foo.php?mode=a&id=b><IMG src=/bar.php&mode=c&id=d></A>

However, I should note that even the first one given can have problems,
due to the (.*) on the end.  The example two-url line above would
produce:
	<A href=/foo.php?mode=a&id=b><IMG src=/top/bar/c/d></A>
Since the (.*) would match all the way to the end of the line on the
first match.  What I would suggest is:

	s[/top/([^/"'\s]*)/([^/"'\s]*)/]
	 [/$1.php?mode=$2&id=]g;

This doesn't bother trying to capture the id; it simply replaces the "/"
which precedes it with "&id=".  Also, it excludes whitespace and quotes
from the scriptname and mode, in addition to excluding slashes.

> Since I am on a virtual server, I want to make sure they will work
> before asking host admin to put these to httpd.conf.

I don't see why you *want* to rewrite the urls like this, though.  It is
entirely possible to use a cgi with a url like the following:
	http://host/path/foo.cgi/param/param

The path_info function/method of CGI.pm will return the string
"/param/param", as will $ENV{PATH_INFO}.  This is, IMHO, a superior way
of giving static arguments to a CGI (by static, I mean part of the fixed
content of a page, not generated by a <form> tag).

-- 
The longer a man is wrong, the surer he is that he's right.


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

Date: Sun, 17 Jun 2001 23:14:55 GMT
From: Kim C <kimmfc@mydeja.com>
Subject: I can't belive I'm asking this here...
Message-Id: <i1eqit8b9gbr9kckn9985i5hs9187l3135@4ax.com>

Hello,

I have an embarrassingly simple question to ask:  How does one copy an
entire directory (with sub directories if necessary)?

the File::Copy man pages mention File::Copydir but this does not work
on my system (win2000 / ActivePerl 5.6).  I saw nothing in the FAQ
(Win32 or otherwise) and I didn't find anything in the File::Tools,
Win32::API or File::Spec::Win32 modules either.

Anyone?

Kim.


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

Date: 17 Jun 2001 18:15:54 -0400
From: kj0 <kj0@mailcity.com>
Subject: ISO advice on open source Perl browsers
Message-Id: <9gja6q$g13$1@panix3.panix.com>




I'm looking for recommendations for (preferably free) open source Perl
WWW browsers.  I'm looking for a browser that I can modify easily, so
it is important that it has a clear design and it is well documented.

The functionality I have in mind is to expand the "Save page" choices
to include filtering programs.  The idea is that instead of saving a
page as text or source, the user may be able to feed the contents of
the page to a program that will process the data in a particular way
before saving it to disk.  The aim is to combine ease of web-browsing
with a more powerful and flexible way to archive the information one
hits upon.

If a browser with such a capability already exists, or if you know of
a better way to do this than by hacking a browser, please let me know.

Thank you!

KJ



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

Date: Sun, 17 Jun 2001 14:00:35 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Mix JS variables with Perl
Message-Id: <28662-3B2CFE53-426@storefull-241.iap.bryant.webtv.net>

Is there a way to mix JS codes, such as functions and variables with
Perl?

I prefer to use Javascript's document.referrer instead of perl's
$ENV{HTTP_REFERER}.

Here's what I'm trying to do. I'm trying to set Javascript's
"document.referrer" with Perl in a cookie called "drf" and retrieve it.
I've been studying CGI.pm; and here's what I've tried.

To SET the Cookie:
$ref = "<script>document.write(document.referrer)</script>";

use CGI;
$query = new CGI;
$cookie = $query->cookie(-name=>'drf', -value=>'$ref',
-expires=>'+30s');

Now, if the above is correct, how do I RETRIEVE the Cookie value with
the document.referrer interpreted?

Thanks,
--Dennis
 



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

Date: Sun, 17 Jun 2001 14:24:46 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Mix JS variables with Perl
Message-Id: <28662-3B2D03FE-427@storefull-241.iap.bryant.webtv.net>

Sorry about the re-post, but I wanted to let you know where I'm at with
this. The below coding works, but returns $ref. How do I get $ref
interpreted? Instead of $ref, it should return a URL.

$ref = '<script>document.write(dc)</script>';
$query = new CGI;
$cookie = $query->cookie(-name=>'drf', -value=>'$ref', expires=>'+30s');
print $value = $cookie->value(['$ref']); 

Thanks,
--Dennis



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

Date: 17 Jun 2001 14:48:39 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Mix JS variables with Perl
Message-Id: <87sngy6g6g.fsf@limey.hpcc.uh.edu>

>> On Sun, 17 Jun 2001 14:24:46 -0500 (CDT),
>> dennis100@webtv.net (BUCK NAKED1) said:

> Sorry about the re-post, but I wanted to let you know
> where I'm at with this. The below coding works, but
> returns $ref. How do I get $ref interpreted? Instead of
> $ref, it should return a URL.

> $ref = '<script>document.write(dc)</script>'; $query =
> new CGI; $cookie = $query->cookie(-name=>'drf',
> -value=>'$ref', expires=>'+30s'); print $value =
> $cookie->value(['$ref']);

Single quotes prevent variable interpolation.  Lose the
quotes around $ref.  If you need to interpolate a variable
into a string, use double-quotes (or possibly "." to
concatenate variables and literals, or possibly sprintf()
depending on what you're trying to do).

hth
t
-- 
Just reach into these holes.  I use a carrot.


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

Date: Sun, 17 Jun 2001 19:00:59 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Mix JS variables with Perl
Message-Id: <28662-3B2D44BB-471@storefull-241.iap.bryant.webtv.net>

 
Re: Mix JS variables with Perl   
 
tony_curtis32@yahoo.com (Tony=A0Curtis) 

> dennis100@webtv.net (BUCK NAKED1) said: 

Sorry about the re-post, but I wanted to let you know where I'm at with
this. The below coding works, but returns $ref. How do I get $ref
interpreted? Instead of $ref, it should return a URL. 

$ref =3D '<script>document.write(document.referrer)</script>'; $query =3D
new CGI; $cookie =3D $query->cookie(-name=3D>'drf', -value=3D>'$ref',
expires=3D>'+30s'); print $value =3D $cookie->value(['$ref']); 

Single quotes prevent variable interpolation. Lose the quotes around
$ref. If you need to interpolate a variable into a string, use
double-quotes (or possibly "." to concatenate variables and literals, or
possibly sprintf() depending on what you're trying to do). 
hth
t 

I had already tried sprintf, double quotes, etc. and that didn't work
either. Can you see any other reason why $ref is not interpolating?
 
Note: I replaced (dc) above with document.referrer above. The code I've
been testing has document.referrer in that spot. 

Thanks,
--Dennis  



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

Date: Sun, 17 Jun 2001 17:47:21 -0400
From: Bernie Cosell <bernie@fantasyfarm.com>
Subject: MultiPOP: leave messages larger than X on the server
Message-Id: <369qitkkl0fjp8vr2vdpu9chb4e1cmvim8@news.supernews.net>

Is there some trick to getting the 'leave messages larger than X on the
server' to work with MultiPOP?  I go into the multipop config, click 'edit'
on the connection and there's a box for "Leave messages larger than <> Kb
in size", BUT: I put a number in there, click 'OK' and when I 'edit' that
POP connection again the value has gone back to 0.   This all with 3.12c on
Win98.  thanks!  /Bernie\
-- 
Bernie Cosell                     Fantasy Farm Fibers
bernie@fantasyfarm.com            Pearisburg, VA
    -->  Too many people, too few sheep  <--          


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

Date: Sun, 17 Jun 2001 21:58:41 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: MultiPOP: leave messages larger than X on the server
Message-Id: <3B2D23B5.D4086001@rochester.rr.com>

Bernie Cosell wrote:
> 
> Is there some trick to getting the 'leave messages larger than X on the
> server' to work with MultiPOP?  I go into the multipop config, click 'edit'
> on the connection and there's a box for "Leave messages larger than <> Kb
> in size", BUT: I put a number in there, click 'OK' and when I 'edit' that
> POP connection again the value has gone back to 0.   This all with 3.12c on
> Win98.  thanks!  /Bernie\
 ...
> Bernie Cosell                     Fantasy Farm Fibers
 ...
I think you picked the wrong newsgroup.  This one deals with Perl.
-- 
Bob Walton


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

Date: Sun, 17 Jun 2001 23:10:23 GMT
From: "Marc" <marc@hvc.rr.com>
Subject: Perl2Exe Decompiler?
Message-Id: <zNaX6.216807$f85.32779643@typhoon.nyroc.rr.com>

I am wondering if anyone knows of a decompiler that will convert Perl .exe's
back to their native scripts.

These .exe's were created by me with Perl2Exe (similar to PerlApp by
Activestate) and I need to edit them.  The only problem is my Perl Scripts
were on a different drive that suffered a major crash, rendering most of the
data irrecoverable.  Therefore I need to decompile the exe's.

I found references to a decompiler designed specifically for executables
converted by Perl2Exe.  This decompiler is called "UnPerl", was written by
"Spot //UCL", and has a file name of "UCL!UPRL.RAR."  I can't find this
program ANYWHERE on the Net and trust me I searched every possible search
engine with every possible search term.  I even tried emailing various
people that had connections with this program, such as the author.  All
ended in dead ends.

Any help would be greatly appreciated!

Thanks,

Marc




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

Date: Sun, 17 Jun 2001 19:58:51 -0400
From: Kevin Michael Vail <kevin@vaildc.net>
Subject: Re: Perl2Exe Decompiler?
Message-Id: <170620011958511367%kevin@vaildc.net>

In article <zNaX6.216807$f85.32779643@typhoon.nyroc.rr.com>, Marc
<marc@hvc.rr.com> wrote:

> I am wondering if anyone knows of a decompiler that will convert Perl .exe's
> back to their native scripts.
> 
> These .exe's were created by me with Perl2Exe (similar to PerlApp by
> Activestate) and I need to edit them.  The only problem is my Perl Scripts
> were on a different drive that suffered a major crash, rendering most of the
> data irrecoverable.  Therefore I need to decompile the exe's.

This may be very obvious and naive of me, but have you asked
Indigostar's tech support people about this?  What did they say?  It
shouldn't be that difficult, as the .exe file that perl2exe produces is
basically an archive of all of the Perl sources, plus any DLLs used by
Perl modules.

Or, come to think of it, the perl2exe runtime unpacks the files into a
temp directory before running them...maybe you could run the program
and somehow kill it before it has a chance to clean up these files.

-- 
Kevin Michael Vail | a billion stars go spinning through the night,
kevin@vaildc.net   | blazing high above your head.
 . . . . . . . . .  | But _in_ you is the presence that
 . . . . . . . . . | will be, when all the stars are dead.  (Rainer Maria Rilke)


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

Date: Mon, 18 Jun 2001 00:23:38 GMT
From: "Marc" <marc@hvc.rr.com>
Subject: Re: Perl2Exe Decompiler?
Message-Id: <eSbX6.216823$f85.32838662@typhoon.nyroc.rr.com>


"Kevin Michael Vail" <kevin@vaildc.net> wrote in message
news:170620011958511367%kevin@vaildc.net...

> This may be very obvious and naive of me, but have you asked
> Indigostar's tech support people about this?  What did they say?  It
> shouldn't be that difficult, as the .exe file that perl2exe produces is
> basically an archive of all of the Perl sources, plus any DLLs used by
> Perl modules.

Been there, done that.  They were of no help whatsoever.  Their stand was
that their product doesn't support "backwards" conversions.

> Or, come to think of it, the perl2exe runtime unpacks the files into a
> temp directory before running them...maybe you could run the program
> and somehow kill it before it has a chance to clean up these files.

Hmmm, I'm a little confused here.  My original Perl scripts are gone.  All I
have are the "compiled" executables.  Perl2Exe is totally out of the picture
at this point since it can't convert my exe's back to .pl's.  If I'm missing
something here please fill me in.

Thanks for the response,

Marc

> --
> Kevin Michael Vail | a billion stars go spinning through the night,
> kevin@vaildc.net   | blazing high above your head.
> . . . . . . . . .  | But _in_ you is the presence that
>  . . . . . . . . . | will be, when all the stars are dead.  (Rainer Maria
Rilke)




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

Date: Sun, 17 Jun 2001 20:39:55 -0400
From: Kevin Michael Vail <kevin@vaildc.net>
Subject: Re: Perl2Exe Decompiler?
Message-Id: <170620012039550056%kevin@vaildc.net>

In article <eSbX6.216823$f85.32838662@typhoon.nyroc.rr.com>, Marc
<marc@hvc.rr.com> wrote:

> "Kevin Michael Vail" <kevin@vaildc.net> wrote in message
> news:170620011958511367%kevin@vaildc.net...
> 
> > This may be very obvious and naive of me, but have you asked
> > Indigostar's tech support people about this?  What did they say?  It
> > shouldn't be that difficult, as the .exe file that perl2exe produces is
> > basically an archive of all of the Perl sources, plus any DLLs used by
> > Perl modules.
> 
> Been there, done that.  They were of no help whatsoever.  Their stand was
> that their product doesn't support "backwards" conversions.

Well, I said it was probably naive of me...

> > Or, come to think of it, the perl2exe runtime unpacks the files into a
> > temp directory before running them...maybe you could run the program
> > and somehow kill it before it has a chance to clean up these files.
> 
> Hmmm, I'm a little confused here.  My original Perl scripts are gone.  All I
> have are the "compiled" executables.  Perl2Exe is totally out of the picture
> at this point since it can't convert my exe's back to .pl's.  If I'm missing
> something here please fill me in.

When you run a .exe file produced by perl2exe, I believe that it
unpacks the contents into a temp directory (C:\WINDOWS\TEMP on my
system) and then basically runs an embedded Perl interpreter on them. 
If you can somehow run the .exe but kill it before it has a chance to
clean up those files, you might be able to recover the scripts you're
trying to edit.  --Or maybe not, if I'm mistaken about how it works,
but it might be worth a try.

-- 
Kevin Michael Vail | a billion stars go spinning through the night,
kevin@vaildc.net   | blazing high above your head.
 . . . . . . . . .  | But _in_ you is the presence that
 . . . . . . . . . | will be, when all the stars are dead.  (Rainer Maria Rilke)


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

Date: Sun, 17 Jun 2001 20:47:05 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Problems with DB_File
Message-Id: <3B2D1315.EB44DD0@rochester.rr.com>

Simon Stiefel wrote:
 ...
> I've got some problems with the DB_File-module.
> 
> I've written a little script which converts the "DB_File-database" to a
> mySQL-database.
> This script works fine on my server (SuSE Linux 7.0 perl 5.6.1).
> 
> I've copied those files to my notebook (SuSE Linux 7.2 perl 5.6.1) but
> now, the script is not able to open the DB_File-database and I don't know
> why...
> 
> It says, that the database already exits... true, but why does the script
> then not open the database???
> 
> --- snip ---
> tie (%DBM,"DB_File", $dbm_analyze."\.ptm");
> --- snap ---
> 
> Does somebody have a solution for this solution?
 ...
> Simon Stiefel                 /(   )\_ I N U X
 ...
Well, the contents of dbm-type files is typically not necessarily
portable across different computers.  Parameters such as bucket size,
etc could be different during the compilation of the dbm-type file code
on one computer versus another.  The best deal is to convert the
dbm-type files to ASCII, copy the ASCII file, and then convert back to a
dbm-type file.
-- 
Bob Walton


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

Date: Sun, 17 Jun 2001 18:05:12 GMT
From: jtbell@presby.edu (Jon Bell)
Subject: Re: Protecting CGI-BIN Directory
Message-Id: <GF368p.7v9@presby.edu>

In article <20010617132643.19016.00004165@ng-fi1.aol.com>,
Maggie <canon50e@aol.comDELETE> wrote:
>The server host I currently subscribe uses Cobalt RaQ 4r servers.  I want to
>know how to protect a CGI-BIN from being able to access by the publc but yet
>still run the CGI scripts in this directory.

The appropriate place to ask about this is in one of the
comp.infosystems.www.servers.* groups; which one, depends on the operating
system your server uses.

-- 
Jon Bell <jtbell@presby.edu>                        Presbyterian College
Dept. of Physics and Computer Science        Clinton, South Carolina USA


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

Date: Sun, 17 Jun 2001 11:19:45 -0700
From: "Michael Vilain <michael@NOSPAM.vilain.com>"
Subject: Re: Protecting CGI-BIN Directory
Message-Id: <michael-313D8A.11194517062001@news.tdl.com>

In article <GF368p.7v9@presby.edu>, jtbell@presby.edu (Jon Bell) wrote:

> In article <20010617132643.19016.00004165@ng-fi1.aol.com>,
> Maggie <canon50e@aol.comDELETE> wrote:
> >The server host I currently subscribe uses Cobalt RaQ 4r servers.  I want to
> >know how to protect a CGI-BIN from being able to access by the publc but yet
> >still run the CGI scripts in this directory.
> 
> The appropriate place to ask about this is in one of the
> comp.infosystems.www.servers.* groups; which one, depends on the operating
> system your server uses.

The Cobalt server runs Linux, IIRC.  It has file and directory 
permissions for READ, WRITE, and EXECUTE.  In order to read a program or 
CGI script, you need to grant the directory EXECUTE permission and the 
file/script READ+EXECUTE (if the file can't be read, it can't be 
executed as far as Linux is concerned).

-- 
Michael Vilain, Certified Advanced Rolfer(r)
rolfer@vilain.com
http://www.vilain.com


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

Date: Sun, 17 Jun 2001 20:37:29 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Protecting CGI-BIN Directory
Message-Id: <Pine.LNX.4.30.0106172027530.422-100000@lxplus003.cern.ch>

On Sun, 17 Jun 2001, it was written:

> In article <GF368p.7v9@presby.edu>, jtbell@presby.edu (Jon Bell) wrote:
>
> > Maggie <canon50e@aol.comDELETE> wrote:
> > >The server host I currently subscribe uses Cobalt RaQ 4r servers.  I want to
> > >know how to protect a CGI-BIN from being able to access by the publc but yet
> > >still run the CGI scripts in this directory.

> > The appropriate place to ask about this is in one of the
> > comp.infosystems.www.servers.* groups;

Indeed it is, and right away we see a demonstration of the importance
of asking in the right place:

> The Cobalt server runs Linux, IIRC.  It has file and directory
> permissions for READ, WRITE, and EXECUTE.  In order to read a program or
> CGI script, you need to grant the directory EXECUTE permission and the
> file/script READ+EXECUTE (if the file can't be read, it can't be
> executed as far as Linux is concerned).

Of course. But this has nothing to do with granting web access to the
CGI scripts. You would have done better to remain silent, than to
answer the wrong off-topic question here.

[f'ups prophylactically set]



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

Date: Sun, 17 Jun 2001 23:57:06 GMT
From: shb@vnet.net (Si Ballenger)
Subject: Re: Protecting CGI-BIN Directory
Message-Id: <3b2d3f58.101491486@166.82.1.9>

On Sun, 17 Jun 2001 20:37:29 +0200, "Alan J. Flavell"
<flavell@mail.cern.ch> wrote:

>Of course. But this has nothing to do with granting web access to the
>CGI scripts. You would have done better to remain silent, than to
>answer the wrong off-topic question here.
>
>[f'ups prophylactically set]

Gosh! How did you do that?


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

Date: Sun, 17 Jun 2001 15:37:37 -0400
From: "Mr. Ozette Brown" <ozette@ozette.net>
Subject: Re: Removing ^M characters
Message-Id: <3B2D0701.2C287F8D@ozette.net>

Richard,

You can also try the following, say after you file with ctrl M's was already
created and you just want to take care of the problem all at once:

Under Linux:
perl -pi -e 's/\cM$//' filename.txt

Under Windows:
perl -pi.bak -e 's/\cM$//' filename.txt

In the windows method, I create a backup file and then operate on the original.

Thanks,

Ozette

"Richard A. Evans" wrote:

> Since DOS/Windows file typically (always?) use \r\n at the end of the line,
> I do not replace the \r with \n, as this results in a double linefeed, \n\n;
> I simply replace \r with nothing, using
>
> s/\r//g;
>
> Regards,
>
> Rick Evans

--
_______________________________________
Email:  ozette@ozette.net




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

Date: Sun, 17 Jun 2001 19:45:18 GMT
From: PropART <temp1@williamc.com>
Subject: Re: Rounding down a float
Message-Id: <3B2D0882.2A945804@williamc.com>

Philip Newton wrote:
>I presume you actually meant: the highest integer that is not greater than the number...

Yes...

> > and perfunc warns about using int for rounding... But, I don't see why
> > int shouldn't work.
> 
> Because you appear to want the largest integer that is not greater than
> the number, so -5.6 should map to -6. int(-5.6) would give you -5
> instead.
> 

That's what I thought. So if I'm always working with positive floats
then I guess I'm OK...

Thanks,

--wmc.


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

Date: Sun, 17 Jun 2001 18:57:59 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: sorting a list of files from a directory
Message-Id: <3B2D35F7.12CA787@earthlink.net>

John W. Krahn wrote:
> 
> Zsa Zsa wrote:
> >
> > I am looking for the best way to sort files within a directory for
> > the purpose of listing.
> > My ultimate goal is to sort the files in order of last modified
> > (most recent at top of list).
> > I developed this:
> >
> > opendir DIRH, "/path/tofolder" or die "couldn't open: $!";
> > foreach (sort { -M $a <=> -M $b } readdir DIRH) {
> 
> This sorts the oldest files first, change to
> 
> foreach (sort { -M $b <=> -M $a } readdir DIRH) {

If the directory is really large, this sort function might be rather
slow.  Use a Guttman-Rosler Transform.  Also, since you don't need the
dirhandle after the foreach, I would put the opendir and readdir inside
a do block inside the list argument of foreach.

foreach (do {
	opendir my $dirh, "/path/tofolder" or die "couldn't open: $!";
	map { substr $_, 4 }
	sort
	map { pack "N a*", -(-M), $_ }
	readdir $dirh;
	}) {
	print $_, "\n";
}

If you plan on printing or otherwise using the sizes inside the loop,
then the following might be prefered:

foreach (do {
	opendir my $dirh, "/path/tofolder" or die "couldn't open: $!";
	sort
	map { pack "N a*", -(-M), $_ }
	readdir $dirh;
	}) {
	my ($size, $name) = unpack "N a*";
	printf "%4d : %s\n",-$size, $name;
}

Note that all of this assumes that the sizes are less than 2**32 bytes.
Otherwise, quadwords would be needed.

-- 
The longer a man is wrong, the surer he is that he's right.


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

Date: 18 Jun 2001 03:55:29 +0300
From: Edvard Majakari <ed@krypton.mikroneuvos.fi>
Subject: Re: Sorting hash
Message-Id: <8766du61z2.fsf@krypton.mikroneuvos.fi>
Keywords: shash,join,split,hashes

On 16 Jun 2001, Sam Holden wrote:

> On 16 Jun 2001 00:36:11 -0700, Ron Anderson <ronlanderson@earthlink.net>
> wrote:
>>Using the sample hash below:
>>
>>$shash{"student1"} = join("\t", ("bob", "larson", "room5"));
>>$shash{"student2"} = join("\t", ("ron", "anderson", "room4"));
>>$shash{"student3"} = join("\t", ("dave", "lee", "room2"));
>>$shash{"student4"} = join("\t", ("tim", "barker", "room3"));
>>$shash{"student5"} = join("\t", ("roger", "farley", "room1"));

[snipp]

> You'd be much better off with something like:
> 
> $shash{"student1"} = {fname => 'bob', lname => 'larson', room =>
> 'room5'};

You're right, HoH would be more elegant IMO, too, but using plain strings
using join() might be better if there are *lots* of students, this data
structure has to be copied a lot or - or in any other case you have to
take into account memory requirements. Hash of hashes may take lots of
space due to internal structure of hashes.

In the case above, you could print given students sorted alphabetically by

# not tested though, and at the moment I'm very tired..
foreach (sort 
             # last name is at index 1
             { (split /\t/, $shash{$a})[1] cmp (split /\t/, $shash{$b})[1] }
         keys %shash) {

  print "key: $_, $shash{$_}\n";
}

Then again, I'm quite sure that calling split instead of plain hash
lookups is considerably slower method, and somewhat more complicated. I'd
go for HoH alternative, or as Sam pointed out, you might just use an
array, or LoH (list of hashes) actually.

-- 
# Edvard  http://krypton.mikroneuvos.fi/~ed/	 040 7150 969	

It is fruitless to become lachrymose over precipitately departed
lacteal fluid.


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

Date: 17 Jun 2001 21:14:27 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: too late error?
Message-Id: <992810634.5016@itz.pp.sci.fi>

In article <p4gfitcrbrvdrvhkv9r1v8ijn0qgk6q9k1@4ax.com>, Bart Lateur wrote:
>Vice wrote:
>
>>I get the error:
>>Too late for "-T" option at isbuild.pl line 1.
>>when trying to execute a .pl script from telnet
>>
>>what does it mean?
>
>That you can't use the -T option on the shebang line. Your perl script 
>needs to be called using it as a command line option.
>
>	perl -T myscript.pl ...

To clarify: You _can_ use the -T option on the #! line, as long as you
set the executable bit on the script and call it directly:

  $ cat script.pl
  #!/usr/bin/perl -Tw
  print "Hello, World!\n";

  $ ls -l script.pl
  -rwxr-xr-x    1 iltzu    iltzu          45 Jun 18 00:04 script.pl

  $ ./script.pl
  Hello, World!

  $ perl script.pl
  Too late for "-T" option at script.pl line 1.

  $ perl -T script.pl
  Hello, World!

CGI scripts are also called "directly", so this will work for them.


>Note that if your script passes the -T test, you no longer need it.

I wouldn't say that.  It might be true in theory, but only if you can be
sure that you've tried all the possible execution paths and that nothing
will change that could break your script later.

Larry Rosler's original analogy, "Fasten your seat belt in the parking
lot, but take it off when you go onto the highway," was originally made
about removing -w from production code, but it applies equally well if
not better to -T.

(Of course, I'm not trying to claim that -T alone would be a sufficient
safeguard against unforeseen security problems, just that using it even
in production code is better than not doing so.)

-- 
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real!  This is a discussion group, not a helpdesk.  You post something,
we discuss its implications.  If the discussion happens to answer a question
you've asked, that's incidental."           -- nobull in comp.lang.perl.misc



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

Date: Sun, 17 Jun 2001 21:00:16 +0200
From: "sjaak nabuurs" <sjaaknabuurs@hetnet.nl>
Subject: using lwp ??
Message-Id: <O2gF1919AHA.212@net005s.hetnet.nl>

Hello
How to retrieve some information from other website's
I try this but I don't know.
(It's allway's bad luck)

#!/usr/local/bin/perl
# Create a user agent object
use LWP::UserAgent;
$ua = new LWP::UserAgent;
$ua->agent("AgentName/0.1 " . $ua->agent);


# Create a request
my $req = new HTTP::Request POST => 'http://www.yahoo.com';
$req->content_type('application/x-www-form-urlencoded');
$req->content('match=www&errors=0');


# Pass request to the user agent and get a response back
my $res = $ua->request($req);


# Check the outcome of the response
if ($res->is_success) {
print $res->content;
} else {
print "Bad luck this time\n";
}
In php it's very easy but I need to run this in a cron (php can't or ??)

Thanks


--

Sjaak Nabuurs






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

Date: Sun, 17 Jun 2001 17:55:28 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: What modules are being used?
Message-Id: <3B2D2750.E2ACA155@earthlink.net>

David Coppit wrote:
> 
> [posted & mailed]
> 
> On Fri, 25 May 2001, Terry Gliedt wrote:
> 
> > Simply put, for a given Perl script, what are all the modules (and
> > the version) used?
> 
> Here's what I use:
> 
> END
> {
>     foreach my $key (sort keys %INC)
>     {
>       my $package = $key;
>       $package =~ s/\//::/g;
>       $package =~ s/\.pm$//;
> 
>       my $version;
> 
>       if ($package =~ /^::/ || $package =~ /\./)
>       {
>         $version = 'undef';

This is the STRING "undef", not the undefined value.  Is that what you
want?  Also, why do you require that your packages not have either :: or
 . in them?  It seems to be a strange requirement.

>       }
>       else
>       {
>         $version = eval "\$${package}::VERSION";

Is there some reason you use eval here rather than a symref?
	no strict 'refs';
	$version = ${"${package}::VERSION"};

>       }
> 
>       $version = 'undef' unless defined $version;
> 
>       print "  $key ($version) =>\n    $INC{$key}";
>     }
> }

-- 
The longer a man is wrong, the surer he is that he's right.


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

Date: Sun, 17 Jun 2001 20:24:04 +0200
From: buggs <buggs-clpm@splashground.de>
Subject: Re: windows 2000
Message-Id: <9gisi5$pva$03$1@news.t-online.com>

Abe Timmerman wrote:

> 
> *plonk*
> 

*splash*

Buggs


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

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


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