[10932] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4533 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jan 2 17:07:11 1999

Date: Sat, 2 Jan 99 14:00:21 -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           Sat, 2 Jan 1999     Volume: 8 Number: 4533

Today's topics:
        ActiveState perldb and GNUemacs (NTemacs) <MBalenger@worldnet.att.net>
    Re: ActiveState perldb and GNUemacs (NTemacs) <jdf@pobox.com>
    Re: Bug in Modulo Operator? (Ilya Zakharevich)
        Can perl preform an server side post through SSL? <rblack@gar.net>
    Re: Converting globs to regexes (was: wildcard) (Abigail)
    Re: Crypt() <webmaster@somewhere.com>
        dynamic default page and file extenstion <wcho@neopage.net>
    Re: dynamic default page and file extenstion (Groovy94)
    Re: Homepage- Search Engine with ASP or PERL ? <philip.class@popcorn-studio.ch>
    Re: How does scope play in require? Testcode included <design@raincloud-studios.com>
    Re: how to debug perl programs? (Andrew M. Langmead)
    Re: Installing pm files for Perl Win32 <clerke@emirates.net.ae>
    Re: locating module GDBM_File <Alain.Coetmeur@wanadoo.fr>
    Re: Make Gif/jpeg file <efinch@cais.com>
    Re: Need Shopping Cart for web...Newbie pcbrady@hotmail.com
    Re: Never seen this error before? <rick.delaney@home.com>
    Re: New posters to comp.lang.perl.misc (Andrew M. Langmead)
    Re: New to perl <dgris@moiraine.dimensional.com>
    Re: News scripts <gpeake@wt.net>
    Re: numbers in base 36 <uri@home.sysarch.com>
    Re: numbers in base 36 (Abigail)
        Regexp <john.wood@diamond.co.uk>
    Re: Regexp <jdf@pobox.com>
        SDBM in ActivePerl for Win32 : each() lose key/value <Alain.Coetmeur@wanadoo.fr>
    Re: SDBM in ActivePerl for Win32 : each() lose key/valu <eugene@verticalnet.com>
    Re: simple regular expression. (Abigail)
    Re: Thanks! and happy new year! (Andrew M. Langmead)
    Re: Thanks! and happy new year! (Bart Lateur)
    Re: the perl function split <MBalenger@worldnet.att.net>
    Re: the perl function split <rick.delaney@home.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 2 Jan 1999 20:29:16 GMT
From: "Michael Balenger" <MBalenger@worldnet.att.net>
Subject: ActiveState perldb and GNUemacs (NTemacs)
Message-Id: <76lvis$76c@bgtnsc02.worldnet.att.net>


Has anyone gotten GNUemacs 'gud' module to work with ActiveState perldb?
I've gotten GNUemacs to launch the debugger, and I can use the debugger to
run the debugger.  I have *not* gotten the debugger to functions (step-over,
step-into, set breakpoint, etc) to run under control of the GNUemacs 'gud'
module key bindings.  Any clues where to look?

Another clue -- I get a message "Can't open -emacs: No such file or
directory" in the emacs window.  Seems like emacs is trying to specify an
option to perldb that isn't understood.

Thanks,
Mike Balenger






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

Date: 02 Jan 1999 21:57:55 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: "Michael Balenger" <MBalenger@worldnet.att.net>
Subject: Re: ActiveState perldb and GNUemacs (NTemacs)
Message-Id: <m31zld8ka4.fsf@joshua.panix.com>

"Michael Balenger" <MBalenger@worldnet.att.net> writes:

> Has anyone gotten GNUemacs 'gud' module to work with ActiveState perldb?

I apologize for not addressing your question, and for using it to plug
the incredible ddd debugger, which works with perl (and with C, C++,
Java, and probably others as well).  Its perl support is new and
rough, but is already quite functional.  Check it out.

   http://www.cs.tu-bs.de/softech/ddd/

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


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

Date: 2 Jan 1999 21:00:14 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Bug in Modulo Operator?
Message-Id: <76m1cu$ck4$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Samuel Kilchenmann
<skilchen@swissonline.ch>],
who wrote in article <76l8cu$l5k3@news-sol.swissonline.ch>:
> Can somebody please check, what he/she gets as the result of the following:
> 
> $a = 32_730_968_896_115;
> print $a % 36, "\n";
> print $a - int($a / 36) * 36, "\n";
> 
> On my ActivePerl Build 507 on a W95 notebook it prints:
> 35
> 23
> but it should print:
> 23
> 23
> 
> If this is "normal" Perl behavior: where can i find a
> description/specification of the differences in the precision limits
> between the modulo operator and "normal" arithmetic operations?

AFAIK, there is no *viable* documentation of % operator in perlop.
The behaviour of % (and - broken - Perl arithmetic as a whole) was,
however, often discussed on p5p and p6p mailing lists.  There is some
residual hope that Topaz (aka Perl6) may have reasonable arithmetic,
but most probably Perl v5 never will (since apparently nobody - except
me - cares).

