[26402] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8573 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 26 18:05:33 2005

Date: Wed, 26 Oct 2005 15:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 26 Oct 2005     Volume: 10 Number: 8573

Today's topics:
        FAQ 1.8 Is Perl difficult to learn? <comdog@pair.com>
        FAQ 3.3 Is there a Perl shell? <comdog@pair.com>
    Re: How to detect memory usage in hash? xhoster@gmail.com
        Using regex to remove "redundant" tags <cplager+news@physics.ucla.edu>
    Re: Web form CGI, Security? <noreply@gunnar.cc>
    Re: Web form CGI, Security? xhoster@gmail.com
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 26 Oct 2005 16:03:01 +0000 (UTC)
From: PerlFAQ Server <comdog@pair.com>
Subject: FAQ 1.8 Is Perl difficult to learn?
Message-Id: <djo9bl$1bv$1@reader2.panix.com>

This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with Perl.

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

1.8: Is Perl difficult to learn?

    No, Perl is easy to start learning--and easy to keep learning. It looks
    like most programming languages you're likely to have experience with,
    so if you've ever written a C program, an awk script, a shell script, or
    even a BASIC program, you're already partway there.

    Most tasks only require a small subset of the Perl language. One of the
    guiding mottos for Perl development is "there's more than one way to do
    it" (TMTOWTDI, sometimes pronounced "tim toady"). Perl's learning curve
    is therefore shallow (easy to learn) and long (there's a whole lot you
    can do if you really want).

    Finally, because Perl is frequently (but not always, and certainly not
    by definition) an interpreted language, you can write your programs and
    test them without an intermediate compilation step, allowing you to
    experiment and test/debug quickly and easily. This ease of
    experimentation flattens the learning curve even more.

    Things that make Perl easier to learn: Unix experience, almost any kind
    of programming experience, an understanding of regular expressions, and
    the ability to understand other people's code. If there's something you
    need to do, then it's probably already been done, and a working example
    is usually available for free. Don't forget the new perl modules,
    either. They're discussed in Part 3 of this FAQ, along with CPAN, which
    is discussed in Part 2.



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

Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short.  They represent an important
part of the Usenet tradition.  They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.

If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile.  If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.

Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release.  It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.

The perlfaq manual page contains the following copyright notice.

  AUTHOR AND COPYRIGHT

    Copyright (c) 1997-2002 Tom Christiansen and Nathan
    Torkington, and other contributors as noted. All rights 
    reserved.

This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.


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

Date: Wed, 26 Oct 2005 22:03:01 +0000 (UTC)
From: PerlFAQ Server <comdog@pair.com>
Subject: FAQ 3.3 Is there a Perl shell?
Message-Id: <djouel$193$1@reader2.panix.com>

This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with Perl.

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

3.3: Is there a Perl shell?

    The psh (Perl sh) is currently at version 1.8. The Perl Shell is a shell
    that combines the interactive nature of a Unix shell with the power of
    Perl. The goal is a full featured shell that behaves as expected for
    normal shell activity and uses Perl syntax and functionality for
    control-flow statements and other things. You can get psh at
    http://www.focusresearch.com/gregor/psh/ .

    Zoidberg is a similar project and provides a shell written in perl,
    configured in perl and operated in perl. It is intended as a login shell
    and development environment. It can be found at http://zoidberg.sf.net/
    or your local CPAN mirror.

    The Shell.pm module (distributed with Perl) makes Perl try commands
    which aren't part of the Perl language as shell commands. perlsh from
    the source distribution is simplistic and uninteresting, but may still
    be what you want.



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

Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short.  They represent an important
part of the Usenet tradition.  They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.

If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile.  If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.

Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release.  It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.

The perlfaq manual page contains the following copyright notice.

  AUTHOR AND COPYRIGHT

    Copyright (c) 1997-2002 Tom Christiansen and Nathan
    Torkington, and other contributors as noted. All rights 
    reserved.

This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.


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

