[8807] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2424 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Apr 26 23:18:33 1998

Date: Sun, 26 Apr 98 20:00:26 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 26 Apr 1998     Volume: 8 Number: 2424

Today's topics:
    Re: $100 - PERL NEWSGROUP POSTER <gwynne@utkux.utk.edu>
    Re: books for learning perl (Martien Verbruggen)
    Re: books for learning perl <jeff@webdesigns1.com>
    Re: books for learning perl <gwynne@utkux.utk.edu>
        Can't find certain libraries in path (Salvatore Sferrazza)
    Re: Changing @INC (Martien Verbruggen)
    Re: Defending Perl <rpsavage@ozemail.com.au>
    Re: http Reg Exp (Martien Verbruggen)
    Re: Image can view but cannot SAVE? (Martien Verbruggen)
    Re: image size for jpg and/or gif <rootbeer@teleport.com>
    Re: image size for jpg and/or gif <p-fein@uchicago.edu>
    Re: Parsing HTML ... <rootbeer@teleport.com>
    Re: Parsing HTML ... <gwynne@utkux.utk.edu>
        Perl and crypt command help please <jlippiner@iname.com>
    Re: Perl classes or training <gwynne@utkux.utk.edu>
    Re: Perl classes or training (Charles DeRykus)
    Re: Perl experts!! help me!! (Martien Verbruggen)
    Re: Perl experts!! help me!! <sowmaster@juicepigs.com>
    Re: Perl-only distribution (was Re: How do I build Linu (Peter Samuelson)
    Re: perl/gtk - any such thing? (Martien Verbruggen)
    Re: Problems with 'wait' under perl5.004 (Charles DeRykus)
    Re: Sorting nested lists in HTML <rootbeer@teleport.com>
    Re: Unique Sort <rootbeer@teleport.com>
    Re: Wanted: Your Perl Hacks (Martien Verbruggen)
    Re: Why doesn't this work? (Craig Berry)
    Re: Why doesn't this work? (Craig Berry)
    Re: writing to file on site (Martien Verbruggen)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Sun, 26 Apr 1998 22:02:48 -0400
From: "Bob Gwynne" <gwynne@utkux.utk.edu>
Subject: Re: $100 - PERL NEWSGROUP POSTER
Message-Id: <6i0p1u$88q$1@gaia.ns.utk.edu>

So you want a Perl newsgroup poster? Howabout a 3' x 4' poster with a
picture of Abigail wrapped in a regex?  She could even be swallowing a
newbie fish.

Bob Gwynne
University of Tennessee


Alexander Kovalenko wrote in message <35410C8A.7314FB15@abcpages.com>...
>willing to pay for program which would work like formmail , but not send
>e-mail , but rather post it to newsgroups..
>
>if you can help me... reply back...
>




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

Date: 27 Apr 1998 00:15:43 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: books for learning perl
Message-Id: <6i0inf$6j8$12@comdyn.comdyn.com.au>

In article <3541497A.482B27C6@netnet.net>,
	jason bass <jkbass@netnet.net> writes:
> hello i'm new to perl and i would like to know if there are any good
> books for learning perl
> i already have perl 5 for dummies but it seems the author wrote the book
> for people that
> are already familier with other programming languages.
> please help i want to learn so bad, it seems so interesting.

http://language.perl.com/info/documentation.html#books
http://language.perl.com/critiques/index.html

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Sun, 26 Apr 1998 17:42:07 -0500
From: "Jeff Oien" <jeff@webdesigns1.com>
Subject: Re: books for learning perl
Message-Id: <6i0d1o$3cu@newsops.execpc.com>

I have a site called Perl Primer which may be of some help:
http://www.webdesigns1.com/perl/
--
Jeff Oien, WebDesigns
http://www.webdesigns1.com/
jeff@webdesigns1.com

>hello i'm new to perl and i would like to know if there are any good
>books for learning perl
>i already have perl 5 for dummies but it seems the author wrote the book
>for people that
>are already familier with other programming languages.
>please help i want to learn so bad, it seems so interesting.
>thanks
>jason
>




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

Date: Sun, 26 Apr 1998 21:57:25 -0400
From: "Bob Gwynne" <gwynne@utkux.utk.edu>
Subject: Re: books for learning perl
Message-Id: <6i0ons$841$1@gaia.ns.utk.edu>

Try Perl 5 Interactive Course by Jon Orwant.  It will walk you through what
you need to know.

Bob Gwynne
University of Tennessee

jason bass wrote in message <3541497A.482B27C6@netnet.net>...
>hello i'm new to perl and i would like to know if there are any good
>books for learning perl
>i already have perl 5 for dummies but it seems the author wrote the book
>for people that
>are already familier with other programming languages.
>please help i want to learn so bad, it seems so interesting.
>thanks
>jason
>




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

Date: Mon, 27 Apr 1998 00:27:49 GMT
From: salvatore_sferrazza@baruch.cuny.edu (Salvatore Sferrazza)
Subject: Can't find certain libraries in path
Message-Id: <3543cf65.175636341@news.akula.com>

I am having some issues getting the lib-www modules working on my
server.

Since my ISP doesn't have all the libraries installed for what I want
to do, I have them under my home directory tree.  To accomodate for
this I put the following in my code:

use lib '/home2/salzie/lib/HTML-Parser-2.16/lib';
use lib '/home2/salzie/lib/libwww-perl-5.31/lib';
use lib '/home2/salzie/lib/libwww-perl-5.31/lib/blib';
use HTTP::Request::Common;
use LWP::UserAgent;

When I try and run the script I get the following message: 
Can't locate auto/LWP/UserAgent/_need_proxy.al in @INC (@INC contains:
/home2/salzie/lib/libwww-perl-5.31/lib/blib
/home2/salzie/lib/libwww-perl-5.31/lib
/home2/salzie/lib/HTML-Parser-2.16/lib
/usr/lib/perl5/i386-linux/5.00404 /usr/lib/perl5
/usr/lib/perl5/site_perl/i386-linux /usr/lib/perl5/site_perl .) at
/home2/salzie/lib/libwww-perl-5.31/lib/LWP/UserAgent.pm 

