[10721] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4320 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 30 05:07:20 1998

Date: Mon, 30 Nov 98 02:00:20 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 30 Nov 1998     Volume: 8 Number: 4320

Today's topics:
    Re: "ELSE" command in Perl?? (Sean McAfee)
        Active State and Package Manager not working (Bill Moseley)
        barcodes <arm@home.net>
    Re: bugs in the perl T-shirt (was Re: Question from a m (Ronald J Kimball)
    Re: debugging forks <fx77@dial.pipex.com>
    Re: HELP!!! REAL simple script doesn't work! (Ronald J Kimball)
    Re: How to: Know who login using .htaccess in cgi (brian d foy)
        macperl problem using Quid Pro Quo warren_a@my-dejanews.com
    Re: macperl problem using Quid Pro Quo (Rich Morin)
        Mounting Network Directories in Win32 Perl <vwalke@ibm.net>
        Origin of 'local'? <newspost@morlock.net>
    Re: Origin of 'local'? <girishd@gsslco.co.in>
    Re: Perl compiler? <antonio@ifi.unizh.ch>
    Re: Please help me solve three CGI problem: Make Dir, C <alcazar@netcomp.net>
    Re: Problem compiling with perl compiler B vishalb@my-dejanews.com
        RegExp and Authentication Help. <ccyr@home.com>
    Re: Simple regexp problem (Ronald J Kimball)
        Specify Exception in XS <perl_writer@hotmail.com>
        string match <ank@gte.net>
        The new HTMLDirectory.com free cgi hosting + more vepoko@start.com.au
    Re: Timeout on CGI-scripts that may block <jornt@md1.merkantildata.net>
        to dbm or not to dbm? (Bill Moseley)
    Re: Using a variable as an argument to use lib (Sean McAfee)
    Re: Using a variable as an argument to use lib (Ronald J Kimball)
        variables in substitutions rick.schwein@phillynews.com
    Re: variables in substitutions <ebohlman@netcom.com>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Mon, 30 Nov 1998 04:04:34 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: "ELSE" command in Perl??
Message-Id: <mPo82.1794$CY1.7858478@news.itd.umich.edu>

In article <ken-2911981827550001@min-mn6-04.ix.netcom.com>,
Ken Williams <ken@forum.swarthmore.edu> wrote:
>Here's an interesting question: if you used tie($web, ...) to change the
>assignment behavior of $web, could you get 'if ($web = "")' to return a
>true value?  Haven't found the answer to this in the docs.

Yes, you could.

sub TIESCALAR { bless \my $foo }
sub FETCH { 1 }
sub STORE { 1 }

tie $x, 'main';
if ($x = "") { print "False is true!\n" }

-- 
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
            | K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
            | tv+ b++ DI++ D+ G e++>++++ h- r y+>++**          | umich.edu


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

Date: 30 Nov 1998 05:50:10 GMT
From: moseley@best.com (Bill Moseley)
Subject: Active State and Package Manager not working
Message-Id: <36623212$0$227@nntp1.ba.best.com>

I'm running Build 506 of Active State Perl on a Win 95 machine.

When I run the Perl Package Manager, ppm, with any command I receive the 
following:

junk after document element at line 2, column 0, byte 27 at 
D:\PERL\site\lib/XML/Parser.pm line 118

I'm a bit lost on what to look at next.  I've looked at Parser.pm, and don't 
see any problem, though I'm not exactly sure that's what the error message is 
saying.




-- 
( Please CC: by email if not too much trouble )
--------------
Bill Moseley
moseley@best.com



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

Date: Mon, 30 Nov 1998 05:43:37 GMT
From: Alan Melton <arm@home.net>
Subject: barcodes
Message-Id: <36622E9D.DDE638BA@home.net>

is there a method of generating out barcodes from numbers


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

Date: Sun, 29 Nov 1998 23:50:16 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: bugs in the perl T-shirt (was Re: Question from a mega-geek)
Message-Id: <1dja3ag.1qu9fw81v5n39xN@bay2-42.quincy.ziplink.net>

brian d foy <comdog@computerdog.com> wrote:

> i can even put the shirt under the GPL so that you
> can let anyone wear it. :)