Currently one cannot expect any *reliable* result from operations with
some operands above 2^31 on 32-bit-compiled Perl.

Ilya


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

Date: Sat, 2 Jan 1999 16:39:01 -0500
From: "Robby Black" <rblack@gar.net>
Subject: Can perl preform an server side post through SSL?
Message-Id: <76m49b$1fd$1@news3.icx.net>

I am working on an e-commerce site that must post credit card info through
https:// to an authorization center for processing.  Can a ssi script use
SSL to post to a remote server?

Thanks for the help..

Robby




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

Date: 2 Jan 1999 21:07:38 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Converting globs to regexes (was: wildcard)
Message-Id: <76m1qq$dr1$2@client3.news.psi.net>

Russ Allbery (rra@stanford.edu) wrote on MCMXLIX September MCMXCIII in
<URL:news:ylww37o5ut.fsf_-_@windlord.stanford.edu>:
++ 
++ 
++ I wrote this for the MJ2 project a while back, and although it isn't very
++ well tested, I keep meaning to wrap a module around it.  This has the
++ advantage over your solution that it correctly handles {..,..} csh-style
++ expressions, handles [^]*] correctly, and handles escapes.
++ 
++ # WARNING: Untested code.
++ { 
++     my ($escape, $or, $class);
++     sub convert {
++         local $_ = shift;
++         if ($escape)       { $escape = 0; return '\\' . $_    }
++         elsif ($_ eq '\\') { $escape = 1; return ''           }
++         elsif ($_ eq ']')  { $class--; return $_              }
++         elsif ($class = 2) { $class-- if $_ ne '^'; return $_ }
                         ^ Shouldn't that be == ?
++         elsif ($class)     { return $_                        }
++         elsif ($_ eq '[')  { $class = 2; return $_            }
++         elsif ($_ eq '*')  { return '.*'                      }
++         elsif ($_ eq '?')  { return '.'                       }
++         elsif ($_ eq '{')  { $or = 1; return '('              }
++         elsif ($_ eq '}')  { $or = 0; return ')'              }
++         elsif ($_ eq ',')  { return $or ? '|' : $_            }
++         else               { return quotemeta $_              }
++     }
++ }
++ $regex = join ('', map { convert $_ } split (//, $glob));


I miss the special handling of files starting with a '.'. The shell wildcard
'*' wouldn't return ".foo", but that's matched by '.*'.


Abigail


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

Date: Sat, 2 Jan 1999 13:03:52 -0500
From: "Webmaster" <webmaster@somewhere.com>
Subject: Re: Crypt()
Message-Id: <76lmvu$vjq$1@nd.eastky.net>

Thanks.  This is what I was looking for.

I have (or will have) a file of users:crypted_passwords.  I wanted a way to
compare an entered password against the file.  This way looks like it will
work great for what I have in mind.

Groovy94 <groovy94@aol.com> wrote in message
news:19990101125449.11156.00005107@ng100.aol.com...
>The way I have always checked a submitted password against the already
crypted
>one is to  crypt the input one and then do an "unless" statement. Example:
>
>$cypted_pass=crypt($INPUT{password}, aa);
>
>unless ($crypted_pass eq $real_pass) {
>       do something
>}
>Regards,
>Gil Hildebrand, Jr.
>Dynamic Scripts
>
>Email: groovy94@aol.com
>ICQ UIN: 16678754




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

Date: Sat, 2 Jan 1999 10:55:57 -0800
From: "Wesley Cho" <wcho@neopage.net>
Subject: dynamic default page and file extenstion
Message-Id: <368e6aec.0@news1.ibm.net>

Hi there...

I am using Apach webserver, Perl 5 and Msql for database driven web site,
and have a problem with default page.

I need to create a dynamic default page for a website using perl and CGI.
When I create a page and named default.cgi, it is not recognized by the ULR
http://www.mywebsite.com.  So what I did was create a page default.htm, and
inserted a

1) http-equiv="refresh" with 1 sec update to a new page
http://www.mywebiste.com/default.cgi
2) javascrpt document.location = "default.cgi"

Above methods works with IE, but it is not working with Netscape or Opera
browser.  Isn't there a trick or method to make my default.cgi to loaded
when user type http://www.mywebsite.com?  When you type
http://www.mywebsite.com/default.cgi - it works just fine, but I cannot
assume that end-users will to that when they are looking for my site.

Thank you for any pointers..
Wesley




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

Date: 2 Jan 1999 19:09:26 GMT
From: groovy94@aol.com (Groovy94)
Subject: Re: dynamic default page and file extenstion
Message-Id: <19990102140926.00798.00006123@ng-fv1.aol.com>