However when I do a:

find . -name _need_proxy.al -print

in my home directory I get:

 ./lib/libwww-perl-5.31/blib/lib/auto/LWP/UserAgent/_need_proxy.al

Anyone have any sugesstions or am I overlooking the obvious?

BTW, perl -v yields

This is perl, version 5.004_04 built for i386-linux

Copyright 1987-1997, Larry Wall

Perl may be copied only under the terms of either the Artistic License
or the GNU General Public License, which may be found in the Perl 5.0
source kit.


TIA,

Sal

=-=-Sa|zie-=-=
salzie@technojunkie.com


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

Date: 27 Apr 1998 01:26:39 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Changing @INC
Message-Id: <6i0msf$7j5$1@comdyn.comdyn.com.au>

In article <6huob9$t13$1@nntp2.ba.best.com>,
	"Grimes" <grimes@msn.com> writes:
> How do I change the default @INC list of paths?

# perldoc perlvar
/@INC
@INC    The array @INC contains the list of places to look
        for Perl scripts to be evaluated by the do EXPR,
        require, or use constructs.  It initially consists
        of the arguments to any -I command line switches,
        followed by the default Perl library, probably
        /usr/local/lib/perl, followed by ".", to represent
        the current directory.  If you need to modify this
        at runtime, you should use the use lib pragma to get
        the machine-dependent library properly loaded also:

         use lib '/mypath/libdir/';
         use SomeMod;
[snip]

# perldoc perlfaq
# perldoc perlfaq8
/How do I keep my own module/library directory?

While you're there, spend some time reading through the documentation.
It's really informative.

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Mon, 27 Apr 1998 11:17:49 +1100
From: Ron Savage <rpsavage@ozemail.com.au>
Subject: Re: Defending Perl
Message-Id: <3543CEAD.38C2@ozemail.com.au>

[snip]
> # people, this could be a big deal.  (For example, I can't put perl
> # scripts on a CD.)[snip]

What do you mean - You can't put Perl scripts on a CD?