Ack!  If I combined the GPLed shirt with my own blue jeans to create an
outfit, and then let someone else wear my outfit, the GPL would require
me to let them use my blue jeans in their own outfits!

-- 
 _ / '  _      /         - aka -          rjk@linguist.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Mon, 30 Nov 1998 09:45:27 -0000
From: "TS" <fx77@dial.pipex.com>
Subject: Re: debugging forks
Message-Id: <73tpe5$9pe$1@plug.news.pipex.net>


Ilya Zakharevich wrote in message
<73mv3q$2j6$1@mathserv.mps.ohio-state.edu>...
>[A complimentary Cc of this posting was sent to TS
><fx77@dial.pipex.com>],
>who wrote in article <73m2dq$5da$1@plug.news.pipex.net>:
>> If I strip the child code out of the program it works fine, but in this
>> construction it fails under certain circumstances. When I try to debug
this
>> code the debugger seems to stay always in the parent process. Can anyone
>> tell me how I can get the debugger to debug the child code?
>
>Apparently you have a very old Perl.  Upgrade.
>
>Ilya

I am currently using perl 5.004_04.
I realise that there is a newer version of perl: 5.005_0?, but as in
stalling that will mean installing it on more than 40 machines, with at
least 5 different operating systems, in order to keep everything in line, I
don't fancy doing that right now.

So, is there a way of debugging the child code under 5.004_04? By the way,
it is not the actual contruct that fails, but there is a bug somewhere in
the child code, that I can only replicate when running it as a child
process. The actual child code is about 800 lines long and I don't think it
is good idea to send all of that to this news group.

Kees





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

Date: Sun, 29 Nov 1998 23:50:14 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: HELP!!! REAL simple script doesn't work!
Message-Id: <1dja29k.1tmixrnb3khq8N@bay2-42.quincy.ziplink.net>

Larry Rosler <lr@hpl.hp.com> wrote:

> > > #!/usr/bin/perl
> > > print "Conent-type: text/html\n\n";
> > > print "query string=$ENV{'$QUERY_STRING'}";
> ...
> > use CGI q/:all/;
> > print header, query_string;
> > 
> > Score another point in favor of using CGI.pm ( sorry Larry :)
> 
> When run several times on my webserver on Windows NT, the first program
> (corrected, of course) averages about 0.03 sec of CPU to load and 
> nothing to execute.  The second program averages in addition about 0.2
> sec of CPU to initialize and 0.1 sec to execute -- about 10 times 
> longer, in total.

On the other hand, the second program actually works.
I think that's the point that Patrick was making.  ;-)

-- 
 _ / '  _      /         - aka -          rjk@linguist.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Mon, 30 Nov 1998 00:01:37 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: How to: Know who login using .htaccess in cgi
Message-Id: <comdog-ya02408000R3011980001370001@news.panix.com>

In article <366141e4.3245789@news.demon.nl>, news@discovery.demon posted:

> $ENV{'REMOTE_USER'} holds the username, I think the password can't be
> determined. Anyone?

the availability of the password depends on the server and how it
was compiled.  your server docs should have the details.

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Mon, 30 Nov 1998 06:12:31 GMT
From: warren_a@my-dejanews.com
Subject: macperl problem using Quid Pro Quo
Message-Id: <73td06$g42$1@nnrp1.dejanews.com>

OK, this is probably a stupid question.  I am trying to run a web server on a
mac, using Quid Pro Quo, and running a simple CGI script with Macperl.	When
I bring the page up in my browser, the script executes, but the output
doesn't go to the browser.  I see the HTML just as I want it, but in a
MacPerl window.  The browser gets a "document contains no data" error.	I
think I have the permissions right, and I think the server settings are right
-- I'm sure there's just some setting I missed.  Any suggestions?


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


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

Date: Sun, 29 Nov 1998 23:12:00 -0800
From: rdm@cfcl.com (Rich Morin)
Subject: Re: macperl problem using Quid Pro Quo
Message-Id: <rdm-2911982312150001@140.174.42.30>

In article <73td06$g42$1@nnrp1.dejanews.com>, warren_a@my-dejanews.com wrote:

