[30407] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1650 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 17 09:19:30 2008

Date: Tue, 17 Jun 2008 06:19:23 -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           Tue, 17 Jun 2008     Volume: 11 Number: 1650

Today's topics:
        new CPAN modules on Tue Jun 17 2008 (Randal Schwartz)
        Perl Script <akhilshri@gmail.com>
    Re: Perl Script <1usa@llenroc.ude.invalid>
    Re: Perl Script <rkb@i.frys.com>
    Re: Perl Script <rvtol+news@isolution.nl>
        Posting Guidelines for comp.lang.perl.misc ($Revision:  tadmc@seesig.invalid
        Reading whole file into memory. Parsing 'C' like file e n_macpherson@sky.com
    Re: Reading whole file into memory. Parsing 'C' like fi <jurgenex@hotmail.com>
    Re: Reading whole file into memory. Parsing 'C' like fi <bugbear@trim_papermule.co.uk_trim>
    Re: Reading whole file into memory. Parsing 'C' like fi n_macpherson@sky.com
    Re: Simple scrape with perl on google news <nevenbartel@gmail.com>
    Re: XML::Simple how to force hash generation for keys <news@nana.franken.de>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 17 Jun 2008 04:42:18 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Tue Jun 17 2008
Message-Id: <K2LBqI.24F8@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

Amazon-S3-0.441
http://search.cpan.org/~tima/Amazon-S3-0.441/
A portable client library for working with and managing Amazon S3 buckets and keys. 
----
App-Env-0.10
http://search.cpan.org/~djerius/App-Env-0.10/
manage application specific environments 
----
App-Env-0.11
http://search.cpan.org/~djerius/App-Env-0.11/
manage application specific environments 
----
B-Debug-1.07
http://search.cpan.org/~rurban/B-Debug-1.07/
Walk Perl syntax tree, printing debug info about ops 
----
Bitmask-Data-1.02
http://search.cpan.org/~maros/Bitmask-Data-1.02/
Handle bitmasks in an easy and flexible way 
----
Bitmask-Data-1.03
http://search.cpan.org/~maros/Bitmask-Data-1.03/
Handle bitmasks in an easy and flexible way 
----
CGI-Application-4.07_03
http://search.cpan.org/~markstos/CGI-Application-4.07_03/
Framework for building reusable web-applications 
----
CGI-Session-4.31
http://search.cpan.org/~markstos/CGI-Session-4.31/
----
Catalyst-Plugin-ConfigComponents-0.1.32
http://search.cpan.org/~pjfl/Catalyst-Plugin-ConfigComponents-0.1.32/
Creates components from config entries 
----
Catalyst-Plugin-InflateMore-0.1.19
http://search.cpan.org/~pjfl/Catalyst-Plugin-InflateMore-0.1.19/
Inflates symbols in application config 
----
Config-General-2.39
http://search.cpan.org/~tlinden/Config-General-2.39/
Generic Config Module 
----
Config-Interactive-0.04
http://search.cpan.org/~mpg/Config-Interactive-0.04/
config module with support for interpolation, XML fragments and interactive UI 
----
Convert-BaseN-0.01
http://search.cpan.org/~dankogai/Convert-BaseN-0.01/
encoding and decoding of base{2,4,8,16,32,64} strings 
----
Crypt-EAX-0.02
http://search.cpan.org/~nuffin/Crypt-EAX-0.02/
Encrypt and authenticate data in EAX mode 
----
Crypt-Random-Source-0.01
http://search.cpan.org/~nuffin/Crypt-Random-Source-0.01/
Get random weak or strong random data. 
----
Crypt-Random-Source-0.01_01
http://search.cpan.org/~nuffin/Crypt-Random-Source-0.01_01/
Get random weak or strong random data. 
----
Crypt-Random-Source-0.02
http://search.cpan.org/~nuffin/Crypt-Random-Source-0.02/
Get random weak or strong random data. 
----
Crypt-Random-Source-Weak-openssl-0.01
http://search.cpan.org/~nuffin/Crypt-Random-Source-Weak-openssl-0.01/
Get random bytes from the OpenSSL command line utility 
----
DBI-1.605
http://search.cpan.org/~timb/DBI-1.605/
Database independent interface for Perl 
----
DBIx-HA-1.1
http://search.cpan.org/~markstos/DBIx-HA-1.1/
High Availability package for DBI 
----
DBIx-SchemaChecksum-0.06
http://search.cpan.org/~domm/DBIx-SchemaChecksum-0.06/
Generate and compare checksums of database schematas 
----
Data-CloudWeights-0.2.57
http://search.cpan.org/~pjfl/Data-CloudWeights-0.2.57/
Calculate values for an HTML tag cloud 
----
Data-FormValidator-4.60
http://search.cpan.org/~markstos/Data-FormValidator-4.60/
Validates user input (usually from an HTML form) based on input profile. 
----
Data-FormValidator-4.61
http://search.cpan.org/~markstos/Data-FormValidator-4.61/
Validates user input (usually from an HTML form) based on input profile. 
----
Data-Transactional-1.01
http://search.cpan.org/~dcantrell/Data-Transactional-1.01/
data structures with RDBMS-like transactions 
----
Data-Transactional-1.02
http://search.cpan.org/~dcantrell/Data-Transactional-1.02/
data structures with RDBMS-like transactions 
----
Data-Validation-0.1.26
http://search.cpan.org/~pjfl/Data-Validation-0.1.26/
Check data values form conformance with constraints 
----
Devel-FindBlessedRefs-1.0.5
http://search.cpan.org/~jettero/Devel-FindBlessedRefs-1.0.5/
find all refs blessed under a package 
----
Devel-FindBlessedRefs-1.0.6
http://search.cpan.org/~jettero/Devel-FindBlessedRefs-1.0.6/
find all refs blessed under a package 
----
Email-Public-0.06
http://search.cpan.org/~jeteve/Email-Public-0.06/
Quickly find if an email address is from a public email provider 
----
Fir-0.32
http://search.cpan.org/~lbrocard/Fir-0.32/
a Tree::DAG_Node subclass for menu nagivation 
----
Foorum-0.1.7
http://search.cpan.org/~fayland/Foorum-0.1.7/
Foorum is a forum script built in Catalyst. 
----
Geo-KML-0.01
http://search.cpan.org/~markov/Geo-KML-0.01/
produce GoogleEarth KML/KMZ files 
----
GoferTransport-http-1.015
http://search.cpan.org/~timb/GoferTransport-http-1.015/
----
HTML-Template-Compiled-0.91_003
http://search.cpan.org/~tinita/HTML-Template-Compiled-0.91_003/
Template System Compiles HTML::Template files to Perl code 
----
HTTP-Server-Brick-0.1.3
http://search.cpan.org/~aufflick/HTTP-Server-Brick-0.1.3/
Simple pure perl http server for prototyping "in the style of" Ruby's WEBrick 
----
IPC-SRLock-0.1.54
http://search.cpan.org/~pjfl/IPC-SRLock-0.1.54/
Set/reset locking semantics to single thread processes 
----
JSON-RPC-Common-0.02
http://search.cpan.org/~nuffin/JSON-RPC-Common-0.02/
Transport agnostic JSON RPC helper objects 
----
JSON-RPC-Common-0.03
http://search.cpan.org/~nuffin/JSON-RPC-Common-0.03/
Transport agnostic JSON RPC helper objects 
----
Makefile-Parallel-0.05
http://search.cpan.org/~ambs/Makefile-Parallel-0.05/
A distributed parallel makefile 
----
Math-Int32-0.001
http://search.cpan.org/~hooo/Math-Int32-0.001/
Manipulate 32 bits integers in Perl 
----
Module-Used-v1.0.1
http://search.cpan.org/~elliotjs/Module-Used-v1.0.1/
Find modules loaded by Perl code without running it. 
----
MooseX-Types-DateTime-0.02
http://search.cpan.org/~nuffin/MooseX-Types-DateTime-0.02/
DateTime related constraints and coercions for Moose 
----
Mouse-0.04
http://search.cpan.org/~nuffin/Mouse-0.04/
Moose minus the antlers 
----
Music-Audioscrobbler-MPD-0.12
http://search.cpan.org/~ealleniii/Music-Audioscrobbler-MPD-0.12/
Module providing routines to submit songs to last.fm from MPD. 
----
Music-Audioscrobbler-Submit-0.04
http://search.cpan.org/~ealleniii/Music-Audioscrobbler-Submit-0.04/
Module providing routines to submit songs to last.fm using 1.2 protocol. 
----
Net-IMAP-Server-0.8
http://search.cpan.org/~alexmv/Net-IMAP-Server-0.8/
A single-threaded multiplexing IMAP server implementation, using Net::Server::Coro. 
----
Net-SFTP-Foreign-1.38
http://search.cpan.org/~salva/Net-SFTP-Foreign-1.38/
SSH File Transfer Protocol client 
----
Net-SNMP-Mixin-Dot1abLldp-0.09
http://search.cpan.org/~gaissmai/Net-SNMP-Mixin-Dot1abLldp-0.09/
mixin class for the Link Layer Discovery Protocol 
----
Rinchi-XMLSchema-0.01
http://search.cpan.org/~bmames/Rinchi-XMLSchema-0.01/
Module for creating XML Schema objects from XSD files. 
----
Ruby-0.01
http://search.cpan.org/~gfuji/Ruby-0.01/
Perl interface to Ruby interpreter 
----
Software-License-0.008
http://search.cpan.org/~rjbs/Software-License-0.008/
packages that provide templated software licenses 
----
Sort-Key-Top-0.04
http://search.cpan.org/~salva/Sort-Key-Top-0.04/
select and sort top n elements 
----
Sub-Contract-0.07
http://search.cpan.org/~erwan/Sub-Contract-0.07/
Pragmatic contract programming for Perl 
----
Text-ECSV-0.01
http://search.cpan.org/~jkutej/Text-ECSV-0.01/
Extended CSV manipulation routines 
----
URI-1.37
http://search.cpan.org/~gaas/URI-1.37/
Uniform Resource Identifiers (absolute and relative) 
----
User-Simple-1.36
http://search.cpan.org/~gwolf/User-Simple-1.36/
Simple user sessions management 
----
WWW-Myspace-0.81
http://search.cpan.org/~oalders/WWW-Myspace-0.81/
Access MySpace.com profile information from Perl 
----
WordNet-Similarity-2.05
http://search.cpan.org/~tpederse/WordNet-Similarity-2.05/
Perl modules for computing measures of semantic relatedness. 
----
X3D-0.003_001
http://search.cpan.org/~hooo/X3D-0.003_001/
Don't use it. It's in development. For test purposes only! 
----
XML-Compile-0.85
http://search.cpan.org/~markov/XML-Compile-0.85/
Compilation based XML processing 
----
XML-RelaxNG-Compact-PXB-0.07
http://search.cpan.org/~mpg/XML-RelaxNG-Compact-PXB-0.07/
create perl XML (RelaxNG Compact) data binding API 
----
stockmonkey-2.4
http://search.cpan.org/~jettero/stockmonkey-2.4/
----
stockmonkey-2.5
http://search.cpan.org/~jettero/stockmonkey-2.5/


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion


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

Date: Mon, 16 Jun 2008 19:45:10 -0700 (PDT)
From: dakin999 <akhilshri@gmail.com>
Subject: Perl Script
Message-Id: <3e87cd07-6d6e-41ed-9b9a-cd68218e0ea2@l28g2000prd.googlegroups.com>

I am looking for any generic perl script that is doing some thing
like
following. Any code help will be really helpful.

1. Reads from a database(oracle) following columns:
Customer_No, Fname, Lname, Password.


2. Encrypts the password in SHA1_Base64 format.


3. Use the perl-ldap add object to create a ldif record with the same
columns  (as in step 1, but password in the SHA1_Base64 encrypted
string).


4. Create a CSV file with same columns as in step 1, exculding the
password.


5. Add the ldif data into SUN LDAP directory.


Thanks in advance.


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

Date: Tue, 17 Jun 2008 03:12:46 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Perl Script
Message-Id: <Xns9ABFEC1DD4915asu1cornelledu@127.0.0.1>

dakin999 <akhilshri@gmail.com> wrote in news:3e87cd07-6d6e-41ed-9b9a-
cd68218e0ea2@l28g2000prd.googlegroups.com:

> I am looking for any generic perl script that is doing some thing
> like following.

http://jobs.perl.org/

Sinan

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/


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

Date: Mon, 16 Jun 2008 20:20:45 -0700 (PDT)
From: Ron Bergin <rkb@i.frys.com>
Subject: Re: Perl Script
Message-Id: <7d887088-b458-4726-8b3a-c986ff2a5fc5@p39g2000prm.googlegroups.com>

On Jun 16, 7:45 pm, dakin999 <akhils...@gmail.com> wrote:
> I am looking for any generic perl script that is doing some thing
> like
> following. Any code help will be really helpful.
>
> 1. Reads from a database(oracle) following columns:
> Customer_No, Fname, Lname, Password.
>
> 2. Encrypts the password in SHA1_Base64 format.
>
> 3. Use the perl-ldap add object to create a ldif record with the same
> columns  (as in step 1, but password in the SHA1_Base64 encrypted
> string).
>
> 4. Create a CSV file with same columns as in step 1, exculding the
> password.
>
> 5. Add the ldif data into SUN LDAP directory.
>
http://www.rentacoder.com/RentACoder/default.asp


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

Date: Tue, 17 Jun 2008 11:44:12 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Perl Script
Message-Id: <g38883.1ds.1@news.isolution.nl>

dakin999 schreef:

> 1. Reads from a database(oracle) following columns:
> Customer_No, Fname, Lname, Password.
> 
> 2. Encrypts the password in SHA1_Base64 format.

You have plain passwords in the database?

-- 
Affijn, Ruud

"Gewoon is een tijger."


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

Date: Tue, 17 Jun 2008 06:13:30 GMT
From: tadmc@seesig.invalid
Subject: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.8 $)
Message-Id: <eCI5k.14163$co7.9790@nlpi066.nbdc.sbc.com>