I can. Here's one Unixish way:
1. Compile Perl to live in /tmp/myPerl, say.
2. Put Perl on the CD in /CDROM/myPerl.
3. (Later, ie upon 'installation') Scan all CD-ROMs looking for /CDROMx/myPerl, were x = (null, 0 .. 9).
4. Create links:
	o /tmp/myPerl/bin/ to /CDROMx/myPerl/bin/
	o /tmp/myPerl/lib/ to /CDROMx/myPerl/lib/
5. Update the Perl scripts you shipped on the CD-ROM:
	o Copy them to local hard disk
	o Change the first line to #!/tmp/myPerl/bin/perl -w if that's not how you shipped 'em
	o Add
BEGIN
{
	unshift(@INC,
'/tmp/gemexPerl/lib/IP20-irix/5.00404',
'/tmp/gemexPerl/lib',
'/tmp/gemexPerl/lib/site_perl/IP20-irix',
'/tmp/gemexPerl/lib/site_perl');
}

at the start of each script.

-- 
Cheers,
Ron Savage
Office: savage.ron.rs@bhp.com.au
Home (preferred): rpsavage@ozemail.com.au
Web: http://www.ozemail.com.au/~rpsavage


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

Date: 27 Apr 1998 01:42:08 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: http Reg Exp
Message-Id: <6i0npg$7ot$1@comdyn.comdyn.com.au>

In article <354346F0.CCC9CA0@cglis.com>,
	Chris Lambrou <archive@cglis.com> writes:
> Hello,
> 
> I'm writting a Perl based web interface for reading/sending email.
> I'm looking for a reg ex that will covert any http references
> such as:
> 
> http://www.some_domain.com
> 
> To the HTML equivalent of :
> 
> <a href="http://www.some_domain.com">http://www.some_domain.com</a>

Ok, can you explain to me again why you need a regex for this?

#!/usr/local/bin/perl -w
use strict;

my @urls = (
        'http://www.somewhere.com',
        'http://www.somewhere.com/index.html#aa',
        'ftp://ftp.somewhere.com',
        'mailto:archive@cglis.com'
);

foreach (@urls)
{
        print '<a href="', $_, '">', $_, '</a>', "\n";
}

> so that the reader of the email messgae can just jump to the URL within
> the browser. This is what I came up with (assuming $msg to be the body
> of the email
> message):

Oh, you mean you want to extract things that might be a url from some text?

> $msg =~ s!(ftp|https?)://([^\s]+)!<a href="$1://$2">$1://$2<\/a>!gsi;
> 
> 90% this works. The problem is that the above will match text that
> starts with
> ftp/http/https followed by :// up to the next white space character,
> so this breaks down if the URL is followed by a non word character such
> as comma,  a ">" or something else.

You can't, not reliably. A comma is a valid character in a url, so you
can't reliably discard it.

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: 26 Apr 1998 23:58:29 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Image can view but cannot SAVE?
Message-Id: <6i0hn5$6j8$9@comdyn.comdyn.com.au>

In article <3542fc5a.3951113@news3.newscene.com>,
	stevenchan69@hotmail.com (LM386) writes:
> ***sorry for the last question make confuse
> My question is:
> Image can view but cannot be saved by right click of the mouse in the
> www browser? 

And again: This question has absolutely nothing to do with perl. You
should really ask this on a web browser related group.

Go to one of the comp.infosystems.www.* groups (pick the most
appropriate one), and ask this there. They are much more likely to
know an answer. When you do ask there, it would be a good idea if you
added an example site where this happens. Also include information
about your browser.

But please, don't post this question to this group again. It really
deos not belong here.

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Mon, 27 Apr 1998 01:06:38 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Henry Wolff <admin@hatsoft.com>
Subject: Re: image size for jpg and/or gif
Message-Id: <Pine.GSO.3.96.980426180615.589C-100000@user2.teleport.com>

On Sun, 26 Apr 1998, Henry Wolff wrote:

> I am working on my postcard scripts and I need to be able to check the
> height and width of jpg and gif files before allowing people to submit
> pictures for their use in the postcards.

There's a module on CPAN which can do this. Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 27 Apr 1998 01:34:22 GMT
From: Peter A Fein <p-fein@uchicago.edu>
Subject: Re: image size for jpg and/or gif
Message-Id: <87ogxohwtd.fsf@bj2-64.rh.uchicago.edu>