> OK, this is probably a stupid question.  I am trying to run a web server on a
> mac, using Quid Pro Quo, and running a simple CGI script with Macperl.  When
> I bring the page up in my browser, the script executes, but the output
> doesn't go to the browser.  I see the HTML just as I want it, but in a
> MacPerl window.  The browser gets a "document contains no data" error.  I
> think I have the permissions right, and I think the server settings are right
> -- I'm sure there's just some setting I missed.  Any suggestions?

I've forwarded your inquiry to the MacPerl list.  Unfortunately, as
the email address you give (warren_a@my-dejanews.com) fails, you
won't see any responses directly.  For information on how to join the
MacPerl list, see the MacPerl Pages <www.ptf.com).

-r

-- 
Canta Forda Computer Laboratory       | Prime Time Freeware - quality 
UNIX consulting, training, & writing  | freeware at affordable prices
+1 650-873-7841                       | +1 408-433-9662   -0727 (Fax)
Rich Morin, rdm@cfcl.com              | www.ptf.com, info@ptf.com


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

Date: Sun, 29 Nov 1998 21:32:22 -1000
From: "Vann H. Walke" <vwalke@ibm.net>
Subject: Mounting Network Directories in Win32 Perl
Message-Id: <36624A06.C7EF9FFA@ibm.net>

How can I mount a network directory (i.e. "\\server\directory" to "p:")
in a Perl script?

Thanks,
Vann



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

Date: Sat, 28 Nov 1998 21:42:37 -0500
From: Steven Morlock <newspost@morlock.net>
Subject: Origin of 'local'?
Message-Id: <Px282.52$Hw.454556@lwnws01.ne.mediaone.net>


I have had an opportunity to develop in several different
languages and I never encountered anything quite like 'local'.

At first I thought 'local' was a bit of syntactic sugar that saved
one the trouble of saving, modifying & restoring the value of
of a global variable.  Repeatably I get minor burns by my forgetful
memory of what 'local' does.  The source of my confusion
results from how references are handled when a 'local' is effect.
Unlike directly modifying a global variable, 'local' does not leave
references to the global pointing to the new value.  For example
the following:

$s = 1234;
$rs = \$s;

output();
tlocalize();
localize();
$s = 8765;
output();

sub tlocalize { # Localize using a temporary variable
 my $ts = $s;
 $s = 4321;
 output();
 $s = $ts;
}

sub localize { # Localize using 'local'
 local ($s) = 5678;
 output();
}

sub output {
 print "s = $s, rs = $$rs\n";
}

 ... produces the following output:

s = 1234, rs = 1234
s = 4321, rs = 4321
s = 5678, rs = 1234 (*)
s = 8765, rs = 8765

The line highlighted with the '*' is a bit surprising to me.

Where did this seemingly unusual behavior for local come from?  Was it
considered a feature and used to solve a particular class of problem?
Is it documented in detail somewhere?

Don't get me wrong, I have also used it to my advantage many a time
but I feel I need to offer up an explanation each time I use it.

Steve

Foliage Software Systems
http://www.foliage.com


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

Date: Mon, 30 Nov 1998 14:50:39 +0530
From: "Girish Deodhar" <girishd@gsslco.co.in>
Subject: Re: Origin of 'local'?
Message-Id: <73tnt5$532@uranus.m-netz.ch>

relevant part of the camel says ...

"After the local is executed, but before the
scope is exited, any called subroutines will see the local, inner value, not
the previous, outer value, because the variable is still a global
variable, despite having a localized value. The technical term for this is
"dynamic scoping". "

this is why the call to "output()" inside tlocalise() gets the "local" value
of $s.

~girish