Well, I am not 100% sure, but you should be able to change a file on your
server that would allow that as a possible default extension. You most likely
don't have access to that file, but if you kindly ask your system
administrator, I'm sure he could help by including default.cgi asa possible
default file for your particular server.


Regards,
Gil Hildebrand, Jr.
Dynamic Scripts

Email: groovy94@aol.com
ICQ UIN: 16678754


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

Date: Sat, 2 Jan 1999 21:03:46 +0100
From: "Philip Class" <philip.class@popcorn-studio.ch>
Subject: Re: Homepage- Search Engine with ASP or PERL ?
Message-Id: <76lv71$fqk$1@bw107zhb.bluewin.ch>

Hi Clay,

The ICE Search Engine is nearly perfect.
I've even indexed now my activeperl html-documentation, so I can browse for
keywords.
I first had a few prob's by defining the directoriy paths, but finally I
succeeded.
The only disadvantage I see is the inflexibility in changing the layout of
the output-list (with search results).
As the header and body of it are created in PERL ( in a ....pl file) , I
unfortunately can't use a html editor like frontpage to alter the design of
that list.
Therefore I would have prefered a ASP-Sollution (maybe with new capabilities
of PERL SCRIPT).

Thanks,

Philip




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

Date: 2 Jan 1999 19:57:13 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: Re: How does scope play in require? Testcode included
Message-Id: <76ltmp$n2i@bgtnsc03.worldnet.att.net>

>>does the library get unloaded within each block?
>I wouldn't think so. "require" is pretty much global.
>But "required" files are loaded only once.


Yep you're right, just out of curiosity, I did the code below and found I
could access the subroutines anywhere after a require. I really would like
to remove the overhead of libraries when no longer needed. I saw some code
in one of my books on dynamically removing subroutines during runtime. I
will be curious to see if this will also kill off the required files within
the sub. Does anone know of any other way to pull off what I am suggesting?

Thanks for the input,

CT

scopetest.cgi
#!/usr/bin/perl
print "Content-type: text/html\n\n";

require "/home/cgs/cgi-bin/library/libone.pl";
&get_textrowone();
&test_scope2();
&test_scope3();

sub test_scope2{
require "/home/cgs/cgi-bin/library/libtwo.pl";
&get_textrowtwo(); }

sub test_scope3{
require "/home/cgs/cgi-bin/library/libthr.pl";
&get_textrowthree(); }

# here we try to access all three subs
&get_textrowone();
&get_textrowtwo();
&get_textrowthree();

libone.pl
sub get_textrowone{ print qq~library one reporting<br>~; }
1;

libtwo.pl
sub get_textrowtwo{ print qq~library two reporting<br>~; }
1;

libthr.pl
sub get_textrowthree{ print qq~library three reporting<br>~; }
1;





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

Date: Sat, 2 Jan 1999 18:11:32 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: how to debug perl programs?
Message-Id: <F4y2J8.KnJ@world.std.com>

vivekvp@hotmail.com writes:

>i have a site hosted on a server.  i upload the scripts from my home computer
>and then try to execute them from my server - through my web pages.  of
>course i always get the old "internal server error" screen.

>1.  can i debug the program fromt he server - it gives very limited error
>messages - premature end of script

Your HTTP server may be keeping track of perl's error messages, even
if it isn't showing them to the user. Most likely in its log
files. Check the documentation that comes with your server and with
your system administrators on how to access the servers logs.

Also, the CGI.pm module has a special mode in which all the error
messages get sent to the browser.

      use CGI::Carp qw(fatalsToBrowser);

>2.  can i run the perl program from machine at home - and catch errors before
>i upload it?  if so, how?

Oh yes, sure. There are ports of perl to various operating systems in
<URL:http://www.perl.com/CPAN/ports/> (I'd point you more specifically
to the appropriate one, but you don't mention which operating system
you use on your machine at home.)

Again, the CGI.pm module helps with testing too. If it sees that it is
not running from an HTTP server, it will look for its argument from
either the commmand line or from the keyboard.

>i would like to install perl (however i do that) on my home machine, write
>then debug it with a perl debugger, then upload it to my server.  does this
>sound right?

Yes, no problem at all.
-- 
Andrew Langmead


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

Date: Sun, 3 Jan 1999 00:11:21 +0400
From: "wayne clerke" <clerke@emirates.net.ae>
Subject: Re: Installing pm files for Perl Win32
Message-Id: <76luhi$i6v$1@nntp.or.nw.verio.net>


Pep Mico <pep_mico@hp.com> wrote in message news:367A9351.FCEAF5A1@hp.com...
>Just run ppm.pl script.
>
>I'll recommend you read the ppmproxy.htm that comes with documentation if
you
>use a Proxy firewall to have Internet connection. If you use it just type
>
>set HTTP_PROXY=http://your-proxy:8088

Saw this stated twice here by different people ... it should be
http://your-proxy:your-proxy-port/, of course