Tom Phoenix <rootbeer@teleport.com> writes:

> There's a module on CPAN which can do this. Hope this helps!

I must admit, I either admire your patience or your programming
skill.  Do you actually do all these posts by hand, or did come up
with an automated response system?

Off topic, thanks (to Tom & all) for the help on an earlier question.

-- 
Peter Fein
1005 E. 60th St.
Chicago, IL 60637
773-834-6206
p-fein@uchicago.edu
http://pfein.home.ml.org/


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

Date: Mon, 27 Apr 1998 01:05:55 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Anas Mughal <anas@erols.com>
Subject: Re: Parsing HTML ...
Message-Id: <Pine.GSO.3.96.980426180508.589B-100000@user2.teleport.com>

On Sun, 26 Apr 1998, Anas Mughal wrote:

> Does anyone has a script to parse HTML?

If there were a module on CPAN which could do it, the module would be
found in the HTML hierarchy. Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Sun, 26 Apr 1998 22:22:21 -0400
From: "Bob Gwynne" <gwynne@utkux.utk.edu>
Subject: Re: Parsing HTML ...
Message-Id: <6i0q6j$8ro$1@gaia.ns.utk.edu>

Get the LWP modules from CPAN.

Bob Gwynne
University of Tennessee


Anas Mughal wrote in message <6i06fb$map$1@winter.news.erols.com>...
>Hi,
>Does anyone has a script to parse HTML?
>I need something very simple to extract all the headings and subheadings
>from an HTML document.
>Any leads would be appreciated.
>Thank you in advance.
>--
>Anas Mughal
>
>




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

Date: Sun, 26 Apr 1998 22:14:10 -0400
From: "Joshua Lippiner" <jlippiner@iname.com>
Subject: Perl and crypt command help please
Message-Id: <6i0psk$iog$1@winter.news.erols.com>

Hello.  I have been trying to implement a simple password, check password
function that is not working right using the crypt  command.  I am using
input from a web form.  The input line is this;

 $thing[3] = crypt($inputs{'Password'}, substr($inputs{'Password'}, 0, 2));

Where $thing[3] is then saved in a text file.  To check the password is have
this procedure;

# Subprocedure to delete WD Information
sub delete_WD  {
local(@thing) = @_;
$UID=$thing[0];
$PW=$thing[1];

open (FILE, "$file");
@lines = <FILE>;

 $j=0;
  foreach $linedata (@lines)
   {
 @line = split (/\|/,$linedata);
 $maybe_user = $line[0];
 $maybe_pw = $line[1];
 $test_passwd = crypt($PW, substr($maybe_pw, 0, 2));
 print "Test UID: $UID| Test PW: $PW|  --> $test_passwd|\n";
 print "Line: $j,  UID: $maybe_user| PW: $maybe_pw|\n\n";
       if ($test_passwd eq $maybe_pw && $UID eq $maybe_user)  # this is line
to check.
         { etc...

I also tried this for $test_passwd;
$test_passwd = crypt($PW, substr($PW, 0, 2));

but neither is working.  What can I do to make this type of thing work?

thanks

-josh

please respond to jlippiner@iname.com






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

Date: Sun, 26 Apr 1998 19:49:18 -0400
From: "Bob Gwynne" <gwynne@utkux.utk.edu>
Subject: Re: Perl classes or training
Message-Id: <6i0h7n$20b$1@gaia.ns.utk.edu>


Randal Schwartz wrote in message <8cbttqnhoh.fsf@gadget.cscaper.com>...
>>>>>> "Bryan" == Bryan Beske <beske@worldnet.att.net> writes:



>Sure, but have they written bestselling Perl books? :-)
>
Randal:
    Maybe I'm missing something here, but I don't understand your logic.
Although you have written a couple of Perl books and obviously know a lot
about Perl, does that necessarily mean that you are a better teacher of Perl
than someone who knows Perl, but has not written a book on the subject?
Perhaps you are but writing a book is not a necessary condition for
teaching.  Perhaps you are a better teacher than everyone else,
nevertheless, the logic does not hold.

Bob Gwynne
University of Tennessee




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

Date: Mon, 27 Apr 1998 00:52:24 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Perl classes or training
Message-Id: <Es1rrC.5BG@news.boeing.com>

In article <6i0h7n$20b$1@gaia.ns.utk.edu>,
Bob Gwynne <gwynne@utkux.utk.edu> wrote:
 >
 >Randal Schwartz wrote in message <8cbttqnhoh.fsf@gadget.cscaper.com>...
 >>>>>>> "Bryan" == Bryan Beske <beske@worldnet.att.net> writes:
 >
 >
 >
 >>Sure, but have they written bestselling Perl books? :-)
 >>
 >Randal:
 >    Maybe I'm missing something here, but I don't understand your logic.
 >Although you have written a couple of Perl books and obviously know a lot
 >about Perl, does that necessarily mean that you are a better teacher of Perl
 >than someone who knows Perl, but has not written a book on the subject?
 >Perhaps you are but writing a book is not a necessary condition for
 >teaching.  Perhaps you are a better teacher than everyone else,
 >nevertheless, the logic does not hold.
 >

Actually, the logic does hold here :)  Randal and Tom Christiansen 
are both superb teachers. Frankly, I was shocked too expecting 
that a certain level of Perl erudition would leave glazed eyes 
and mental meltdowns in a class.