Steven Morlock wrote in message ...
>
>I have had an opportunity to develop in several different
>languages and I never encountered anything quite like 'local'.
>
>At first I thought 'local' was a bit of syntactic sugar that saved
>one the trouble of saving, modifying & restoring the value of
>of a global variable.  Repeatably I get minor burns by my forgetful
>memory of what 'local' does.  The source of my confusion
>results from how references are handled when a 'local' is effect.
>Unlike directly modifying a global variable, 'local' does not leave
>references to the global pointing to the new value.  For example
>the following:
>
>$s = 1234;
>$rs = \$s;
>
>output();
>tlocalize();
>localize();
>$s = 8765;
>output();
>
>sub tlocalize { # Localize using a temporary variable
> my $ts = $s;
> $s = 4321;
> output();
> $s = $ts;
>}
>
>sub localize { # Localize using 'local'
> local ($s) = 5678;
> output();
>}
>
>sub output {
> print "s = $s, rs = $$rs\n";
>}
>
>... produces the following output:
>
>s = 1234, rs = 1234
>s = 4321, rs = 4321
>s = 5678, rs = 1234 (*)
>s = 8765, rs = 8765
>
>The line highlighted with the '*' is a bit surprising to me.
>
>Where did this seemingly unusual behavior for local come from?  Was it
>considered a feature and used to solve a particular class of problem?
>Is it documented in detail somewhere?
>
>Don't get me wrong, I have also used it to my advantage many a time
>but I feel I need to offer up an explanation each time I use it.
>
>Steve
>
>Foliage Software Systems
>http://www.foliage.com




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

Date: Mon, 30 Nov 1998 08:46:34 +0100
From: "Denis N. Antonioli" <antonio@ifi.unizh.ch>
Subject: Re: Perl compiler?
Message-Id: <Pine.SOL.4.05.9811291642470.291-100000@mauritius.ifi.unizh.ch>



On 27 Nov 1998, Tom Christiansen wrote:
> 
> In comp.lang.perl.misc, 
>     silk@interlog.com (Robin D.F. Silk) writes:
> :Perl programs do not need to be compiled -- it is an interpreted language.
> 
> I have very bad news for you: all programming languages are interpreted.
> 

Not for the common definition of 'interpreted', such as given by
<http://wombat.doc.ic.ac.uk/foldoc/foldoc.cgi?query=interpreter&action=Search>

Perl is interpreted, and it is a good thing.

Unless, of course, we're living beyond the mirror:

"When I use a word," Humpty Dumpty said in a rther scornful tone,
 "it means just what I choose it to mean - neither more no less."
"The question is", said Alice, "whether you can make words mean
 different things."
"The question is", said Humpty Dumpty, "which is to be master
 - that's all."
  Lewis Carroll, Through the Looking-glass, Chapter vi

:-)

Have a nice day,
	dna
- -- 
  They spell it "da Vinci" and pronounce it "da Vinchy". Foreigners
  always spell better than they pronounce.
    -- Mark Twain



Version: 2.6.3ia
Charset: latin1

iQCVAwUBNmJNZn7lXFr6ofWlAQGcZQQAmFCRGlL68OwJ3QfCpv8+OiUJwUxCOpft
etYOnejQGomMNT/vBVmCZSXS/veuY3pOXhTobFyDZwFX9URSNEr3scrFBCaI3MKS
jSd1X7XNrXTtF9FjteTc63QZIl0v+5WL18UA17ute6GF/LtkNXYMQMlTsg7TJ1GQ
wEJXU+c0ov0=
=/I1X
-----END PGP SIGNATURE-----



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

Date: Sun, 29 Nov 1998 23:42:36 -0600
From: "illfigah" <alcazar@netcomp.net>
Subject: Re: Please help me solve three CGI problem: Make Dir, Create file and frameset
Message-Id: <uuXD1PCH#GA.153@upnetnews05>


    Hey,

    Tho your perl code is rather arkane, it is correct.  Since you've
recieved those errors on all three of your scripts...  the problem is the
same.  Make sure that when you upload the script (via ftp) that you set your
upload to ascii format...  binary will add unwanted characters.


illfigah




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

Date: Mon, 30 Nov 1998 06:36:04 GMT
From: vishalb@my-dejanews.com
To: kramer@techne.ca
Subject: Re: Problem compiling with perl compiler B
Message-Id: <73tecj$h9v$1@nnrp1.dejanews.com>

Your error can be fixed by removing
__END__ directive from Long.pm. The problem is
that compiler cannot Autoload functions ( though it is
supposed to be able to)