Outline
   Before posting to comp.lang.perl.misc
      Must
       - Check the Perl Frequently Asked Questions (FAQ)
       - Check the other standard Perl docs (*.pod)
      Really Really Should
       - Lurk for a while before posting
       - Search a Usenet archive
      If You Like
       - Check Other Resources
   Posting to comp.lang.perl.misc
      Is there a better place to ask your question?
       - Question should be about Perl, not about the application area
      How to participate (post) in the clpmisc community
       - Carefully choose the contents of your Subject header
       - Use an effective followup style
       - Speak Perl rather than English, when possible
       - Ask perl to help you
       - Do not re-type Perl code
       - Provide enough information
       - Do not provide too much information
       - Do not post binaries, HTML, or MIME
      Social faux pas to avoid
       - Asking a Frequently Asked Question
       - Asking a question easily answered by a cursory doc search
       - Asking for emailed answers
       - Beware of saying "doesn't work"
       - Sending a "stealth" Cc copy
      Be extra cautious when you get upset
       - Count to ten before composing a followup when you are upset
       - Count to ten after composing and before posting when you are upset
-----------------------------------------------------------------

Posting Guidelines for comp.lang.perl.misc ($Revision: 1.8 $)
    This newsgroup, commonly called clpmisc, is a technical newsgroup
    intended to be used for discussion of Perl related issues (except job
    postings), whether it be comments or questions.

    As you would expect, clpmisc discussions are usually very technical in
    nature and there are conventions for conduct in technical newsgroups
    going somewhat beyond those in non-technical newsgroups.

    The article at:

        http://www.catb.org/~esr/faqs/smart-questions.html

    describes how to get answers from technical people in general.

    This article describes things that you should, and should not, do to
    increase your chances of getting an answer to your Perl question. It is
    available in POD, HTML and plain text formats at:

     http://www.rehabitation.com/clpmisc.shtml

    For more information about netiquette in general, see the "Netiquette
    Guidelines" at:

     http://andrew2.andrew.cmu.edu/rfc/rfc1855.html

    A note to newsgroup "regulars":

       Do not use these guidelines as a "license to flame" or other
       meanness. It is possible that a poster is unaware of things
       discussed here.  Give them the benefit of the doubt, and just
       help them learn how to post, rather than assume that they do 
       know and are being the "bad kind" of Lazy.

    A note about technical terms used here:

       In this document, we use words like "must" and "should" as
       they're used in technical conversation (such as you will
       encounter in this newsgroup). When we say that you *must* do
       something, we mean that if you don't do that something, then
       it's unlikely that you will benefit much from this group.
       We're not bossing you around; we're making the point without
       lots of words.

    Do *NOT* send email to the maintainer of these guidelines. It will be
    discarded unread. The guidelines belong to the newsgroup so all
    discussion should appear in the newsgroup. I am just the secretary that
    writes down the consensus of the group.