Enthusiasm, clear presentations, excellent materials are their
hallmarks. I'm sure there are many other good Perl instructors 
elsewhere but why take a chance :)  

Cheers,
--
Charles DeRykus


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

Date: 27 Apr 1998 00:08:55 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Perl experts!! help me!!
Message-Id: <6i0ian$6j8$10@comdyn.comdyn.com.au>

In article <3543A8BF.21617431@findapp.com>,
	"X.T. Zircom" <f1@findapp.com> writes:

[snip]

First of all:

> I am sure findApp can help. Go to the CGI/Perl section and find there hips
> of tutorials, support and source code.

If you want to advertise your site, just do so, instead of giving
pseudo answers.

And another thing: What sort of braindead ordering system would come
up with a category called CGI/Perl? What does the one have to do with
the other? Do you guys even know what you're talkign about? Or do you
just get a bunch of links from a bunch of web sites without having an
inkling of a clue what it's all about?

And now, for the original question:

> Tau Kim wrote:
> 
>>  Hi, I'm a student studying computer science. And I've got in trouble
>> with this!
>>
>>  I'm writing a program which mesures the performance of the compiler.
>>  Underlying source is C source. I'm trying covert this source to java,
>> perl, cobol & etc
>>  But in other languages except C, I don't know how to mesure the time
>> during the loop is performed.

perl ships with a module called Benchmark, exactly for this sort of
task. It allows you to execute blocks of code and time them. 

# perldoc Benchmark

>     #include <dos.h>
>     #include <stdio.h>
[snip]
>                 gettime(&end);

As an aside: You do realise that this code is very unlikely to compile
on other platforms, or even with other compilers than the one you use?

HTH,
Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Sun, 26 Apr 1998 22:36:52 -0400
From: Bob Trieger <sowmaster@juicepigs.com>
To: Martien Verbruggen <mgjv@comdyn.com.au>
Subject: Re: Perl experts!! help me!!
Message-Id: <3543EF44.722F@juicepigs.com>

Martien Verbruggen wrote:
> 
> In article <3543A8BF.21617431@findapp.com>,
>         "X.T. Zircom" <f1@findapp.com> writes:
> 
> [snip]
> 
> First of all:
> 
> > I am sure findApp can help. Go to the CGI/Perl section and find there hips
> > of tutorials, support and source code.
> 
> If you want to advertise your site, just do so, instead of giving
> pseudo answers.
> 
> And another thing: What sort of braindead ordering system would come
> up with a category called CGI/Perl? What does the one have to do with
> the other? Do you guys even know what you're talkign about? Or do you
> just get a bunch of links from a bunch of web sites without having an
> inkling of a clue what it's all about?


This is an excerpt from their homepage.

findApp subjects : 

    Programming         Internet Servers 
     Java                IIS 
     JavaScript          ASP 
     VisualBasic         Apache 
     C++                 Netscape 
     COM/ActiveX         CGI/Perl 
    
They have absolutely no clue. Not only do they have a CGI/Perl category,
but they think it is a server.
    
    
     