Downgrading to alpha 3 is not recommended ( the current version is
alpha 5)Upgrading to the version with 5.005_53 would be better idea ( just
extract ext/B directory from 5.005_53 into the version you have.

cheers

vishal

In article <3651C9D2.F4263F2D@techne.ca>,
  "Bryan M. Kramer" <kramer@techne.ca> wrote:
> I'm trying out the experimental compiler that comes with perl 5.005.
>
> I'm getting the message
>
> No definition for sub Getopt::Long::GetOptions
> No definition for sub Getopt::Long::GetOptions (unable to autoload)
>
> when compiling as below:
>
> % perlcc parse-error-line-count.pl
>
>
--------------------------------------------------------------------------------
>
> Compiling parse-error-line-count.pl:
>
--------------------------------------------------------------------------------
>
> Making C(parse-error-line-count.pl.c) for parse-error-line-count.pl!
> /local/perl/bin/perl -I/local/perl/lib/5.00502/sun4-solaris
> -I/local/perl/lib/5.00502 -I/local/perl/lib/site_perl/5.005/sun4-solaris
> -I/local/perl/lib/site_perl/5.005 -I.
> -MO=CC,-oparse-error-line-count.pl.c parse-error-line-count.pl
> parse-error-line-count.pl syntax OK
> No definition for sub Getopt::Long::GetOptions
> No definition for sub Getopt::Long::GetOptions (unable to autoload)
>
> The script works fine when run directly with perl. Is this a show
> stopper
> bug in the compiler or is there a workaround I can use? I don't have
> time
> to change my scripts to use a different get options.
>
> Thanks
>
>

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


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

Date: Mon, 30 Nov 1998 09:39:10 GMT
From: Colin Cyr <ccyr@home.com>
Subject: RegExp and Authentication Help.
Message-Id: <3662683A.8DC00F7@home.com>

Well, hrm, I've tried and I've tried.

I need a very simple little regexp to do some checking... And
unfortunately my background in C++, Pascal and all those other Windows
typical languages doesn't allow me to easily interpret regexps, I just
don't know why?!?!

Okay back on task...  Very simple regexps.

$data = "243";
$data =~ /^\d$/; # How'd I add the additional condition that
		 # it is a Real number (Nothing less than 1)?

$data = "243.3.2.1.4";
$data =~ /????/; # Nothing I've tried will allow me to verify
		 # this.  Each section must be a Real, and the
		 # string cannot start or end with a period.


Okay, now on to finding these things...

$find = "243.3"; or	# Locates a specific key and returns it,
			# simple verification of existance...
$find = "243.3.?"; or	# Return the sub-keys of 243.3
			# (1 level deep).
$find = "243.3.?.?"; or	# Return all sub-sub-keys (2 levels deep).
$find = "243.3.2.*";	# Return a list of all keys starting 

@found = search ($find);

sub search {
	my ($query) = shift;

	$query =~ s/[*]/???/...
# Well the other translations as well, this really shouldn't
# be too hard, just have to grab the DOS globbing code out of
# the cook book.  Any insiteful words?

# %data is a DBM of possibly thousands or keys.  Hopefully this
# won't hamper.

	grep ($query, keys %data);
}


--------------------------------------
On to the bread and butter: ;)

I'm implementing the RPC module as seen in the Panther...

I want to implement authentication for the login process.  Am I
ambiguous and vague or what?

What's a decent way to go?