Date: 26 Oct 2005 15:47:19 GMT
From: xhoster@gmail.com
Subject: Re: How to detect memory usage in hash?
Message-Id: <20051026114719.537$0I@newsreader.com>

"sonet" <sonet.all@msa.hinet.net> wrote:
> How to know how many memory usage in a hash??

That depends on many things.

> I just can use top to see the memory usage?

Sure, if your system has top.  Of course, it will be memory of the
entire perl program, not just the hash.  To do it from withing Perl,
I usually use "my $mem = (`ps -p $$ -o rss `)[1];", which gives just the
resident size of the whole program, but is usually good enough.
There is also Devel::Size, but I often find it to be unreliable and that
it causes worse problems than the ones I'm trying to use it to solve.

Xho

>
> -----How to rough estimate ?---
>
> my %hash;
> for (my $i=0;$i<=10000;$i++){
> $hash{abc}{$i}='testing';
> }

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: Wed, 26 Oct 2005 18:02:27 GMT
From: Charles Plager <cplager+news@physics.ucla.edu>
Subject: Using regex to remove "redundant" tags
Message-Id: <TwP7f.1601$Lv.302@newssvr23.news.prodigy.net>

Hello,
	I'm trying to remove 'redundant' tags.  For example, if I use '1' to be 
the start of a tag and '2' to be the end of a tag, I want to turn:

aa1bb1cc2dd2ee
     (where the the tags around 'cc' are redundant) into
aa1bbccdd2ee

where I have removed the '1' in between 'bb' and 'cc' and the '2' in 
between 'cc' and 'dd'.

	For this very simple example, the following perl script works.  	The 
problem is that if I make the end tag '$E' anything more than a single 
character, this (unsurprisingly) no longer works.

	Is there a way I can use regex (with maybe look aheads, etc.) to make 
this work?

	Cheers,
	  Charles


#!/usr/bin/perl

use warnings;
use strict;

my $S = "1";
my $E = "2";

my $string = "aa".$S."bb".$S."cc".$E."dd".$E."ee";

print "$string\n";

$string =~ s|$S([^$E]*)$S([^$E]*)2|$S$1$2|;

print "$string\n";
__END__
cplager@PointyIII> ./regex.pl
aa1bb1cc2dd2ee
aa1bbccdd2ee






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

Date: Wed, 26 Oct 2005 17:25:58 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Web form CGI, Security?
Message-Id: <3s9ljuFn19v0U1@individual.net>

one man army wrote:
>  I would like to generate a few simple web forms. Is the Perl CGI, and a 
> cgi-enabled directory, a huge security hole?

Together with clueless programmers: Yes.

>   I read the lines that say to disable upload, and limit the size of a 
> POST.
> 
>   I'm asking my host to install CGI, although I know he is security 
> conscious.

Then convince them that you aren't clueless (´cause you aren't, are you?).

To be safe, you can for instance study 
http://www.w3.org/Security/Faq/www-security-faq.html

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: 26 Oct 2005 15:57:23 GMT
From: xhoster@gmail.com
Subject: Re: Web form CGI, Security?
Message-Id: <20051026115723.829$np@newsreader.com>

one man army <newsAT@screenlightDOT.com> wrote:
>  I would like to generate a few simple web forms. Is the Perl CGI, and a
> cgi-enabled directory, a huge security hole?

If you have to ask if it is a security hole, then in your hands it will
be a security hole.  Read the CGI security FAQs on the web, and perldoc
perlsec.

>
>   I read the lines that say to disable upload,

If you don't need uploads, sure.  If you do need upload, then you probably
shouldn't disable it.

> and limit the size of a
> POST.

I good idea if there is a clear limit to how big a legitimate post
can be.

>
>   I'm asking my host to install CGI, although I know he is security
> conscious.

In that case, he should be able to provide you with much more
custom-tailored advice than we can.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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

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

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


------------------------------
End of Perl-Users Digest V10 Issue 8573
***************************************


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