-- 
Bob Trieger               |  Titanic: big boat, bigger
sowmaster@juicepigs.com   |           iceberg, big deal


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

Date: 26 Apr 1998 20:11:27 -0500
From: psamuels@sampo.REMOVETHIS.creighton.edu (Peter Samuelson)
Subject: Re: Perl-only distribution (was Re: How do I build Linux from stratch?? (w/o distribution of course!!))
Message-Id: <6i0lvv$63v$1@sampo.creighton.edu>

  [Shimpei Yamashita]
> > perl uses tcsh for globbing, so you will have to come up with a
> > stripped-down replacement that does csh-style globbing.
[David Lee Lambert <lamber45@EGR.msu.edu>]
> Where exactly does perl do globbing?

As mentioned, in the glob() function, normally called implicitly using
<globpattern> syntax.  Read "perldoc -f glob" for details.  Anyway, I
think Perl borrows sh to glob if csh is not available.

Also, Perl uses sh for system() (sometimes -- it also has a builtin
version depending on how you invoke it) and for open() on pipelines.
(And open() derivatives such as open3().)

> > More importantly, libc also calls /bin/sh in several locations
> > (most notably in some of the exec() family of calls),

Are you sure about exec*() using sh?  That sounds awfully expensive as
well as insecure.  (Not to mention the chicken/egg in sh itself.)

> > so you will also need to patch libc. (Does messing around with libc
> > scare you?  It should.)  It isn't as trivial as you might think.
> Aren't unexpected calls to sh from obscure places rather the
> definition of a security hole?  Anyway, messing around with libc
> doesn't scare me as long as it's not written in assembler.

One definition, yes.

Anyway, libc _does_ use sh for popen() and system() (but these are not
"unexpected" -- everybody knows they use the shell so in secure
programming you avoid them like gets()).  Those calls can make use of
advanced functionality in the shell, unlike the Perl glob() situation,
so in order not to break things you pretty much have to have a fully
functional sh, for whatever definition of "fully functional".

-- 
Peter Samuelson
<sampo.creighton.edu ! psamuels>


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

Date: 27 Apr 1998 01:46:14 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: perl/gtk - any such thing?
Message-Id: <6i0o16$7ot$2@comdyn.comdyn.com.au>

{Adjusted Newsgroups header}

Newsgroups: comp.lang.perl.misc,comp.land.perl.tk
                                     ^^^^
Maybe you meant to post to comp.lang.perl.tk?

In article <6hvgt4$70h@newsops.execpc.com>,
	buck88 <buck88@execpc.com> writes:
> Does anyone know if there is anything that allows you to use
> the gtk wigit set the way that you can use the tk wigit set?