I've been thinging of keeping a user database, and the client software
would require the user to login and use their authentication info to hit
the server (for ACL's etc.).

Primarily this would be a DBM implementation, with an option to drop the
base information into a flat file for Apache logins etc.

Apache supports DBM for authentication right?  Is it then theoretically
possible to generate this DBM in perl using DB_File, and ensure the 2
fields Apache needs are done correctly?  Is the internal crypt hashing
function in perl equivalent to the UNIX passwd crypt and Apache crypt?

For a shell based text interface, or for that matter just about all
non-web based interfaces (tk, x, motif, etc), where the user is already
authenticated, is it advisable to steal their uid, translate it into
their name, and transfer it automatically to the server, thus requiring
one less authentication step?

Problem is, how do you fetch their password and pass it on to the
"server"?  It's easy to grab it from passwd, problem strikes when the
server they are on is using 'shadow passwords' or is on a real funky
system.  This further complicates itself into what if their password in
the shell is force changed.  Or a security hole in some instances.

Well hrm... Am I any further along at this point?

I'd love to hear any ideas you all have on Authentication and RPC.


I thank all those who contribute in advance, this information is being
used to create a GPL Request Tracking System.

I'd also appreciate if you could reply to my e-mail address as well as
the news group.  Thank you again.
-- 
Colin Cyr			(ccyr at home dot com)


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

Date: Sun, 29 Nov 1998 23:50:18 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Simple regexp problem
Message-Id: <1dja3lw.1pcbg582k3pauN@bay2-42.quincy.ziplink.net>

Michael S Vernal <vernal@fas.harvard.edu> wrote:

> I've got a pretty simple problem, but I don't have any perl books home
> with me for Thanksgiving.

Note that even if you don't have any books, if you have the perl
interpreter (and you do, because you were able to test your code) then
you should have the Perl documentation.

> $some_string =~
>   s/<!--#echo var="([a-z][0-9])" -->/pretty_print($some_hash{$1})/g;
> 
> It works fine if I don't try and pretty_print() the hash, but when I try
> and use pretty_print, it just substitutes in "pretty_print(<var>)".
> (Editor's Note: I couldn't decide whether to follow the rules of grammar
> and have the period inside, or have it outside to prevent confusion.)

The period should be on the outside to prevent confusion; it is not part
of the actual quote.

-- 
 _ / '  _      /         - aka -          rjk@linguist.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Mon, 30 Nov 1998 15:01:52 +0800
From: "Perl Writer" <perl_writer@hotmail.com>
Subject: Specify Exception in XS
Message-Id: <73tfoc$94d$1@imsp009a.netvigator.com>

Hi there,

Does anybody know how to call a C function in perl script which will throw
an exception, i.e. how can I specify the "try{} catch() {}" construct in XS?

Thanks in advance.
Chloe




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

Date: Mon, 30 Nov 1998 01:10:02 -0500
From: Ashish <ank@gte.net>
Subject: string match
Message-Id: <73tcm9$k26$1@news-2.news.gte.net>

Hi
I would like to know the following:

-----
$string = "This is string. is it";
@i=($string =~ m/(is)/ig);
print "@i";
------
How @i is taking "is is is";

Thanks..


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

Date: 30 Nov 1998 05:13:59 GMT
From: vepoko@start.com.au
Subject: The new HTMLDirectory.com free cgi hosting + more
Message-Id: <73t9in$6j8$5@news.wantree.com.au>

Greetings,
HTMLDirectory.com is a huge database of webmaster and design related pages. 
This database has been created to help webmasters get more out of their pages and build
better pages. The following topics are extensively covered:
- Sponsors, generate revenue with your pages.
- Scripts, useful scripts to spice up your pages.
- Software, graphics and HTML based software.
- Promotion, tools, services and resources to help promote your site.
- Hosting, find a host that suits you!
- Designers, need a designer to do your page? Try our listings.
- References, help with HTML codes and more.
HTMLDirectory.com also has a excellent wwwboard script where you can post messages
on the following topics:
- Scripts, Discussion on scripts of all kinds including cgi and java. Post your questions here.
- Hosting + Connections, General discussion on hosting and internet connections.
- Sponsors, Discussion of revenue making and sponsor programs.
- Design, General help and discussion for html tags and related topics.
- Announcements, Webmasters can announce their product or services here.
- Tips + Tricks, Tips and tricks on how to improve your website.
HTMLDirectory.com webmasters welcome all sites to add their links today! Feel free to
advertise your site in the announcements section but leave other sections open for messages,
I hope you find this a useful resource! Go now at http://www.HTMLDirectory.com/
Thanks,
David
HTMLDirectory.com webmaster
backup@start.com.au




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

Date: 30 Nov 1998 10:05:39 +0100
From: Jorn Topnes <jornt@md1.merkantildata.net>
Subject: Re: Timeout on CGI-scripts that may block
Message-Id: <xcpyaot35zw.fsf@md1.merkantildata.net>

bernie@fantasyfarm.com (Bernie Cosell) writes:

> Jorn Topnes <jornt@md1.merkantildata.net> wrote:
> 
> } I wonder how I can set up a timeout-system just to be sure that my CGI-scripts
> } wont block other scripts they share resources with. Can I give my scripts a 
> } timeout of say 5 minutes?
> 
> I'm not sure I understand what you mean here.  [you say "won't block" ---
> did you really mean to write "won't be blocked by"??]  If you're talking
> CGI, then five minutes is ridiculous --- what user would sit in front of
> their browser for five minutes waiting for a page to load [indeed most
> browsers will have given up on you LONG ago].  I suspect that you shouldn't
> block for more than a few tens of seconds at the most..
> 