>
>then run ppm.pl and you should select the command to install modules, like
>"Install win32::filesecurity" that will isntall the FileSecurity module in
your
>computer.

This should be "install win32-filesecurity" (without the quotes), also.

regards,
Mail: clerke@emirates.net.ae                  Voice: +971 506 43 4853
PGP key id: AEB2546D  F/P: D663D11EDA19D74F5032DC7EE001B702
PGP key id: 57AA1C10  F/P: 9926BF8918B7EB3623A7 AFA46572C5B857AA1C10
If you're not living on the edge, you're taking up too much space.






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

Date: Sat, 2 Jan 1999 19:23:37 +0100
From: "Alain Coetmeur" <Alain.Coetmeur@wanadoo.fr>
Subject: Re: locating module GDBM_File
Message-Id: <76lo2s$rms$3@platane.wanadoo.fr>


Randy Kobes a icrit dans le message ...
>On Sun, 27 Dec 1998 00:46:36 GMT,
> Jarle H Knudsen <no.unsolicited.mail.please@jarle.com> wrote:
>>I'm having a hard time locating the GDBM_File module on CPAN. Can
>>someone please advise me?
>>(I'm using "perl, version 5.005_02 built for MSWin32-x86-object".)


>   I assume that's the ActiveState build - according to their web
>site, GDBM, NDBM, and ODBM don't build on Win32. DB_File does though,
>which I believe is available thru ActiveState's ppm (Perl Package
>Manager), or thru installing on your own with the sources.
>   Alternatively, if you really need it, you might try compiling
>perl with the cygwin tools, which may allow GDBM to be built.


are you sure ther exist another *DBM implementation on
active perl fpr win32 than the SDBM.

I've found deadly bug on SDBM
(each() forget 70% of the key I put in)
and I'm eager to find a *DBM that work...

do you mean I should try GDBM or DB_File

what is DB_File



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

Date: Sat, 02 Jan 1999 13:34:16 -0500
From: Ed Finch <efinch@cais.com>
Subject: Re: Make Gif/jpeg file
Message-Id: <368E66A8.22A03AB2@cais.com>

"M.E. Post" wrote:
> 
> Use the GD module and read the documentation. It's very clear and it gives
> some insightful examples of the possibilities of the module. I used it
> myself to create an on the fly thermometer from a template picture and a
> calculated rectangular-filling based on a texture.

ClGraph and Sarge both do this. See my website,
http://www.vais.net/~efinch


Regards,
Ed
--
   Q: Why do PCs have a reset button on the front?
   A: Because they are expected to run Microsoft operating systems.


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

Date: Sat, 02 Jan 1999 19:45:59 GMT
From: pcbrady@hotmail.com
To: jdriller@usit.net
Subject: Re: Need Shopping Cart for web...Newbie
Message-Id: <76lt1n$6j2$1@nnrp1.dejanews.com>

Jen,

Try PerlPad by Ayersoft...a good product that allows you to create Shopping
Carts while knowing very little about Perl. They have an eval version at

http://www.ayersoft.com/perlpad/index.shtml

email me with questions...also tell em I sent ya.

-p

In article <3689c1f9.21520417@news.usit.net>,
  jdriller@usit.net wrote:
> I know practically nothing about Perl. (MIS background) I need a
> shopping cart program. Have heard of PerlShop and Mini Vend, but I
> need help. Anyone used these? How do I get started? What do I need?
> Any help greatly appreciated!!!!
>
> Jen @ www.bellboytech.com
>

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


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

Date: Sat, 02 Jan 1999 17:01:58 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Never seen this error before?
Message-Id: <368E52C5.F45B17B0@home.com>

[posted & mailed]

Jonathan Stowe wrote:
> 
> A useful tip when you are getting messages that you dont understand is 
> to use the diagnostics module i.e.
> 
>    use diagnostics -verbose;
> 
> this will cause the full perldiag entry to be emitted as well as the 
> usual message.  There is some anecdotal evidence that this might not 
                                ^^^^^^^^^^^^^^^^^^
> work with ActivePerl but I havent tried it so I cant comment.
                                                ^^^^^^^^^^^^^^
But you just did!  :-)

FYI, it works fine for the following build of ActivePerl.

# perl -v

This is perl, version 5.005_02 built for MSWin32-x86-object

Copyright 1987-1998, Larry Wall

Binary build 508 provided by ActiveState Tool Corp. 

And here is a small script to prove it:

#!/usr/local/bin/perl 

use diagnostics;
print $foo;