Not that I know of. (it's widget, btw)

> Not that I have a problem with tk, it was just a curiousity
> thing. Also, if anyone could tell me how tcl and perl
> compair - as in which one is better for certain things as
> compaired to the other (strong points vs. week points). I am

There are some comparisons out there on the web. Most are biased.

Go to altavista, and use a search string like:

+perl +tcl +compar*

Lots of reading.

> Please e-mail any replys.

Sorry, post here, read here.

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Mon, 27 Apr 1998 00:18:27 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Problems with 'wait' under perl5.004
Message-Id: <Es1q6r.2r0@news.boeing.com>

In article <6hsvu5$obv$1@lyra.csx.cam.ac.uk>,
M.J.T. Guy <mjtg@cus.cam.ac.uk> wrote:
 >In article <35379340.FDD9615E@gs.com>,
 >Michael Francis FIR LDN  <francm@jeeves.fi.gs.com> wrote:
   >>  [ omitted ... ]
 >
 >wait() returns -1 if it fails _in any way_, not just in the case
 >"No children".    You need to check the value of $! to find the cause
 >of failure.   This fact is documented in the wait(2) manpage, but
 >unfortunately not in  perldoc -f wait.
 >
 >This script illustrates the possible cases:
 >
 >$SIG{INT} = sub { print "Interrupted\n" };
 >$! = 13; $? = 59;
 >$v = wait;
 >print "First: $v  \$!=", 0+$!, ":$!   \$?=", $?, "\n";
 >my $x = $$;
 >if (! fork) {
 >sleep 1;
  >kill 2, $x;
  >exit;
 >};
 >$! = 13; $? = 59;
 >$v = wait;
 >print "Second: $v  \$!=", 0+$!, ":$!   \$?=", $?, "\n";
 >$! = 13; $? = 59;
 >$v = wait;
 >print "Third: $v  \$!=", 0+$!, ":$!   \$?=", $?, "\n";
 >
 >The output on my platform is
 >
 >First: -1  $!=10:No children   $?=-1
 >Interrupted
 >Second: -1  $!=4:Interrupted system call   $?=-1
 >Third: 8146  $!=13:Permission denied   $?=0
 >
 >Note (a) $! is only set if wait returned -1.
 >     (b) $! values are platform dependent.
 >


Funny, with 5.004_04 (both Solaris and HP), your example 
produced:

  First: -1  $!=10:No child processes   $?=-1
  Interrupted
  Second: 19999  $!=13:Permission denied   $?=0
  Third: -1  $!=10:No child processes   $?=-1

I even commented out your $! and $? settings and
amended the SIGINT handler to just set a variable. 
Here's the slightly different output:

  First: -1  $!=10:No child processes   $?=-1
  Interrupted
  Second: 20603  $!=10:No child processes   $?=0
  Third: -1  $!=10:No child processes   $?=-1



*Only* a backrev HP running 5.001 produced your
results:

  First: -1  $!=10:No child processes   $?=65535
  Interrupted
  Second: -1  $!=4:Interrupted system call   $?=6
  Third: 29757  $!=13:Permission denied   $?=0


Am I overlooking something or is errno getting 
washed out somewhere now with the new signal
semantics (sigaction and SA_RESTART...)? 


--
Charles DeRykus


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

Date: Mon, 27 Apr 1998 01:15:09 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: John Russell <john13@interlog.com>
Subject: Re: Sorting nested lists in HTML
Message-Id: <Pine.GSO.3.96.980426181320.589D-100000@user2.teleport.com>

On Sun, 26 Apr 1998, John Russell wrote:

> Anyone know of a general-purpose solution that handles the nesting,
> the HTML symbols, and the multiple locales?

No, but there are some modules on CPAN which may be of some help. If, in
the course of solving this problem, you can create additional useful
modules, I hope you'll contribute those to CPAN as well. Good luck!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 27 Apr 1998 01:04:55 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Henry Lifton <henlif@elsfl.com>
Subject: Re: Unique Sort
Message-Id: <Pine.GSO.3.96.980426175433.589A-100000@user2.teleport.com>

On Sun, 26 Apr 1998, Henry Lifton wrote:

> @buildings_keys = keys %buildings;
>           @sort_keys = map {
>     [ (split /\|/)[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]]
>   } @buildings{@buildings_keys};

If you need all of the numbers from 0 to 17, it's easier (and much less
error-prone) to write 0..17. But perhaps what you really want here is a
third argument to split. In fact, you may want this:

    @sort_keys = map [ split /\|/, $_, 19 ], values %buildings;

 ...but then again, you may not. (You may need a slice, or you may need
@buildings_keys again later.) 

>   @ordered_keys = @buildings_keys [ sort {
>     ${$sort_keys[$a]}[5] cmp ${$sort_keys[$b]}[5]
>         } 0..$#sort_keys ];

This looks like sorting by a computed value, which may be efficiently done
by the Schwartzian Transform. (Not that doing it another way is
necessarily wrong.)

    http://www.5sigma.com/perl/schwtr.html

> ($bid,$agentid,$bldg,$x,$x,$city,$x,$x,$x,$type,$x,$x,$x,$x,$low,$high,$x,$x) 
> = split('\|',$buildings{$city}); 

You may not realize that you could use undef in place of $x as a dummy
value. Better, though, would be to use a slice.

> Can anybody give me a clue how to print only the first occurence of each
> city

The FAQ has good information on selecting just the unique elements of a
list.

> how to get that into an option list box 

There are modules on CPAN which may be able to help you to make your
output in whatever format you need. 

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 26 Apr 1998 23:51:25 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Wanted: Your Perl Hacks
Message-Id: <6i0h9t$6j8$8@comdyn.comdyn.com.au>

In article <6htq5m$juk$1@nnrp1.dejanews.com>,
	gzoller@hotmail.com writes:
> I need to collect as many perl CGI security hacks as possible.
> 
> NOTE:  I am *not* breaking into web sites with this information!
> 
> I am a consultant who's client is (I believe) not taking
> enough security precautions with his perl code.  I'm trying
> to demonstrate (in the presence of my client) that someone
> can do unintended things unless he lets me install some
> checking/validation code.

Hmm. Bad code can be written in any language. Perl is no exception.

The perlsec man page might help you find a few ways. It shows a bunch
of 'unsafe' operations, as well as possible fixes.

> I'm looking for are things like the following:
> 
> *  Ways to create/set/examine the perl variables
>    from a string entered at a form field.

untainting variables? Check perlsec :)