No, the scripts are for administrating and some can be rather time-consuming,
but they will usually finish in 1 minute if the load is average.

> Dealing with blocking on shared resources is a long standing systems design
> problem and there are a bunch of solutions [especially where just "waiting
> forever" isn't a viable alternative].  The very last-resort, when you can't
> find *ANY* other way to deal with the problem, is to use some kind of
> timeout/alarm signal and brute-force pull you out of the wait for whatever
> resource you're waiting for.  It is a terrible solution because it is
> horribly nondeterministic, Perl isn't quite reentrant and altogether it
> makes for some nasty implementation problems.
> 

Yes, I know, but I don't have that many dining philosophers in my system.
It's just to make sure that my scripts wont stall om some data once in 
a million times ;-)

> If you start with the notion that "locking" a resource is a very bad idea,
> then you can usually find ways to get done what you need done without a
> long-timeout lock.
> 
> Two ways, for example, are to do transaction actions and snapshot actions:
> 
> 1) transaction: you figure out what you want to do [interactively, slow,
> however], and then lock-transact-unlock.
> 
> 2) snapshot: you copy the file and work at your leisure on the copy.  Then
> you lock-trytoupdate-unlock.  In trytoupdate you make sure that no one else
> has changed the file while you were messing with it.  If someone else has
> messed with the file you deal with it someone [in a little program I wrote
> a few days back that took just this approach, I just told the user "you
> lose, please do your edit over again" (no, I'm not an unsympathetic cretin
> gleefully willing to throw away hours of a user's work: this is OK in my
> particular application. :o)) but you could also use something like Unix's
> 'diff3' to make the user's changes on the new-version of the file
> automatically or something like that..
> 

I use flock() on all files open for writing, then the script produces
a .tmp file and copies the original to a .bak file. Then I rename the 
 .tmp to my original and use wc, diff and grep to verify the new original 
comparing to the .bak file.

> 
> It really depends on what sort of resource you're sharing and what the
> constraints are, [and I know this isn't much help on your original
> question, but in truth I think it is good advice}: If you really need to
> lock resources for a long time, before I'd go and start building in
> lock-timeouts and such I'd go an carefully reexamine the system design..
> 

I agree. It's just for safety-precautions, and this worst-case scenario
will never happen I think. But I'm a bit paranoid I guess. Anyway, I think
timeouts should always be used in CGI-scripts, just to be sure...


>   /Bernie\
> -- 
> Bernie Cosell                     Fantasy Farm Fibers
> bernie@fantasyfarm.com            Pearisburg, VA
>     -->  Too many people, too few sheep  <--          

Jxrn


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

Date: 30 Nov 1998 05:40:43 GMT
From: moseley@best.com (Bill Moseley)
Subject: to dbm or not to dbm?
Message-Id: <36622fdb$0$227@nntp1.ba.best.com>

I working on a web-based workshop registration cgi script in Perl -- multiple 
workshops, multiple times and locations, and so on.  A bunch of it will be 
relational, of course.  I'll want to do lookups by name, by workshop dates, and 
by workshop location, for example.

My question is: when does it make sense to use dbm file(s) instead of keeping 
just plain text files (and filling related hashes when the script runs from the 
text files)?

