[23789] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5992 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 30 06:05:43 2003

Date: Tue, 30 Dec 2003 03:05:06 -0800 (PST)
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, 30 Dec 2003     Volume: 10 Number: 5992

Today's topics:
    Re: Config file for Perl install (Anno Siegel)
        Earn money by completing serveys, not points!!! <jatonblue@bellsouth.net>
    Re: Encrypting executable or embedding in C <jwillmore@remove.adelphia.net>
    Re: Encrypting executable or embedding in C <jwillmore@remove.adelphia.net>
    Re: Encrypting executable or embedding in C <jwillmore@remove.adelphia.net>
    Re: Encrypting executable or embedding in C <tom@nosleep.net>
        Make Money Fast And Easy, Hurry! James@localstreet.com
    Re: Need advice on spell-checking for city names <dragnet@internalysis.com>
    Re: Newbie Question on Deleting Logs Script (Anno Siegel)
        PerlCtrl and sending back events (Paolo Asioli)
        Posting Guidelines for comp.lang.perl.misc ($Revision:  tadmc@augustmail.com
    Re: Re[1]: Calling a scalar from another script using " <jasonahood@btinternet.com>
        small regexp problem (David Morel)
    Re: small regexp problem <krisajenkins@yahoo.co.uk>
    Re: small regexp problem <noreply@gunnar.cc>
    Re: Use a Perl_Interpreter and NOT call it my_perl?  Us <zen13097@zen.co.uk.no.spam>
    Re: writting an 'in' keyword for perl <bik.mido@tiscalinet.it>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 30 Dec 2003 09:37:22 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Config file for Perl install
Message-Id: <bsrh0i$imj$1@mamenchi.zrz.TU-Berlin.DE>

xman <imiller@bsd.uchicago.edu> wrote in comp.lang.perl.misc:
> Yes I am a sysadmin not a programer..

So?

> So here is the question   Is their a configuration file for which compiler
> is used by perl 5.8.0   ?

Perl doesn't use a compiler, but a compiler was used to build perl.
"perl -V:cc" tells you which.

See "perldoc Config" for more detailed information.

Anno


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

Date: Tue, 30 Dec 2003 09:12:33 GMT
From: "paul" <jatonblue@bellsouth.net>
Subject: Earn money by completing serveys, not points!!!
Message-Id: <5kbIb.44188$uh1.2155@bignews6.bellsouth.net>


Dear Everyone 

For those people who are signed up with servey sites that give you points for completing serveys and you redeam them for cash, LEAVE THEM! 

I recently registered to be a member of SurveySavvy.com to participate in surveys online that pays you real cash, not points that are worthless. 
If you join, you can get paid when you participate in surveys. When you refer friends, you will get paid for their participation and their friends' participation. They pay cash! Check out the Earnings Calculator in the Refer Friends section: http://www.surveysavvy.com/index.cfm?fa=referrals.calculator&id=1170279

Go to http://www.surveysavvy.com/?id=1170279 and click on 'Join'. If my personal referral link above does not take you to the SurveySavvy web site when you click on it, simply copy and paste it into the address window of your browser. For future reference, my referral e-mail address is: jatonblue@bellsouth.net

Have fun, 

Paul Tolbert 


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

Date: Tue, 30 Dec 2003 05:13:01 GMT
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: Encrypting executable or embedding in C
Message-Id: <20031230001231.2baeebab.jwillmore@remove.adelphia.net>

On Mon, 29 Dec 2003 16:09:58 -0800
"Tom" <tom@nosleep.net> wrote:

> 
> "Tom" <tom@nosleep.net> wrote in message
> news:3ff0aa69@nntp0.pdx.net...
> > Hi
> >
> > Can someone point me to information regarding either encrypting a
> > perl
> file
> > so it can still execute (if this is possible), or embedding a
> > 10,000+ line script completely into a C/C++ program.
> >
> > It also needs to encapsulate all included libraries, etc.
> >
> 
> The goal is for the program to still be executable, while protecting
> the source.
> The program is running on Linux, but I may need it ported to some
> other flavor than Redhat.
> I want to be able to run it remotely on a server, while keeping it
> safe from being stolen and viewed or modified.

Please, please, please ..... do a Goggle search for this topic (try
the keywords "comp.lang.perl.misc protect source code" to start). 
There are *many* threads on this *exact* topic.

The *very* short answer is it can't be done.  The long answer is in
the *many* threads on this topic.

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
It's raisins that make Post Raisin Bran so raisiny ... 



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

Date: Tue, 30 Dec 2003 05:08:39 GMT
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: Encrypting executable or embedding in C
Message-Id: <20031230000838.3a6ce382.jwillmore@remove.adelphia.net>

On Mon, 29 Dec 2003 16:09:58 -0800
"Tom" <tom@nosleep.net> wrote:

> 
> "Tom" <tom@nosleep.net> wrote in message
> news:3ff0aa69@nntp0.pdx.net...
> > Hi
> >
> > Can someone point me to information regarding either encrypting a
> > perl
> file
> > so it can still execute (if this is possible), or embedding a
> > 10,000+ line script completely into a C/C++ program.
> >
> > It also needs to encapsulate all included libraries, etc.
> >
> 
> The goal is for the program to still be executable, while protecting
> the source.
> The program is running on Linux, but I may need it ported to some
> other flavor than Redhat.
> I want to be able to run it remotely on a server, while keeping it
> safe from being stolen and viewed or modified.

Please, please, please ..... do a Goggle search for this topic (try
the keywords "comp.lang.perl.misc protect source code" to start). 
There are *many* threads on this *exact* topic.

The *very* short answer is it can't be done.  The long answer is in
the *many* threads on this topic.

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
It's raisins that make Post Raisin Bran so raisiny ... 



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

Date: Tue, 30 Dec 2003 05:21:03 GMT
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: Encrypting executable or embedding in C
Message-Id: <20031230002103.33094a3d.jwillmore@remove.adelphia.net>

On Tue, 30 Dec 2003 05:13:01 GMT
James Willmore <jwillmore@remove.adelphia.net> wrote:

My ISP, newsreader, and me had a disagreement - so, this one got
posted twice :-(

Sorry :-(

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
Whether you can hear it or not The Universe is laughing behind
your back   -- National Lampoon, "Deteriorata" 


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

Date: Mon, 29 Dec 2003 22:20:57 -0800
From: "Tom" <tom@nosleep.net>
Subject: Re: Encrypting executable or embedding in C
Message-Id: <3ff124e5$1@nntp0.pdx.net>

>
> The *very* short answer is it can't be done.  The long answer is in
> the *many* threads on this topic.
>
I just wanted the short answer, thanks.
Tom




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

Date: Tuesday, 30 Dec 2003 01:38:11 -0600
From: James@localstreet.com
Subject: Make Money Fast And Easy, Hurry!
Message-Id: <30120301.3811@localstreet.com>


Follow the directions below and in two weeks you'll have up to
$20000.00 in your PayPal account. There is a very high rate of
participation in the program because of its low investment and high
rate of return. Just $5.00 to one person!

THAT'S ALL !!!

If you are a skeptic and don't think the program will work, I urge
you to give it a try anyway! It REALLY WORKS! Why do you
think so many people are promoting it ?

LOOK AT IT THIS WAY: If the Program is a total failure for you and you
never get even $1.00 in return, your total loss will
be the $5.00! If you are not yet a paypal member, there is no risk at
all!!! If the Program is only moderately successful for
you, your PayPal account will have several hundred dollars deposited
into it within the next few days! If you actively
participate in the Program, you could have up to $20,000.00 in your
PayPal account within two weeks!

Now let me tell you the simple details.

Getting Started!!

If you're not already a user of PayPal, the very first thing you need
to do is go to PayPal and sign up. It takes two minutes
and Pay Pal will deposit $5.00 in your account just for becoming a
member. That makes this program's total cost $0!!! Follow
this link to open your PayPal account:

https://www.paypal.com

Now log into your PayPal account, and send the PayPal account of the
person listed in Position 1 $5.00 PayPal will ask you to
select type. (Select "service" and put "$5.00 donation" for
subject.) When person in Position 1 receives notification of your
payment, you can simply copy this page and change the names in
position #1 & #2 & #3 as instructed. Remember, only the person
in Position 1 on the list gets your $5.00 donation. Send them a
donation then remove #1PayPal account from the list. Move the
other two accounts up & add your Paypal account to #3 position. After
you have retyped the names in the new order,

IMMEDIATELY send the revised message to as many people as possible.
PROMOTE! PROMOTE! The more you promote the Program, the
more you will receive in donations!! That's all there is to it.

When your name reaches Position 1 (usually in less than a week) it
will be your turn to receive the cash. $5.00 will be sent
to your PayPal account by people just like you who are willing to send
$5.00 donation and receive up to $20,000 in less than
two weeks. Because there are only (3) names on the list you can
anticipate 80% of your cash within two weeks.

Anytime you find yourself short on cash just take out your $5.00
donation program and send it to 50 prospects. Imagine if you
sent it to 100 or even more. Most people spend more than $5 on the
lottery every week with no real hope of ever winning.

THIS PROGRAM WORKS - JUST TRY IT


POSITION # 1 PAYPAL ACCOUNT: sheripy@yahoo.com

POSITION # 2 PAYPAL ACCOUNT: snritanita@hotmail.com

POSITION # 3 PAYPAL ACCOUNT: James@localstreet.com


Integrity and honesty make this plan work.
Participants who actively promote this program will average between $8000
and
$12000 and receive the donations within two weeks.

This is not a chain letter. You are simply making a donation of $5.00
to another person. The Program does not violate title
18 section 1302 of the Postal and lottery code.

Remember -TIME is of the essence. YOU can choose to live
Paycheck-to-Paycheck or live FREE from FINANCIAL BONDAGE. Become a
part of the donation program and help people help people.

This program is about helping each other!

Success is a journey - Not a destination!

Start Your Journey TODAY!!!!

--comments/feeback(please post your feedback/experiences here)---

 
 Not bad for 1 hr's work....made me around $5320 in roughly 35 days
 Anthony M Texas

 Hello, i rcvd 270 bucks in the post in 2 weeks. Dan Miami, FL

 I've received 35 dollars so far Samantha, Rhode Is.

 I had to wait around 10 days before I had any results - $13,450 as of
 3rd Jan 2003 to date (14th Feb 2003). I am gonna re-post it again for
 more money!!
 Del from Alberta - Canada

 Only received around £590 in the post the last 2 months since I
 started the program but I'd posted to approx. 100 newsgroups.
 James P Manchester UK

 cool....didn't expect much out of this initially but I've been making
 enough to pay my credit card bills. Great!!!
 Mustafa , Jordan

 I have received money from people all over the world...here in China
 it is very good money and i buy new computer last month
 Zhong Wen ...Guangxi CHina

 For $5,I made $245 in 2 weeks --ROMEO2326 little rock,AR US of A

 Hey, juts droppin a line to say that after posting to well over 820
 newsgroups on google and my ISP newsgroup server over a period of 4
 1/2 months ,Ive raked in $54280 . Mucho dinero baby!!!! peace, Drew
 Dallas TX



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

Date: Tue, 30 Dec 2003 06:02:57 GMT
From: Marc Bissonnette <dragnet@internalysis.com>
Subject: Re: Need advice on spell-checking for city names
Message-Id: <Xns9461AAF81F5Bdragnetinternalysisc@206.172.150.13>

Abigail <abigail@abigail.nl> wrote in
news:slrnbv1j9t.cd.abigail@alexandra.abigail.nl: 

> Marc Bissonnette (dragnet@internalysis.com) wrote on MMMDCCLXXIII
> September MCMXCIII in
> <URL:news:Xns9460C40C08161dragnetinternalysisc@207.35.177.135>: []  Hi
> all; []  
> []  I'm hoping someone can point me in the direction of an FAQ or
> other []  appropriate reading material in order to learn how to solve
> my problem. []  
> []  I have users submitting multiple city names in a perl application
> and this []  often results in multiple spellings, depending either on
> their local []  dialect, mis-spellings, or copy-and-pasting from a
> micro$oft app. []  
> []  For example, the city of Montréal has appeared as
> []  
> []  Montréal
> []  Montreal
> []  MontrÈal
> []  
> []  Or I'll get close-but-not-correct spellings, like 
> []  
> []  Ottawa (correct)
> []  Otawa
> []  Ottawaa
> []  Autawa
> []  
> []  etc. 
> []  
> []  How can I go about reducing the numbers of these incidences ?
> Providing []  menus of all possible cities is not feasible, since
> there are multiple []  areas within each province that each need a
> city list... 
> 
> 
> You might want to take a look at the Text::Soundex or the
> String::Approx module. 

Many thanks, Abigail - will start reading both of those right away. 

> Or you could ask for a zip code instead of a
> city name. 

That would be the logical thing to do, yeah, but with this particular 
application, it needs to cater to the LCD in what people find most 
comfortable (and given that the services it looks up are not always 
contiguous throughout some of our rather vast geographical postal code 
areas, I had to nix it :(

-- 
Marc Bissonnette
CGI / Database / Web Management Tools: http://www.internalysis.com
Something To Sell? Looking To Buy? http://www.whitewaterclassifieds.ca
Looking for a new ISP? http://www.canadianisp.com


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

Date: 30 Dec 2003 10:45:43 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Newbie Question on Deleting Logs Script
Message-Id: <bsrl0n$lnf$1@mamenchi.zrz.TU-Berlin.DE>

Clifford Bracht <beaton@franklincollege.edu> wrote in comp.lang.perl.misc:
> I was asked to create a Perl script that is able to when it runs
> delete Performance logs that are 30 days old from the current date on
> a Windows Platform.  I didn't know Pearl prior to this and this is
> only after about 5 days of trying to teach myself.  Here is my code. I
> was just wondering if anyone could lend some helpful suggestions that
> could maybe clear things up or get me going on the right path if I'm
> not already there.  Thanks

Your code (now snipped) is beyond repair.

You are much too concerned about the date calculations.  Perl has
a file test operator "-M" that returns the age of a file (time since
last modification, "perldoc -f -X" for details) in days directly.
So, to decide if a file whose name is in $file should be deleted,
just do

    delete $file if -M $file >= 30;

To find the candidates in the first place, use the File::Find module.
See "perldoc File::Find" for more.

Anno


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

Date: 30 Dec 2003 00:44:53 -0800
From: asioli@libero.it (Paolo Asioli)
Subject: PerlCtrl and sending back events
Message-Id: <62e8b5d1.0312300044.6a5531bc@posting.google.com>

Does anyone know how to send back events from a COM object created
with PerlCtrl to the caller application during processing ?

Thank you in advance.

Paolo


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

Date: Tue, 30 Dec 2003 02:22:10 -0600
From: tadmc@augustmail.com
Subject: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.5 $)
Message-Id: <R_SdnWbRYcQvqGyiRVn-tw@august.net>

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.5 $)
    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://mail.augustmail.com/~tadmc/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 

    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 <tadmc@augustmail.com> and many others on the
    comp.lang.perl.misc newsgroup.



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

Date: Tue, 30 Dec 2003 09:59:55 +0000 (UTC)
From: "Jason Hood" <jasonahood@btinternet.com>
Subject: Re: Re[1]: Calling a scalar from another script using "require"
Message-Id: <bsriap$6l6$1@sparta.btinternet.com>

or you can include it in the @INC path
=20
use lib('PATH','ANOTHERPATH');

J

"Regent" <arthur0421@163.com> wrote in message =
news:bsqli7$6sh$1@mail.cn99.com...
>=20
> ------------------------
>   Mon, 29 Dec 2003 03:53:17 +0000 (UTC)  =A3=ACDavid Efflandt wrote:
> >If I just used -w switch (and put a newline in print "$root\n";),
> >I got:
> >
> >Name "main::root" used only once: possible typo at ./mytest line 3.
> >/root
> >
> >Inserting a use vars line got rid of the warning:
> >
> >use vars ('$root');
> >require "common.pl";
> >print "$root\n"
> >
> >If I used -wT, "." (current dir) was apparently excluded from @INC, =
so I
> >had to use a full path to common.pl (same output).
>=20
> Yeah, this is a problem. If common.pl isn't in one of the paths =
already indicated in @INC, I must specify its full path in every script, =
right?
>=20
> >Tested in perl v5.6.1 built for i586-linux and v5.8.0 built for
> >i586-linux-thread-multi
> >
> >--=20
> >David Efflandt - All spam ignored  http://www.de-srv.com/
> >PS: All mail referencing [1-9]63\.(com|net) is automatically dropped =
due
> >to excessive uncontrolled spam.
>=20
> ------------------------
>              Regent
>              arthur0421@163.com
>=20


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.556 / Virus Database: 348 - Release Date: 26/12/2003


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

Date: 29 Dec 2003 23:46:35 -0800
From: altalingua@hotmail.com (David Morel)
Subject: small regexp problem
Message-Id: <60c4a7b1.0312292346.670800ab@posting.google.com>

Hi all,

It's been a while since I've used regular expressions, and I'd like a
bit of help.

I have a string of html --- $html. What I want to do is to isolate the
substrings that are in between a particular tag... say between <b> and
</b>.

So if $html = "asdf asdf asdf <b>foo</b> asdf asdf asdf <b>bar</b>", I
would like to somehow get "foo" and "bar" into an array.

This seems like it would be easy with the appropriate regexp.

Thanks!


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

Date: Tue, 30 Dec 2003 08:40:44 +0000
From: Kris Jenkins <krisajenkins@yahoo.co.uk>
Subject: Re: small regexp problem
Message-Id: <3ff139e9$0$18031$cc9e4d1f@news.dial.pipex.com>

David Morel wrote:
> Hi all,
> 
> It's been a while since I've used regular expressions, and I'd like a
> bit of help.
> 
> I have a string of html --- $html. What I want to do is to isolate the
> substrings that are in between a particular tag... say between <b> and
> </b>.
> 
> So if $html = "asdf asdf asdf <b>foo</b> asdf asdf asdf <b>bar</b>", I
> would like to somehow get "foo" and "bar" into an array.
> 
> This seems like it would be easy with the appropriate regexp.
> 
> Thanks!

Have a look at the document HTML::Tree:Scanning, under the "Scanning 
HTML Trees" heading.  It gives a couple of recipes, suggests why regexs 
may be a little fragile for this task, and why HTML::TreeBuilder _might_ 
be better*.  (You can get it by CPANing HTML::Tree.)

* For a given value of 'better'.

Kris


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

Date: Tue, 30 Dec 2003 11:23:00 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: small regexp problem
Message-Id: <bsrk9a$md4b$1@ID-184292.news.uni-berlin.de>

David Morel wrote:
> I have a string of html --- $html. What I want to do is to isolate
> the substrings that are in between a particular tag... say between
> <b> and </b>.
> 
> So if $html = "asdf asdf asdf <b>foo</b> asdf asdf asdf <b>bar</b>",
> I would like to somehow get "foo" and "bar" into an array.
> 
> This seems like it would be easy with the appropriate regexp.

It rather seems like you should explore one of the modules for parsing
HTML, such as HTML::Parser.

But I still had to play with a regex...  I used the one from

     perldoc -q "remove HTML"

as a starting point for writing a sub, that captures the substrings in
a reference to a hash of arrays:

     sub extract {
         my ($html, $elements) = @_;
         my %substrings;
         for my $elem (@$elements) {
             while ( $$html =~ m{
               <\s*($elem)\b(?:[^>'"]*|(['"]).*?\2)*>
               (.+?)
               <\s*/\s*$elem\s*>}gisx ) {
                 push @{$substrings{$1}}, $3;
             }
         }
         return \%substrings;
     }

     my $html = <<HTML;
asdf asdf asdf <b>foo</b> asdf asdf asdf <b>bar</b>
<a href="http://search.cpan.org/">search.cpan.org</a>
HTML

     my $substrings = extract( \$html, [ qw/a b/ ] );

     for ( keys %$substrings ) {
         print "Element: $_\n";
         for ( @{ $substrings->{$_} } ) {
             print "  $_\n";
         }
         print "\n";
     }

Outputs:
Element: a
   search.cpan.org

Element: b
   foo
   bar

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



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

Date: 30 Dec 2003 08:15:01 GMT
From: Dave Weaver <zen13097@zen.co.uk.no.spam>
Subject: Re: Use a Perl_Interpreter and NOT call it my_perl?  Use TWO interpreters?
Message-Id: <slrnbv2d05.r5m.zen13097@dontmind.net>

On Tue, 30 Dec 2003 01:07:02 +0100, Torsten Mohr <tmohr@s.netic.de> wrote:
>  
>  Also, i wonder if it is somehow still possible to
>  use TWO instances of "Perl_Interpreter".
>  
>  I don't want to fork a subprocess or use threads in
>  the perl script itself, i'd like to use TWO instances
>  of Perl_Interpreter.
>  

Looks like "my_perl" is hard-coded into perl.h

I got around this problem using C++ by having a class to represent
the Perl interpreter with a member variable called my_perl:

    class Perl {

      public:
	Perl();
	~Perl();

      // ...

      private:
	PerlInterpreter *my_perl;
    };

    Perl::Perl() {
	my_perl = perl_alloc();
	if (my_perl != NULL) {
	    perl_construct(my_perl);
	    char *dummy_argv[] = { "", "-e", "0" };
	    perl_parse(my_perl, NULL, 3, dummy_argv, NULL);
	}
    }   

    Perl::~Perl() {
	perl_destruct(my_perl);  
	perl_free(my_perl); 
    }   

Don't know if you can come up with a similar work-around for C
though.

Cheers,
Dave.


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

Date: Wed, 31 Dec 2003 09:11:48 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: writting an 'in' keyword for perl
Message-Id: <3iu3vvsh34o6ulbvumlbh57lv25vrfu0qu@4ax.com>

On 29 Dec 2003 10:36:27 -0800, noylwigymea@hotmail.com (David) wrote:

>I can't count how many times I've wanted to write a statement like
>this:
>
>if ($val in @vals){
>    # do my stuff
>}

Not exactly the same thing, but a simple minded approach may work too:


  #!/usr/bin/perl -l
  
  use strict;
  use warnings;
  
  sub is { bless \(shift), 'brb' }
  
  sub brb::in {
      my $test=${shift,};
      $test eq $_ and return 1 for @_;
      undef;
  }
  
  for (qw/foo bar/) {
      print if is($_)->in(qw/fred gnat foo/);
  }
  
  __END__


Then if you really need to, I guess you may use some source filter to
change

  <token> in <EXPR>

into

  is->(<token>)->in(<EXPR>)

Not that I have tried source filters myself, but

  perldoc Filter::Simple

says it is not so difficult after all. Oh, well just let's try it
soon...

  
  package provides_in;
  
  use strict;
  use warnings;
  use Filter::Simple;
  
  sub main::is { bless \(shift), 'brb' }
  
  sub brb::in {
      my $test=${shift,};
      $test eq $_ and return 1 for @_;
      undef;
  }
  
  FILTER_ONLY code => sub { 
      s/(\$\w+)\s+in\s+(\@\w+)/is($1)->in($2)/g
  };
  
  1;
  __END__


  #!/usr/bin/perl -l
  
  use strict;
  use warnings;
  use provides_in;
  
  my @vals=qw/fred gnat foo/;
  
  for (qw/foo bar/) {
      print if $_ in @vals;
  }
  __END__


Wow, it works! Bear in mind though that this is only a very rough
approximation, conjured up in a few minutes!


HTH,
Michele
-- 
# This prints: Just another Perl hacker,
seek DATA,15,0 and  print   q... <DATA>;
__END__


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

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.  

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 5992
***************************************


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