> *  Ways to execture simple commands (like 'ls') from
>    a form text field.

bad. bad. bad. but perlsec talks about it.

> *  Any way to "eval" perl code on an unsuspecting
>    web site.

Check out the Safe module.

> *  Any general perl/CGI security dangers.

Again:

# perldoc perlsec

CGI is just an interface, not inherently dangerous.

> Note:  Even harmless code is great if it will make
> my client say "That's not supposed to be possible!".

Make your client read perlsec :)

As an aside, you might want to have a look at the CERT bulletins.
There are some warnings out there about unsecure perl versions. The
only version that has no (reported) known security bugs is 5.004_04.

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: 26 Apr 1998 16:58:14 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Why doesn't this work?
Message-Id: <6hvp36$nct$2@marina.cinenet.net>

Chris Lambrou (archive@cglis.com) wrote:
: I'm looking for a reg ex that will covert any http references
: such as:
:   http://www.some_domain.com
: To the HTML equivalent of :
:   <a href="http://www.some_domain.com">http://www.some_domain.com</a>
: 
: so that the reader of the email messgae can just jump to the URL within
: the browser. This is what I came up with (assuming $msg to be the body
: of the email message):
: 
: $msg =~ s!(ftp|https?)://([^\s]+)!<a href="$1://$2">$1://$2<\/a>!gsi;
: 
: 90% this works. The problem is that the above will match text that
: starts with ftp/http/https followed by :// up to the next white space 
: character, so this breaks down if the URL is followed by a non word 
: character such as comma,  a ">" or something else.

I'd just tighten up the allowed-char list.  You can go to the standard to 
see what's actually permitted, but here's my off-the-cuff version.  I've 
also combined your two capturing paren regions, which I can't see a good 
reason to separate:

  $msg =~ s!((?:ftp|https?)://[\w&\-+?]+)!<a href="$1">$1</a>!gi;

I've also removed the unneeded backslash from </a>, and omitted the /s 
modifier from the end -- you have no matches on ., so it's meaningless.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: 26 Apr 1998 16:15:11 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Why doesn't this work?
Message-Id: <6hvmig$nct$1@marina.cinenet.net>

Uri Guttman (uri@sysarch.com) wrote:
: how about this one liner:
: 
: #!/usr/local/bin/perl -n0
: # run this with the file you want to extract meta as the arglist.
: # redirect output to your favorite file
: 
: while ( m/(<meta\s+[^>]+>)/ig ) { print "$1\n" ; }

Or even more simply, replace the regex with

  m/(<meta\s+.+?>)/ig

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: 27 Apr 1998 00:14:14 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: writing to file on site
Message-Id: <6i0ikm$6j8$11@comdyn.comdyn.com.au>

In article <01bd7116$1dfa3d00$0f02000a@castle.sonnet.ru>,
	"Michael Yevdokimov" <flanker@sonnet.ru> writes:

> Can anybody explain me with an example, how to read data from cgi-form and
> to write them into disk file, using Perl under Unix system?

use CGI.pm

It has all the support you need for this sort of operation. It even
comes with a save() method to save the state of the CGI to disk. If
that is not what you want, you will need to use the perl builtin
functions open, print, and close, together with methods from the CGI
module to retrieve the date you need from your form.

Without you giving us more information on what exactly you want to do,
we can't be of much more assistance. Sorry.

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.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 2424
**************************************

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