Name "main::foo" used only once: possible typo at temp.pl line 4 (#1)
    
    (W) Typographical errors often show up as unique variable names.
    If you had a good reason for having a unique name, then just mention
    it again somehow to suppress the message.  The use vars pragma is
    provided for just this purpose.
    
Use of uninitialized value at temp.pl line 4 (#2)
    
    (W) An undefined value was used as if it were already defined.  It 
    was interpreted as a "" or a 0, but maybe it was a mistake.  To 
    suppress this warning assign an initial value to your variables.

The very first thing I ever tried to run with ActivePerl was an old
script that suddenly produced a warning I'd never seen before.  I just
put 'use diagnostics' at the top of my program and all was revealed.

How's that for _anecdotal evidence_ that shows this feature is alive and
well in ActivePerl?  I hope it will also encourage people to follow your
advice.

-- 
Rick Delaney
rick.delaney@shaw.wave.ca


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

Date: Sat, 2 Jan 1999 18:15:32 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: New posters to comp.lang.perl.misc
Message-Id: <F4y2px.M7n@world.std.com>

bart.lateur@skynet.be (Bart Lateur) writes:

>If you only ask questions, you'll have a high OCR. If you only do
>follow-ups, and answer questions in a concise way (answers as short as
>the question), you'll have a rather low OCR.

It also depends on how little or how much you quote of the original post.
-- 
Andrew Langmead


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

Date: 02 Jan 1999 15:03:57 -0700
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: New to perl
Message-Id: <m3pv8xgwmq.fsf@moiraine.dimensional.com>

bart.lateur@skynet.be (Bart Lateur) writes:

> Where are the hashes?

Good question.  I missed hashes entirely.

> My top 2:
> 
> 	hashes AKA associative arrays
> 	regular expressions
> 
> Also very nice: the possibility to pass any number of arguments to a
> function.

It would be easy to sit and sing perl's praises all day, but it
probably would be more instructive to identify things that perl
could do better.  Here's my list of things that I would like to
see improved.

0-  Distributable applications

My biggest complaint about perl is the difficulty in distributing
applications written in perl.  All I can do is hope that the site
that wants to use my code has perl installed, that it was installed
by someone with at least some semblance of clue, and that it has
the proper versions of the modules that I'm using.  Needless to say,
at least one of these becomes a problem almost every time that I
move a perl program to a new system.

pl2exe (which, IIRC, is windows-only) is the right idea, but it isn't
open source and it doesn't work on modern systems.

1-  Documentation

We have better documentation than almost any other open source
project.  Better doesn't mean great, though.  The documentation
is too hard to navigate, too verbose, and too disorganized.  It
is trivially easy to find what you need after you've become 
familiar with our docs, but for newbies the information is, in
many respects, almost completely inaccessible.

There are several things that would help improve perl's docs.  The
first is a restructuring of the current material into better defined
`levels'.  Splitting the documentation into tutorials, intermediate
explanations, and detailed documentation of the internal workings of
the language would be a good thing.  mjd's new reftut and Tom's
opentut (is this the document bound to become iotut?) are a good step
in this direction.  It would be nice if somebody would write regextut.

Another thing that would help is a better markup system than pod.
pod's chief benefit is simplicity, unfortunately that simplicity comes
at a cost.  We cannot pack information into our docs as intensively as
we would like.  Things such as a coherent cross-reference and
hypertext system are extraordinarily difficult with pod.  We're
probably stuck with the basic system, though, because it would take
far too much effort to completely rewrite all existing module
documentation.

2-  Development Model

The final thing about perl that I think needs to be corrected isn't
something to do with the language itself.  It's about the process by
which perl is created and corrected.

It seems to me that projects such as gtk and enlightenment generate
far more excitement among their developer and user communities than
perl does.  I believe that a lot of this can be attributed to the
constant availability of the absolute latest source trees.

Allowing CVS access to the source tree would give us all sorts of
benefits both in the short and long run.  

First, it would allow more people to play with the latest
developments.  Right now only a small number of people have
access to the perforce repository.  This leaves the vast 
majority of perl's user base out in the cold.  I know that
there have been regex enhancements and Configure fixes since
_54 was released, but those are still invisible to most of
us.  Needless to say, they aren't being tested much right now.

Releases would be easier to manage under a CVS system.  Rather than
having dozens of different releases with easy to understand identifiers
such as perl5.006_78pre1trial53dev-attempt1587 we could simply have
the CVS tree, beta releases, and production releases.  We probably
wouldn't have to worry about vendors shipping versions of perl that
aren't meant for the general public ever again.

The biggest benefit to opening up the development model even more,
though, is the excitement that it creates among the developer and user
community.  It's easier to get excited, and stay excited, about a
project that is visibly changing than it is to be excited about a
project with long release cycles.  Of course, anything that makes the
developers more excited about hacking on perl is going to be good for
the language in the long run.

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


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

Date: 02 Jan 99 14:26:52 -0600
From: "Gary Peake" <gpeake@wt.net>
Subject: Re: News scripts
Message-Id: <837.671T2644T8664668gpeake@wt.net>

stanley@skyking.OCE.ORST.EDU scribed to us about Re: News scripts in
comp.lang.perl.misc

>In article <MPG.10f5cb251407b257989682@news.slip.net>,
>Spawn <spawn90@my-dejanews.com> wrote:

>>I need a script that can post time, date, updater
>>name, and news of course. I've been using News Update 1.1 but I
>>don't  like it. Thanks in advance!

>So you want an NNTP server? INN.

No, he is looking for a cgiprogram as I am that will allow one to post
a news page on their website and easily update that page from a web
browser. I have looked at News Update as well as NewsDesk.

Neither does what I want, which is ease of use and a nicely generated
page.

--
Gary Peake    PLEASE NOTE NEW EMAIL ADDRESS!!

Team AMIGA - OwlNet Net
gary@owlnet.net
http://www.owlnet.net (coming soon)



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

Date: 02 Jan 1999 13:16:51 -0500
From: Uri Guttman <uri@home.sysarch.com>
Subject: Re: numbers in base 36
Message-Id: <x7yanlee0c.fsf@home.sysarch.com>

>>>>> "Sac" == Smith and cat <inwap@best.com> writes:

  Sac> In article <x7iuf8mye3.fsf@sysarch.com>, Uri Guttman  <uri@sysarch.com> wrote:
  >> no it doesn't!

  Sac> Sorry, Uri, your solution does not work either.

i did have a bug in one version and you quote that version. it was
corrected by me and others a long time ago. in haste i put $base instead of
$multi in there. i was fixing someone else's version while doing that.

  Sac> And whose idea is it to process the number right to left?  That's crazy.
  Sac> The proper way to it is left to right.
  Sac> 	-Joe

i did it my way for speed. the while/chop code is faster than the
split/foreach loop. randal schwartz even had a faster version.

why don't you benchmark the versions as seen the difference.

here are results i just ran:

Benchmark: timing 4096 iterations of joe, matt, randal, uri...
       joe: 14 secs (13.03 usr  0.00 sys = 13.03 cpu)
      matt:  6 secs ( 6.26 usr  0.00 sys =  6.26 cpu)
    randal:  4 secs ( 3.55 usr  0.00 sys =  3.55 cpu)
       uri:  5 secs ( 5.08 usr  0.00 sys =  5.08 cpu)
   
so your better code is by far the slowest. all these work properly but
with different algorithms. check up the whole thread before your make
comments like "The proper way to it is left to right."

uri

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


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

Date: 2 Jan 1999 20:59:56 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: numbers in base 36
Message-Id: <76m1cc$dr1$1@client3.news.psi.net>

Smith and cat (inwap@best.com) wrote on MCML September MCMXCIII in
<URL:news:76ko6p$l7$1@shell3.ba.best.com>:
++ In article <75oq7s$7ne$1@client3.news.psi.net>,
++ Abigail <abigail@fnx.com> wrote:
++ >Here's a one liner, with no need for Perl:
++ >$ echo "obase = 789; 123 ^ 456" | bc
++ 
++ OK, which version of Unix have BC_BASE_MAX greater than 99?
++ The POSIX standard won't allow obase to be three digits.
++ The above command fails with "output base is too large" even on
++ the 64-bit Solaris-7.


$ uname -a
SunOS alexandra 5.7 Generic sun4u sparc
$ bc --version
bc 1.04
Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
$


HTH. HAND.


Abigail


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

Date: Sat, 2 Jan 1999 16:13:34 -0000
From: "Paul Wood" <john.wood@diamond.co.uk>
Subject: Regexp
Message-Id: <76m08e$tn$1@nclient3-gui.server.ntli.net>

For some reason (probably obvious, but not to me) this regexp isn't doing
what i'd like it to:

s/(http:\/\/[\w\-.]+\.[a-zA-Z]{2,3}([\w\-.\/~]+)?)/<a href="$1"
target="_top">$1<\/a>/gi;

It should find any http:// urls and turn them into links. That it does fine,
but it's also allowing urls like this:

http://www.domain.illegalsuffix

Which the \.[a-zA-Z]{2,3} is there to prevent. Any ideas on where i'm going
wrong?

Thanks,

-Paul.




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

Date: 02 Jan 1999 22:34:02 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: "Paul Wood" <john.wood@diamond.co.uk>
Subject: Re: Regexp
Message-Id: <m3yanl741h.fsf@joshua.panix.com>

"Paul Wood" <john.wood@diamond.co.uk> writes:

> s/(http:\/\/[\w\-.]+\.[a-zA-Z]{2,3}([\w\-.\/~]+)?)/<a href="$1"
> target="_top">$1<\/a>/gi;
> 
> It should find any http:// urls and turn them into links. That it
> does fine, but it's also allowing urls like this:
> 
> http://www.domain.illegalsuffix
> 
> Which the \.[a-zA-Z]{2,3} is there to prevent. Any ideas on where
> i'm going wrong?

{2,3} does indeed match either 2 or 3 instances of the preceding
character class, but then you go and allow one or more \w characters
to immediately follow.  You could do what you intend with a zero-width 
negative lookahead:

   # match "fo" or "foo" but not "fooo"
   /fo{1,2}(?!o)/;

Also, you may wish to avoid all of those backwhacks by using a
different regex delimiter.

   s!/some/(path)!$1!g;

Finally, ([foo]+)? is better spelled [foo]* . 

No, not finally.

There's the problem that you're being very persnickety about the end
of a given ostensible address, but you're promiscuous with the
beginning.  Your regex will happily match

  http://w.w.w.w.w..-....w-w-www....w..com/whatever

Is that what you really mean?  Have you read perlre and perlop
cover-to-cover, so to speak?

HTH, HNY!

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


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

Date: Sat, 2 Jan 1999 19:09:32 +0100
From: "Alain Coetmeur" <Alain.Coetmeur@wanadoo.fr>
Subject: SDBM in ActivePerl for Win32 : each() lose key/value
Message-Id: <76lo28$rms$2@platane.wanadoo.fr>

I'm using SDBM tied hashes in ActivePerl (508)
I've discovered that SDBM does forget many keys
with each()

I've 32000 key value (less that 20 char for key and value )
and only 12000 are enumerated by each

for a given key $k0
defined $rubrique{$k0}
can be true

yet
while(($k,$r)=each(%rubrique))
{
}
never find it !

I tie my hashed so:

use SDBM_File;
tie(%rubrique, 'SDBM_File', "$basedir\\rubrique", O_RDWR|O_CREAT, 0640);


I've read something   about O_BINARY

but

use Fcntl;
tie(%rubrique, 'SDBM_File', "$basedir\\rubrique", O_RDWR|O_CREAT|O_BINARY,
0640);

does not work either.

how to make SDBM work ?
is ther another simple database that I can use
for my programs that use tied hashes ?




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

Date: Sat, 02 Jan 1999 14:56:48 -0500
From: Eugene Sotirescu <eugene@verticalnet.com>
To: Alain Coetmeur <Alain.Coetmeur@wanadoo.fr>
Subject: Re: SDBM in ActivePerl for Win32 : each() lose key/value
Message-Id: <368E7A00.4712E96A@verticalnet.com>

I've been using this successfully (under Linux).

use Fcntl;
use SDBM_File;
use strict;

 . . . . . .
&make_db_hash($separator, \@fields_to_index);

 . . . . . .

sub make_db_hash {
  my ($this_separator,$r_fields_to_index) = @_;
  my ($field_to_index, $line, @line_records, $line_record, $search_key,
$line_number);
  open DBH, $DATA_FILE or die "Can't open $DATA_FILE:$!\n";
  flock (DBH, 2);
  foreach $field_to_index (@$r_fields_to_index) {
    # we're using the name of the field to name the DB files too
    # For ex, if we're indexing a surname field,
    # the DB files are going to be called surname.dir and surname.pag
    tie (%db_hash, 'SDBM_File', $field_to_index, O_RDWR|O_CREAT, 0640);
    while (defined ($line = <DBH>)) {
      #@line_records = split (/\s*$this_separator\s*/, $line);
      $search_key = lc($field_to_index);
      $line_number = $.;
       #make search key unique
      $search_key = "$search_key#$line_number";
      $db_hash{$search_key} = $line;
    }
  close DBH;
  untie %db_hash;
  }
}



Alain Coetmeur wrote:

> I'm using SDBM tied hashes in ActivePerl (508)
> I've discovered that SDBM does forget many keys
> with each()
>
> I've 32000 key value (less that 20 char for key and value )
> and only 12000 are enumerated by each
>
> for a given key $k0
> defined $rubrique{$k0}
> can be true
>
> yet
> while(($k,$r)=each(%rubrique))
> {
> }
> never find it !
>
> I tie my hashed so:
>
> use SDBM_File;
> tie(%rubrique, 'SDBM_File', "$basedir\\rubrique", O_RDWR|O_CREAT, 0640);
>
> I've read something   about O_BINARY
>
> but
>
> use Fcntl;
> tie(%rubrique, 'SDBM_File', "$basedir\\rubrique", O_RDWR|O_CREAT|O_BINARY,
> 0640);
>
> does not work either.
>
> how to make SDBM work ?
> is ther another simple database that I can use
> for my programs that use tied hashes ?



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

Date: 2 Jan 1999 21:29:46 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: simple regular expression.
Message-Id: <76m34a$dr1$3@client3.news.psi.net>

Rahul K (rahulk@iname.com) wrote on MCMXLIX September MCMXCIII in
<URL:news:368D4184.85A81FD@iname.com>:
++ 
++ Hi,
++ I am a newbie.
++ I have a string stored in $in{"fField".
++ I need to convert the string  (please notice the dot at the end)
++ 
++ <http://www.foo.com/abc.html>.
++ into
++ <a href="http://www.foo.com/abc.html">http://www.foo.com/abc.html</a>.
++ 
++ and
++ 
++ <http://www.foo.com/abc.html>
++ into
++ <a href="http://www.foo.com/abc.html">http://www.foo.com/abc.html</a>
++ 
++ 
++ here is my script:
++ 
++ $in{"fField"} =~ s/(http:\/\/\S+)(.*)/ <a href=$1
++ target=\"_blank\">$1<\/a> $2/g;
++ 
++ the problem with this is that after I run the script, I get the
++ following (notice that the dot is *inside*)
++ 
++ <a href="http://www.foo.com/abc.html.">http://www.foo.com/abc.html.</a>


Funny, I get something else:

< <a href=http://www.foo.com/abc.html>. target="_blank">http://www.foo.com/abc.html>.</a>


Given the delimiters < and > (which on themselves cannot appear in URLs),
why is the trailing dot causing you problems?

        s{<([^>]*)>}{<a href = '$1' target = '_blank'>$1</a>}

would do it, right?



Abigail


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

Date: Sat, 2 Jan 1999 18:32:13 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Thanks! and happy new year!
Message-Id: <F4y3Hp.4xH@world.std.com>

TRG Software <chatmaster@c-zone.net> writes:

>Are you sure you have the right NG!? :-)

I hope not, despite common complaints about certain people being
unhelpful, or about everyone being unhelpful, many people (including
myself) try to find questions that we might have answers to. We find
documentation that might be useful to the poster. We try to give
helpfule advice. We write (and test) example scripts. Basically, make
some sort of effort to help people over their current stumbling block.

Is that being helpful? I hope so. (I can't be sure, since over the
years I get fewer and fewer "thank you" messages e-mailed to me. Maybe
my posts aren't reaching anyone? Maybe my ISP isn't really sending out
all the messages I write. Maybe I'm getting ripped off, assuming
they're sending stuff that they really aren't.) 

If what I'm doing isn't helpful to anyone, let me know and I'll find
better things to do with my time.

-- 
Andrew Langmead


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

Date: Sat, 02 Jan 1999 19:47:35 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Thanks! and happy new year!
Message-Id: <369077a5.1244875@news.skynet.be>

Andrew M. Langmead wrote:

>If what I'm doing isn't helpful to anyone, let me know and I'll find
>better things to do with my time.

Well *I* think what you're doing is helpful.

	Bart.


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

Date: 2 Jan 1999 18:35:26 GMT
From: "Michael Balenger" <MBalenger@worldnet.att.net>
Subject: Re: the perl function split
Message-Id: <76lote$f2t@bgtnsc02.worldnet.att.net>

Post a larger section of code, and a sample of the data.  What are you
trying to mean by $chunks[0]?

The following code may help (of course, I assumed a (possibly incorrect)
interpretation of your one line fragment):

@line_list = <>;
foreach $line (@line_list) {
    chomp $line;
    @fields = split(/|/, $line);
    $first_field = $fields[0];
    push @first_column_list, $first_field;
}





IMO, you probably want something like this:
@chunks = <>;
foreach $this_chunk (@chunks) {

Marco Vlemmings wrote in message <367673C8.F41F6F27@ctrl-v.nl>...
>Hi,
>
>I have a problem with the function 'split'.
>I want to split a ascii file.
>Here is the piece of code.
>@rows = split (/\|\n/,$chunks[0]);
>In the array rows will be split by the two caracters pipe and carrage
>return, but it does not split at all.How can i split on a carrage
>return?
>
>Can anybody help me.
>
>With kind regards
>
>Marco Vlemmings
>email: marcov@ctrl-v.nl
>
>




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

Date: Sat, 02 Jan 1999 18:52:56 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: the perl function split
Message-Id: <368E6CD1.4539F5C1@home.com>

[posted & mailed]

Michael Balenger wrote:
> 
> Post a larger section of code, and a sample of the data.  What are you
> trying to mean by $chunks[0]?
> 
> The following code may help (of course, I assumed a (possibly 
                                                       ^^^^^^^^
                                                       probably
> incorrect) interpretation of your one line fragment):
> 
> @line_list = <>;
> foreach $line (@line_list) {
>     chomp $line;
>     @fields = split(/|/, $line);

If splitting on '|', you must escape it since it is a regex
metacharacter.

    @fields = split /\|/, $line;

'|' is not a special character in a character class, though, so another
way would be:

    @fields = split /[|]/, $line;

This might be what the original poster is looking for if he wants to
split on '|' or newline.

    @fields = split /[|\n]/, $line;

Probably not, though since he says, "split by the two caracters pipe and
carrage return".  To do this he would want:

    @fields = split /\|\r/, $line;

though I doubt that's what he's really looking for.

Maybe your answer is what he wants after all.  ;-)

-- 
Rick Delaney
rick.delaney@shaw.wave.ca


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

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


Administrivia:

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

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

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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

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

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


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

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