Before posting to comp.lang.perl.misc
  Must
    This section describes things that you *must* do before posting to
    clpmisc, in order to maximize your chances of getting meaningful replies
    to your inquiry and to avoid getting flamed for being lazy and trying to
    have others do your work.

    The perl distribution includes documentation that is copied to your hard
    drive when you install perl. Also installed is a program for looking
    things up in that (and other) documentation named 'perldoc'.

    You should either find out where the docs got installed on your system,
    or use perldoc to find them for you. Type "perldoc perldoc" to learn how
    to use perldoc itself. Type "perldoc perl" to start reading Perl's
    standard documentation.

    Check the Perl Frequently Asked Questions (FAQ)
        Checking the FAQ before posting is required in Big 8 newsgroups in
        general, there is nothing clpmisc-specific about this requirement.
        You are expected to do this in nearly all newsgroups.

        You can use the "-q" switch with perldoc to do a word search of the
        questions in the Perl FAQs.

    Check the other standard Perl docs (*.pod)
        The perl distribution comes with much more documentation than is
        available for most other newsgroups, so in clpmisc you should also
        see if you can find an answer in the other (non-FAQ) standard docs
        before posting.

    It is *not* required, or even expected, that you actually *read* all of
    Perl's standard docs, only that you spend a few minutes searching them
    before posting.

    Try doing a word-search in the standard docs for some words/phrases
    taken from your problem statement or from your very carefully worded
    "Subject:" header.

  Really Really Should
    This section describes things that you *really should* do before posting
    to clpmisc.

    Lurk for a while before posting
        This is very important and expected in all newsgroups. Lurking means
        to monitor a newsgroup for a period to become familiar with local
        customs. Each newsgroup has specific customs and rituals. Knowing
        these before you participate will help avoid embarrassing social
        situations. Consider yourself to be a foreigner at first!

    Search a Usenet archive
        There are tens of thousands of Perl programmers. It is very likely
        that your question has already been asked (and answered). See if you
        can find where it has already been answered.

        One such searchable archive is:

         http://groups.google.com/advanced_group_search

  If You Like
    This section describes things that you *can* do before posting to
    clpmisc.

    Check Other Resources
        You may want to check in books or on web sites to see if you can
        find the answer to your question.

        But you need to consider the source of such information: there are a
        lot of very poor Perl books and web sites, and several good ones
        too, of course.