And if I use dbm, does it make sense, speed wise, to use one or just a few 
files, or use a separate file for each record structure?  (I'm an old Pascal 
programmer that's used to building the files all by record structure.)

I want a fast method so I'm not holding the files open for very long.

Vague question, I know, but I'm looking for some general design guidelines.

Thanks,


--------------
Bill Moseley
moseley@best.com



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

Date: Mon, 30 Nov 1998 04:16:01 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: Using a variable as an argument to use lib
Message-Id: <5_o82.1795$CY1.7863143@news.itd.umich.edu>

In article <3661E383.9EE1D501@bitpipe.com>,
Jay Habegger  <habegger@bitpipe.com> wrote:
>I have a situation where I need to move several scripts among several
>different machines.  On all of these machines I'm unable to install my
>perl libaries in one of the standard places.  To date I've just used a
>use lib statement in each program.  However, moving them around
>and always commenting/un-commenting the appropriate libarary path
>is getting to be a pain.  I've written a short eval routine that
>determines
>where the program is running, acquires the lib path and places it
>in a variable $LIB.  Unfortunately, this doesn't seem to work.

The problem is that "use" statements are evaluated at compile time, but
your routine that determines the correct lib path to use isn't evaluated
until run time.  Put your routine in a BEGIN block, like so:

BEGIN {

># Code here.

}

>use lib $LIB;
>use my_module;

Another solution which perhaps flirts with obfuscation is this:

use lib do {
	my $LIB;
	# code which figures out right path, and assigns it to $LIB
	$LIB;
};

-- 
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
            | K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
            | tv+ b++ DI++ D+ G e++>++++ h- r y+>++**          | umich.edu


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

Date: Sun, 29 Nov 1998 23:50:21 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Using a variable as an argument to use lib
Message-Id: <1dja47b.1ld0y0ja6nitnN@bay2-42.quincy.ziplink.net>

Jay Habegger <habegger@bitpipe.com> wrote:

> [use lib $LIB]

Please read the documentation for 'use'.

'use' is a compile-time directive - it will be executed once when the
program is compiled.

At compile time, $LIB is undefined.  'use lib $LIB;' simply adds the
null string to @INC.

One solution: set the value of $LIB at compile-time too.

BEGIN { $LIB = '/my_lib_path' }
use lib $LIB;


Do NOT do the following

BEGIN {
  $LIB = '/my_lib_path';
  use lib $LIB;
}

because 'use' is a still a compile-time directive - it will be executed
when the BEGIN {} block is compiled, before $LIB has been set.

-- 
 _ / '  _      /         - aka -          rjk@linguist.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Mon, 30 Nov 1998 04:57:05 GMT
From: rick.schwein@phillynews.com
Subject: variables in substitutions
Message-Id: <73t8iu$crt$1@nnrp1.dejanews.com>

I am using the current version of Perl for Win32.  I have a script that reads
search/replace pairs from a control file, and I am not getting the "replace"
results I expect.

Simple substitutions work just fine, but if I use parentheses to group target
strings, I'm not able to get them back out properly.

For example:  my control file contains these search/replace pairs (slashes
are interpreted as delimiters):  /aaa/qqq/  /(bbbb)(.*)(ee)/\3\2\1/

   the script loops through the control file and reads in each line and splits
them into the variables $search and $replace.  it then uses those variables in
this line:
   $_ =~ s/$search/$replace/gi ;

   if the script is run against text containing this line:
      aaa bbbb ccccc dddddd ee f

   my output is "qqq \3\2\1 f" and not "qqq ee ccccc dddddd bbbb f"

   if the substitution pairs are typed explicitly within the script, they are
execute as expected.  but when expressed as variables, it breaks.  is this a
win32 bug or simply they way the =~ s// operator works?

thanks,
Rick Schwein
rick.schwein@phillynews.com

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


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

Date: Mon, 30 Nov 1998 06:17:20 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: variables in substitutions
Message-Id: <ebohlmanF381Gw.MKE@netcom.com>

rick.schwein@phillynews.com wrote:
: For example:  my control file contains these search/replace pairs (slashes
: are interpreted as delimiters):  /aaa/qqq/  /(bbbb)(.*)(ee)/\3\2\1/

That's not how you interpolate backreferences into a substitution in Perl...

Go back and take a look at perlre, where you'll find that you want to use 
'$3', etc. rather than '\3' (which says to insert a control-c into the 
replacement text).



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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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

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

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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


------------------------------
End of Perl-Users Digest V8 Issue 4320
**************************************

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