Posting to comp.lang.perl.misc
    There can be 200 messages in clpmisc in a single day. Nobody is going to
    read every article. They must decide somehow which articles they are
    going to read, and which they will skip.

    Your post is in competition with 199 other posts. You need to "win"
    before a person who can help you will even read your question.

    These sections describe how you can help keep your article from being
    one of the "skipped" ones.

  Is there a better place to ask your question?
    Question should be about Perl, not about the application area
        It can be difficult to separate out where your problem really is,
        but you should make a conscious effort to post to the most
        applicable newsgroup. That is, after all, where you are the most
        likely to find the people who know how to answer your question.

        Being able to "partition" a problem is an essential skill for
        effectively troubleshooting programming problems. If you don't get
        that right, you end up looking for answers in the wrong places.

        It should be understood that you may not know that the root of your
        problem is not Perl-related (the two most frequent ones are CGI and
        Operating System related), so off-topic postings will happen from
        time to time. Be gracious when someone helps you find a better place
        to ask your question by pointing you to a more applicable newsgroup.

  How to participate (post) in the clpmisc community
    Carefully choose the contents of your Subject header
        You have 40 precious characters of Subject to win out and be one of
        the posts that gets read. Don't waste them. Take care while
        composing them, they are the key that opens the door to getting an
        answer.

        Spend them indicating what aspect of Perl others will find if they
        should decide to read your article.

        Do not spend them indicating "experience level" (guru, newbie...).

        Do not spend them pleading (please read, urgent, help!...).

        Do not spend them on non-Subjects (Perl question, one-word
        Subject...)

        For more information on choosing a Subject see "Choosing Good
        Subject Lines":

         http://www.cpan.org/authors/id/D/DM/DMR/subjects.post

        Part of the beauty of newsgroup dynamics, is that you can contribute
        to the community with your very first post! If your choice of
        Subject leads a fellow Perler to find the thread you are starting,
        then even asking a question helps us all.

    Use an effective followup style
        When composing a followup, quote only enough text to establish the
        context for the comments that you will add. Always indicate who
        wrote the quoted material. Never quote an entire article. Never
        quote a .signature (unless that is what you are commenting on).

        Intersperse your comments *following* each section of quoted text to
        which they relate. Unappreciated followup styles are referred to as
        "top-posting", "Jeopardy" (because the answer comes before the
        question), or "TOFU" (Text Over, Fullquote Under).

        Reversing the chronology of the dialog makes it much harder to
        understand (some folks won't even read it if written in that style).
        For more information on quoting style, see:

         http://web.presby.edu/~nnqadmin/nnq/nquote.html

    Speak Perl rather than English, when possible
        Perl is much more precise than natural language. Saying it in Perl
        instead will avoid misunderstanding your question or problem.

        Do not say: I have variable with "foo\tbar" in it.

        Instead say: I have $var = "foo\tbar", or I have $var = 'foo\tbar',
        or I have $var = <DATA> (and show the data line).

    Ask perl to help you
        You can ask perl itself to help you find common programming mistakes
        by doing two things: enable warnings (perldoc warnings) and enable
        "strict"ures (perldoc strict).

        You should not bother the hundreds/thousands of readers of the
        newsgroup without first seeing if a machine can help you find your
        problem. It is demeaning to be asked to do the work of a machine. It
        will annoy the readers of your article.

        You can look up any of the messages that perl might issue to find
        out what the message means and how to resolve the potential mistake
        (perldoc perldiag). If you would like perl to look them up for you,
        you can put "use diagnostics;" near the top of your program.

    Do not re-type Perl code
        Use copy/paste or your editor's "import" function rather than
        attempting to type in your code. If you make a typo you will get
        followups about your typos instead of about the question you are
        trying to get answered.

    Provide enough information
        If you do the things in this item, you will have an Extremely Good
        chance of getting people to try and help you with your problem!
        These features are a really big bonus toward your question winning
        out over all of the other posts that you are competing with.

        First make a short (less than 20-30 lines) and *complete* program
        that illustrates the problem you are having. People should be able
        to run your program by copy/pasting the code from your article. (You
        will find that doing this step very often reveals your problem
        directly. Leading to an answer much more quickly and reliably than
        posting to Usenet.)

        Describe *precisely* the input to your program. Also provide example
        input data for your program. If you need to show file input, use the
        __DATA__ token (perldata.pod) to provide the file contents inside of
        your Perl program.

        Show the output (including the verbatim text of any messages) of
        your program.

        Describe how you want the output to be different from what you are
        getting.

        If you have no idea at all of how to code up your situation, be sure
        to at least describe the 2 things that you *do* know: input and
        desired output.

    Do not provide too much information
        Do not just post your entire program for debugging. Most especially
        do not post someone *else's* entire program.

    Do not post binaries, HTML, or MIME
        clpmisc is a text only newsgroup. If you have images or binaries
        that explain your question, put them in a publically accessible
        place (like a Web server) and provide a pointer to that location. If
        you include code, cut and paste it directly in the message body.
        Don't attach anything to the message. Don't post vcards or HTML.
        Many people (and even some Usenet servers) will automatically filter
        out such messages. Many people will not be able to easily read your
        post. Plain text is something everyone can read.

  Social faux pas to avoid
    The first two below are symptoms of lots of FAQ asking here in clpmisc.
    It happens so often that folks will assume that it is happening yet
    again. If you have looked but not found, or found but didn't understand
    the docs, say so in your article.

    Asking a Frequently Asked Question
        It should be understood that you may have missed the applicable FAQ
        when you checked, which is not a big deal. But if the Frequently
        Asked Question is worded similar to your question, folks will assume
        that you did not look at all. Don't become indignant at pointers to
        the FAQ, particularly if it solves your problem.

    Asking a question easily answered by a cursory doc search
        If folks think you have not even tried the obvious step of reading
        the docs applicable to your problem, they are likely to become
        annoyed.

        If you are flamed for not checking when you *did* check, then just
        shrug it off (and take the answer that you got).

    Asking for emailed answers
        Emailed answers benefit one person. Posted answers benefit the
        entire community. If folks can take the time to answer your
        question, then you can take the time to go get the answer in the
        same place where you asked the question.

        It is OK to ask for a *copy* of the answer to be emailed, but many
        will ignore such requests anyway. If you munge your address, you
        should never expect (or ask) to get email in response to a Usenet
        post.

        Ask the question here, get the answer here (maybe).

    Beware of saying "doesn't work"
        This is a "red flag" phrase. If you find yourself writing that,
        pause and see if you can't describe what is not working without
        saying "doesn't work". That is, describe how it is not what you
        want.

    Sending a "stealth" Cc copy
        A "stealth Cc" is when you both email and post a reply without
        indicating *in the body* that you are doing so.

  Be extra cautious when you get upset
    Count to ten before composing a followup when you are upset
        This is recommended in all Usenet newsgroups. Here in clpmisc, most
        flaming sub-threads are not about any feature of Perl at all! They
        are most often for what was seen as a breach of netiquette. If you
        have lurked for a bit, then you will know what is expected and won't
        make such posts in the first place.

        But if you get upset, wait a while before writing your followup. I
        recommend waiting at least 30 minutes.

    Count to ten after composing and before posting when you are upset
        After you have written your followup, wait *another* 30 minutes
        before committing yourself by posting it. You cannot take it back
        once it has been said.

AUTHOR
    Tad McClellan and many others on the comp.lang.perl.misc newsgroup.

-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: Tue, 17 Jun 2008 03:49:32 -0700 (PDT)
From: n_macpherson@sky.com
Subject: Reading whole file into memory. Parsing 'C' like file efficently
Message-Id: <6e16fedb-be8a-41ed-ba79-16c5c030918a@s50g2000hsb.googlegroups.com>

I know there are a number of FAQs which disscourage reading whole
files into memory rather than line by line.

However my problem is as follows.

I am reading a file which is a language which looks like (but isn't )
C. I need to insert comments / documentation at various points in the
file. However sometimes I don't know what I want to insert until I get
well past the current line - for example


for(i=0;i<64;i++)
{
        // lots of code
}

Say my opening brace is on line 95 and my closing brace 195 I want to
insert a comment

// for loop ends line 195

at line 94 (i.e immediately above the opening brace). The problem is
that processing line by line I don't know until I get to line 195 what
I have to change at line 9 so I have to store lines 94 to 195 in
memory anyway

Similarly if I read a function header, I want to insert some
documentation before the function header
so I don't believe processing the file line by line is the best
solution here. As I will be inserting extra lines into the middle of
an array I think I am going to need a module to do this.

Memory won't be an issue - my largest file will only be 6000

I've been away from Perl for a while but I seem to remember there was
a module File::Tie which might be suitable.

I'd be grateful if anyone has any suggestions - the people who will be
using this don't normally use Perl so I'd like to avoid using any non-
standard modules if possible

Thanks

Niall


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

Date: Tue, 17 Jun 2008 11:12:38 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Reading whole file into memory. Parsing 'C' like file efficently
Message-Id: <426f54t0m6556avg1aufesfunmg1tet73e@4ax.com>

n_macpherson@sky.com wrote:
>Similarly if I read a function header, I want to insert some
>documentation before the function header
>so I don't believe processing the file line by line is the best
>solution here. 

Based on what you said I would tend to agree.

If that kind of automated annotation is useful is a different story,
thou. I doubt it. Like for 

>Say my opening brace is on line 95 and my closing brace 195 I want to
>insert a comment
>// for loop ends line 195

First of all a proper indentation will provide even better guidance as
to where the loop ends. And second a single block spanning 100 lines is
just plain nuts. A classic rule of thumb used to be that if the code for
a sub doesn't fit on VT220 screen, then it was too long and you should
think about splitting it. There ware two reasons for this: 
- you don't want to keep scrolling up and down while thinking about this
sub
- anyting much longer becomes too complex for a single sub

Granted, times have changed and typically you can display many more
lines on modern terminals. But the second reason is still very sound.
Many people will probably consider 30-50 lines of code to be the maximum
length of code that can still be easily viewed and recognized without
too much mental scrolling.

>As I will be inserting extra lines into the middle of
>an array I think I am going to need a module to do this.

Why? Sounds like a perfect job for splice().

jue


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

Date: Tue, 17 Jun 2008 13:17:06 +0100
From: bugbear <bugbear@trim_papermule.co.uk_trim>
Subject: Re: Reading whole file into memory. Parsing 'C' like file efficently
Message-Id: <KY2dnaUsILrfNsrVRVnyvgA@posted.plusnet>

n_macpherson@sky.com wrote:
> I know there are a number of FAQs which disscourage reading whole
> files into memory rather than line by line.

Problem-dependant IMHO.

If you're anywhere in the area of processing
log files, booking files,data streams,
line by line is the way, especially where
the unit of processing is the line,
or small number of lines.

But for files known to be small,
where the fundamental unit of processing
isn't the line, reading and processing
the whole thing "as one" is the better way.

  BugBear


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

Date: Tue, 17 Jun 2008 05:25:06 -0700 (PDT)
From: n_macpherson@sky.com
Subject: Re: Reading whole file into memory. Parsing 'C' like file efficently
Message-Id: <9f773d91-8ba9-43b9-8b19-c3c514f5d0ae@26g2000hsk.googlegroups.com>

>
> First of all a proper indentation will provide even better guidance as
> to where the loop ends. And second a single block spanning 100 lines is
> just plain nuts. A classic rule of thumb used to be that if the code for
> a sub doesn't fit on VT220 screen, then it was too long and you should
> think about splitting it. There ware two reasons for this:
> - you don't want to keep scrolling up and down while thinking about this
> sub
> - anyting much longer becomes too complex for a single sub
>
> Granted, times have changed and typically you can display many more
> lines on modern terminals. But the second reason is still very sound.
> Many people will probably consider 30-50 lines of code to be the maximum
> length of code that can still be easily viewed and recognized without
> too much mental scrolling.
>

One of the reasons I am writing this script is because we have
introduced coding standards which specify a maximum of 300 lines per
function and 70 lines for a while/if/else/for loop and I need to
highlight places in our scripts where this occurs. I agree 300 lines
for a function is probably too long but in the language concerned
anything less than 200 would be completely impractical unfortunately.

The indentation is a good point - our developers mostly develop on
site which means a variety of editors ( UltraEdit, Visual Studio,
Notepad++, our own proprietary editor ) are used. This means
indentation across scripts becomes inconsistent. One of the functions
of the script I am writing will be to make sure the indentation
conforms to the coding  standards.

> Why? Sounds like a perfect job for splice().

Yes - I'd forgotten splice() will allow me to insert into the middle
of an array (as I said I have been away from Perl for a little
while) . That should work fine for my purposes.


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

Date: Tue, 17 Jun 2008 00:34:26 -0700 (PDT)
From: jjquery <nevenbartel@gmail.com>
Subject: Re: Simple scrape with perl on google news
Message-Id: <cd9c8554-aaf8-4b97-897e-c3c63d28aa58@t54g2000hsg.googlegroups.com>

Great greymaus, thank you - I'll try this and comment in the results.
Cheers, -n


On Jun 13, 6:26 pm, greymaus <greyma...@mail.com> wrote:
> On 2008-06-13, greymaus <greyma...@mail.com> wrote:
>
>
>
> >> Can anybody give me a hand and provide me the code?
>
> >> If you can provide me the code where I can configure the variables:
>
> >> "URL"
> >> "search string"
> >> "target file"
>
> >> and I can get it running ( I have a website with full perl
> >> capabilities) on my own, you get US$10 to a paypal account. ;-)
>
> >> Thanx, -n
>
> > 1)
> > You can do that very easily with the libwww modules, or more upmarket
> > WWW::Mechanize. Read them up.
>
> > 2) Google will _not_ like that. And Google is one of the wealthiest
> > enteties on the planet.
>
> > 3) Getting too many results down too quickly will have your _real_ (URL)
> > address blocked either for a short or long period from Google.
>
> > send an unmungable munged email account.
>
> Source of a sample News.google.com page weighs in at 180k
> (like the main Google page), news.google.com is a javascript
> mess. And those do not do javascript;
> HOWEVER;
>
> #!/usr/bin/perl -w
> use WWW::Mechanize;
> $search_string=$ARGV[0];
> print "$search_string";
> $start=10;
> open T, ">>.gnewslog" or die "No .gnewslog\n";
>
> $mech=WWW::Mechanize->new(cookie_jar=>undef);
> $mech->agent_alias("Windows IE 6");
> $mech->get("http://www.news.google.com/news?hl=en&ned=us&q=$search_string&btnG=Se...");
> @links=$mech->links();
> foreach $j (@links){
>         $p=$j->url_abs();
>         unless (($p=~/google/) || ($p=~/java/)){
>         print T "$p\n";}
>         }
> $index=$start+10;
> for($start=10;$start>$index;$start+=10){
> $mech->get("http://www.news.google.com/news?hl=en&ned=us&q=$search_string&btnG=Se...");
> @links=$mech->links();
> foreach $j (@links){
>         $p=$j->url_abs();
>         unless (($p=~/google/) || ($p=~/java/)){
>         print T  "$p\n";}
>         }
> sleep 10;
> $index+=10;}
>
> close T;
>
> Anyway, the rest is left to the student.
>
> --
> Greymaus
> The Republic says \"No\"
> Big Ian for president.



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

Date: Tue, 17 Jun 2008 10:40:52 +0200
From: Wolfgang Thomas <news@nana.franken.de>
Subject: Re: XML::Simple how to force hash generation for keys
Message-Id: <48577894$1@news.alcatel.com>

> The docs are kind of written from the package creator's perspective rather
> than the user's perspective.  Unless you know that arrays are an
> intermediate step between XML and final hash-based output, it is rather
> confusing to have to think about arrays that are behind the scene which you
> never see.  (But on the other hand, the docs do tell you that you should
> almost always have ForceArray on, and that having the default be for it to
> be off was a mistake.)

Xho, thanks for explaining the non-obvious aspects of the documentation.


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

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 V11 Issue 1650
***************************************


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