[31410] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2662 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 2 11:09:50 2009

Date: Mon, 2 Nov 2009 08:09:15 -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           Mon, 2 Nov 2009     Volume: 11 Number: 2662

Today's topics:
    Re: FAQ 4.74 How do I print out or copy a recursive dat <brian.d.foy@gmail.com>
    Re: FAQ 6.12 Can I use Perl regular expressions to matc <brian.d.foy@gmail.com>
    Re: FAQ 6.12 Can I use Perl regular expressions to matc sln@netherlands.com
    Re: FAQ 7.27 How can I comment out a large block of Per <nospam-abuse@ilyaz.org>
    Re: FAQ 7.27 How can I comment out a large block of Per <kst-u@mib.org>
    Re: FAQ 7.27 How can I comment out a large block of Per <brian.d.foy@gmail.com>
        How to process duplicate entries in tab separated file? <jegan473@comcast.net>
    Re: How to process duplicate entries in tab separated f <ben@morrow.me.uk>
    Re: How to process duplicate entries in tab separated f <cartercc@gmail.com>
        in place edit. <rodbass63@gmail.com>
    Re: in place edit. <ben@morrow.me.uk>
    Re: in place edit. sln@netherlands.com
        Posting Guidelines for comp.lang.perl.misc ($Revision:  tadmc@seesig.invalid
        Problem on subversion using propset with perl on a svn: <hartigan@sincity.real.life>
    Re: unintialised warning <hjp-usenet2@hjp.at>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 01 Nov 2009 15:09:12 -0600
From: brian d foy <brian.d.foy@gmail.com>
Subject: Re: FAQ 4.74 How do I print out or copy a recursive data structure?
Message-Id: <011120091509125694%brian.d.foy@gmail.com>

In article
<53ff71f9-854f-44e8-8f52-edc472bd3685@l33g2000vbi.googlegroups.com>,
Marc Girod <marc.girod@gmail.com> wrote:

> On Oct 26, 10:00 am, PerlFAQ Server <br...@theperlreview.com> wrote:
> 
> >     The "Data::Dumper" module on CPAN (or the 5.005 release of Perl) is
> >     great for printing out data structures. The "Storable" module on CPAN
> >     (or the 5.8 release of Perl), provides a function called "dclone" that
> >     recursively copies its argument.
> 
> Er... I don't remember the details, but I
> wasn't happy with the processing of file
> descriptors

You don't serialize filehandles, sockets, and the like.


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

Date: Sun, 01 Nov 2009 15:15:15 -0600
From: brian d foy <brian.d.foy@gmail.com>
Subject: Re: FAQ 6.12 Can I use Perl regular expressions to match balanced text?
Message-Id: <011120091515157475%brian.d.foy@gmail.com>

In article <qvqke5humoun2n4i1g3doegpfkau3hhind@4ax.com>,
<sln@netherlands.com> wrote:

>       (This form will cause a crash if unbalanced text sample)
> >     (?:
> >         [^<>]*+     # 0 or more non angle brackets, non backtracking
> >           |
> >         (?1)        # found <, so recurse to capture buffer 1
> >     )+
> >This avoids an unecessary recursion per <> pair, but does the same thing.
> >
> 
> No, no.. forget the above optimization. Since I just tried this on
> un-balanced text, it crashed Perl.

I don't get a crash, just an error which is entirely appriopriate:

Reference to nonexistent group in regex; marked by <-- HERE in m/(?:
      [^<>]*+     # one or more non angle brackets, non backtracking
        |
      (?1) <-- HERE         # found < or >, so recurse to capture
buffer 1
  )*/ at test.pl line 12.


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

Date: Sun, 01 Nov 2009 14:50:40 -0800
From: sln@netherlands.com
Subject: Re: FAQ 6.12 Can I use Perl regular expressions to match balanced text?
Message-Id: <jm3se59m1ujq9ai3jps5ddedmhk5s1o753@4ax.com>

On Sun, 01 Nov 2009 15:15:15 -0600, brian d foy <brian.d.foy@gmail.com> wrote:

>In article <qvqke5humoun2n4i1g3doegpfkau3hhind@4ax.com>,
><sln@netherlands.com> wrote:
>
>>       (This form will cause a crash if unbalanced text sample)
>> >     (?:
>> >         [^<>]*+     # 0 or more non angle brackets, non backtracking
>> >           |
>> >         (?1)        # found <, so recurse to capture buffer 1
>> >     )+
>> >This avoids an unecessary recursion per <> pair, but does the same thing.
>> >
>> 
>> No, no.. forget the above optimization. Since I just tried this on
>> un-balanced text, it crashed Perl.
>
>I don't get a crash, just an error which is entirely appriopriate:
>
>Reference to nonexistent group in regex; marked by <-- HERE in m/(?:
>      [^<>]*+     # one or more non angle brackets, non backtracking
>        |
>      (?1) <-- HERE         # found < or >, so recurse to capture
>buffer 1
>  )*/ at test.pl line 12.

Maybe you should try and run all the code instead of just a code
segment.

Try running this:
---------
use strict;
use warnings;

my @queue =<<"HERE";
I have so < <<<<>>>>me <brackets in <nested brackets> > and <another group <nested once <nested twice> > > and that's it.
HERE

my @enter;  # position queue of each nested level of bracket

my $regex = qr/

  (
     <    # open angle bracket
         (?{ push @enter,pos();
             print "\n*  enter <",scalar(@enter),"  at ",pos();
           })

           (?:
                [^<>]*+       # one or more non angle brackets, non backtracking
                  |
                (?{ print "\n    recurs     - ",pos();})

                (?1)          # recurse to open bracket (capture grp 1)
            )+
     >    # close angle bracket

     (?{ print "\n*  leave  ",scalar(@enter),"> at ",pos(),"  = Found:  ";
         print substr($_, $enter[$#enter]-1, 1+pos() - pop @enter);
       })                                    
  )
/x;

$" = "\n\t";
my $string = shift @queue;

$string =~ /$regex/g;

exit;

__END__
Well, here is what I get.
Call stack; at least a pointer is dereferenced outside the 
address space of allocated memory, namely location 0x00000000.

'perl.exe': Loaded 'C:\Perl\bin\perl.exe', No symbols loaded.
'perl.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', No symbols loaded.
'perl.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', No symbols loaded.
'perl.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll', No symbols loaded.
'perl.exe': Loaded 'C:\Perl\bin\perl510.dll', No symbols loaded.
'perl.exe': Loaded 'C:\WINDOWS\system32\user32.dll', No symbols loaded.
'perl.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll', No symbols loaded.
'perl.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll', No symbols loaded.
'perl.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll', No symbols loaded.
'perl.exe': Loaded 'C:\WINDOWS\system32\secur32.dll', No symbols loaded.
'perl.exe': Loaded 'C:\WINDOWS\system32\version.dll', No symbols loaded.
'perl.exe': Loaded 'C:\WINDOWS\system32\shlwapi.dll', No symbols loaded.
'perl.exe': Loaded 'C:\WINDOWS\system32\apphelp.dll', No symbols loaded.
The thread 'Win32 Thread' (0xe58) has exited with code 0 (0x0).
Unhandled exception at 0x2807e1b6 in perl.exe: 0xC0000005: Access violation reading location 0x00000000.

-sln



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

Date: Sun, 1 Nov 2009 20:42:50 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: FAQ 7.27 How can I comment out a large block of Perl code?
Message-Id: <slrnhersma.p90.nospam-abuse@powdermilk.math.berkeley.edu>

On 2009-10-31, Sherm Pendley <spamtrap@shermpendley.com> wrote:
> IMHO, I think the answer to this one should be restricted to what needs
> to be written in a Perl script to create a block comment. How to use
> various editors to write it is really a question about those editors; for
> instance, the Emacs command given above is the same no matter what
> language you happen to be editing, so it has nothing whatsoever to do
> with Perl.

While the Emacs command is indeed the same, the NEED to use it does depend
on absense of block comments.

Yours,
Ilya


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

Date: Sun, 01 Nov 2009 12:45:22 -0800
From: Keith Thompson <kst-u@mib.org>
Subject: Re: FAQ 7.27 How can I comment out a large block of Perl code?
Message-Id: <lnaaz6rn31.fsf@nuthaus.mib.org>

Sherm Pendley <spamtrap@shermpendley.com> writes:
> "Peter J. Holzer" <hjp-usenet2@hjp.at> writes:
>> While I agree that the specific ways to do this in various editors are
>> out of scope for a Perl FAQ, the answer should mention that good editors
>> make it easy to add and remove comments in a range of lines.
>
> How about this as an intro then:
>
> Many programming-oriented text editors provide an easy, language agnostic
> way to comment and uncomment a range of lines. Details about specific
> editors are beyond the scope of this FAQ, so check the docs, FAQ, or
> support forum for the editor you're using.
>
> But don't worry! If you're using an editor such as Notepad that lacks
> such a function, you're not entirely out of luck. The rest of this FAQ
> is for you, so keep reading.

Then I suggest that there are (at least) 3 distinct solutions.

1. Insert a '#' character at the beginning of each line.  (Most
decent editors have ways to do this efficiently, i.e., methods
for which the user effort is O(1) rather than O(N) in the number
of lines.)

2. Use your editor's command that comments out a block of code,
i.e., the same command might insert "//" if you're in C++ mode,
"#" if you're in Perl mode, etc.

3. Use "=pod" and "=cut".  (For large blocks of commented-out code,
this has the disadvantage that it's hard to see which lines are
commented out.)

And since 1 and 2 are merely different editor-specific ways
of accomplishing exactly the same thing, I wouldn't list them
separately, though a brief mention that some editors have a command
specifically intended to comment or uncomment blocks of code would
be fine.

I wouldn't object to a few lines explaining how to do this in vi and
emacs, but I'll gladly defer to the perlfaq-workers' judgement about
whether that would be appropriate.

>> Personally, I don't think I've ever used the =pod/=cut method to
>> "comment out a large block of Perl code", but always added "#"-marks to
>> the beginning of each line of the block.
>
> Neither have I - but I've never spent much time using an editor that
> didn't have a "(un)comment selected block" function either. :-)

If my editor has such a function, I don't know about it; I find
inserting '#' characters across a range of lines easier than
remembering the incantation.  YMMV.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Nokia
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"


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

Date: Sun, 01 Nov 2009 15:19:54 -0600
From: brian d foy <brian.d.foy@gmail.com>
Subject: Re: FAQ 7.27 How can I comment out a large block of Perl code?
Message-Id: <011120091519544595%brian.d.foy@gmail.com>

In article <m2iqdu5nvo.fsf@shermpendley.com>, Sherm Pendley
<spamtrap@shermpendley.com> wrote:

> "Peter J. Holzer" <hjp-usenet2@hjp.at> writes:
> 
> > While I agree that the specific ways to do this in various editors are
> > out of scope for a Perl FAQ, the answer should mention that good editors
> > make it easy to add and remove comments in a range of lines.
> 
> How about this as an intro then:
> 
> Many programming-oriented text editors provide an easy, language agnostic
> way to comment and uncomment a range of lines. 

I've always thought that the implicit assumption of the question was
that it was asking about how to do it without doing it line-by-line,
even if you do automate it. 

I think the answer is fine the way it is. If people want to do
something in the privacy of their terminal, that's between them and
their editor.


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

Date: Mon, 02 Nov 2009 01:30:23 GMT
From: James Egan <jegan473@comcast.net>
Subject: How to process duplicate entries in tab separated file?
Message-Id: <PCqHm.133106$Gs.53344@en-nntp-01.dc1.easynews.com>

In the __DATA__ below, there are two duplicate entries which occur twice, 
07020000279 and 05020004293, which are customer numbers.  What I need to 
do is find any duplicate customer numbers in a file, and print (write) 
them.  

-Thanks


#!/usr/bin/perl

use strict;
use warnings;


use vars qw(
  @file
  @fields
  $fields
  $line
  $ctr
  $custno
  @customers
);


  while ( <DATA> ) {
    push(@file, $_);
  }

my @matches = grep $line eq '07020000279', @file;

foreach $line (@file) {

print $line;

} 


__DATA__
07020000279	Joe	Smith	54 Abbey Road
05020033486	John Jones	98 New York Ave.
07020000279	George Washington	234 Washington Ave.
06020004293	Fred Flintstone	123 Main St.
05020004293	Wilma Flintstone	Bedrock Road
0302004472	Fred Jones	98 New York Ave. 


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

Date: Mon, 2 Nov 2009 01:51:14 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: How to process duplicate entries in tab separated file?
Message-Id: <ihq1s6-aff2.ln1@osiris.mauzo.dyndns.org>


Quoth James Egan <jegan473@comcast.net>:
> In the __DATA__ below, there are two duplicate entries which occur twice, 
> 07020000279 and 05020004293, which are customer numbers.  What I need to 
> do is find any duplicate customer numbers in a file, and print (write) 
> them.  

perldoc -q duplicate. The answer doesn't apply as it stands, but
modifying the concept to record duplicates instead of discarding them is
not difficult.

Ben



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

Date: Mon, 2 Nov 2009 05:10:18 -0800 (PST)
From: ccc31807 <cartercc@gmail.com>
Subject: Re: How to process duplicate entries in tab separated file?
Message-Id: <6902ec39-8427-40c0-991d-0f22a1987af5@d5g2000yqm.googlegroups.com>

On Nov 1, 8:30=A0pm, James Egan <jegan...@comcast.net> wrote:
> In the __DATA__ below, there are two duplicate entries which occur twice,
> 07020000279 and 05020004293, which are customer numbers. =A0What I need t=
o
> do is find any duplicate customer numbers in a file, and print (write)
> them.

Use a hash to store your data, with the customer number as the key to
the hash. The keys of a hash are guaranteed to be unique, therefore
you will never have a duplicate entry.

Then, when you are initializing the hash from the data, test each hash
key to see if it has already been initialized, and if it has, write
the record to an error file. Something like this (untested)

while (<DATA>)
{
  chomp;
  my ($id, $fn, $ln, $addy) =3D split;
  print "$id is duplicate: $fn $ln, $addy\n" if $customers{$id};
  $customers{$id} =3D "$fn, $ln, $addy" unless $customer{$key};
}


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

Date: Mon, 2 Nov 2009 06:39:21 -0800 (PST)
From: Nene <rodbass63@gmail.com>
Subject: in place edit.
Message-Id: <67d6a479-a52b-455f-9e70-fe68b080830d@a21g2000yqc.googlegroups.com>

I used the same code below (provided by Randy) to do in place edits on
a config file and it works great, but I when I try to use the same
code for an html file, it does not work.

###Below is the code###

#!/usr/bin/perl -w
use strict;
use warnings;
my $stuff = "</tr>";

my $a = "insert_text_here\n";
    {
      local @ARGV = "misc.txt";
      local $^I = ".bak"; # appended to the backup copy
      while (<>) {
        if ((/$stuff/..!/$stuff/) =~ /E/) { # if we're at the end of
the Listens
          $_ = $a . $_; # prepend the line to the next line
        }
        print; # but print whatever we have
      }
    }




###Below is the result of the script when I run it#



<tr>
<td>http://xxx.xxx.xxx.xxx</td>
<td>
<a href='https://xxx:8002'>
https://xxx.xxx.xxx.xxx:8002
</a>
</td>
</tr>
insert_text_here
<tr>
<td>http://xxx.xxx.xxx.xxx</td>
<td>
<a href='https://xxx.xxx:8010'>
https://xxx.xxx.xxx:8010
</a>
</td>
</tr>
insert_text_here
<tr>
<td>http://xxx.xxx.xxx.xxx:8145</td>
<td>
<a href='https://xxx.xxx.xxx:8148'>
https://xxx.xxx.xxx:8148
</a>
</td>
</tr>
insert_text_here


Text in this line
Text in this line
Text in this line
####

As you can see "insert_text_here" is appended at the bottom of every
"</tr>"; I only want it appended to the last "</tr>".
If this is not possible, is there a module that will read a specific
number of lines backwards and then insert?


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

Date: Mon, 2 Nov 2009 15:12:26 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: in place edit.
Message-Id: <qf93s6-eav2.ln1@osiris.mauzo.dyndns.org>


Quoth Nene <rodbass63@gmail.com>:
> 
> As you can see "insert_text_here" is appended at the bottom of every
> "</tr>"; I only want it appended to the last "</tr>".

How is the program supposed to know that it has reached the last </tr>?
Even if it finds the </tr> that balances the first <tr>, there could be
more <tr>..</tr> pairs after this.

> If this is not possible, is there a module that will read a specific
> number of lines backwards and then insert?

Just pull the whole file into memory and do the insert there.

Ben



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

Date: Mon, 02 Nov 2009 08:08:37 -0800
From: sln@netherlands.com
Subject: Re: in place edit.
Message-Id: <5q0ue5pvkptdcftccb03on06p0gjnit66r@4ax.com>

On Mon, 2 Nov 2009 06:39:21 -0800 (PST), Nene <rodbass63@gmail.com> wrote:

>I used the same code below (provided by Randy) to do in place edits on
>a config file and it works great, but I when I try to use the same
>code for an html file, it does not work.
>
>###Below is the code###
>
>###Below is the result of the script when I run it#
>
>As you can see "insert_text_here" is appended at the bottom of every
>"</tr>"; I only want it appended to the last "</tr>".
>If this is not possible, is there a module that will read a specific
>number of lines backwards and then insert?

Something like this.. where you adapt it to create a new file.

use strict;
use warnings;

my $line_to_insert = "insert\n";
my $last;
open DATA, '<data.txt' or die "can't open data.txt: $!";

    {
      while (<DATA>) {
        $last = tell(DATA) if /<\/tr>/;
      }
      if (defined $last) {
         seek DATA,0,0;
         while (<DATA>) {
             print;
             print $line_to_insert if tell(DATA) == $last;
         }
      }
    }
close DATA;

__END__

-sln


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

Date: Mon, 02 Nov 2009 09:59:39 -0600
From: tadmc@seesig.invalid
Subject: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.9 $)
Message-Id: <zPGdnU18X5V2nHLXnZ2dnUVZ_gWdnZ2d@giganews.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.9 $)
    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_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: Mon, 02 Nov 2009 15:17:28 +0100
From: Hartigan <hartigan@sincity.real.life>
Subject: Problem on subversion using propset with perl on a svn:external
Message-Id: <ePBHm.23587$813.17805@tornado.fastwebnet.it>

Hi all,
i'm working to create some perl scripts to make changes on a svn(subversion)
respository. One of this script try to change a svn:external but i have
a problem to do this with the propset().

I have a testing repository with this path

http://localhost/svn/testing/develop_area/mail

under this directory there are two svn:externals:

[laforge:302]$svn propget svn:externals http://localhost/svn/testing/develop_area/mail/
stable http://localhost/svn/testing/main/mail/branches/maintenance-release-1.64
develop http://localhost/svn/testing/main/mail/trunk

With perl i want to change the stable external to a new branch and this
a expert of the script that try to make this change:

[...]
print "Get svn:external\n";
print "================\n";
my $hash =
$ctx->propget("svn:externals","http://localhost/svn/testing/develop_area/mail",$revision,"0");
my $newexternal="";
my $setprop="";
my ($key, $value) = each(%$hash);
        print "Key:$key\n\nValue:\n$value\n";
	my $count="1";
	foreach (split(/\n/,$value)) {
                        my $external=$_;
                        print "-----------------\n";
                        print "External$count: $external\n";
			$count++;
			my @exter=split(/\s+/,$external);
				print "+++++++++++++++++++++\n";
				print "\tName: $exter[0]\n";
				print "\tUrl:  $exter[1]\n";
			if ( $exter[0] eq "stable" ) {
				$exter[1]="https://localhost/svn/testing/main/mail/branches/maintenance-release-1.65";
				$setprop="1";
			}
			$newexternal=$newexternal."$exter[0] $exter[1]\n";
	}


print "\n\n\n";
if ( $setprop eq "1" ) {
	print "Set svn:external\n";
	print "================\n";
	print "Key:$key\n\n";	
	print "Value:\n";
	print $newexternal;
	$ctx->propset("svn:externals",$newexternal,"http://localhost/svn/testing/develop_area/mail","0");
} else {
	print "Value:\n";
	print $value;	
}
[...]

Running the script i have an error during the operation:

[laforge:303]$./update-svn.pl
Connect operation
================
Set log message
================
Get svn:external
================
Key:http://localhost/svn/testing/develop_area/mail

Value:
stable
http://localhost/svn/testing/main/mail/branches/maintenance-release-1.64
develop http://localhost/svn/testing/main/mail/trunk

-----------------
External1: stable
http://localhost/svn/testing/main/mail/branches/maintenance-release-1.64
+++++++++++++++++++++
        Name: stable
        Url:
http://localhost/svn/testing/main/mail/branches/maintenance-release-1.64
-----------------
External2: develop      http://localhost/svn/testing/main/mail/trunk
+++++++++++++++++++++
        Name: develop
        Url:  http://localhost/svn/testing/main/mail/trunk



Set svn:external
================
Key:http://localhost/svn/testing/develop_area/mail

Value:
stable https://localhost/svn/testing/main/mail/branches/maintenance-release-1.65
develop http://localhost/svn/testing/main/mail/trunk

i have this error:

Uncaught exception from user code:
        Bogus revision information given: Setting property on non-local target
'http://localhost/svn/testing/develop_area/mail' needs a base revision at ./update-svn.pl line 84
 at /usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread-multi/SVN/Core.pm line 632
        SVN::Error::croak_on_error('_p_svn_error_t=SCALAR(0x947ff44)') called at
/usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread-multi/SVN/Client.pm line 927
        SVN::Client::__ANON__(undef, 'svn:externals', 'stable
https://localhost/svn/testing/main/mail/branches/maint...', 'http://localhost/svn/testing/develop_area/mail', 0) called
at ./update-svn.pl line 84

With the cli command i can change the svn:externals without problem.

I'm on linux, distribution Fedora 10
Subversion command-line client, version 1.6.5.
Summary of my perl5 (revision 5 version 10 subversion 0) configuration:

Rpm package version:
subversion-1.6.5-1.fc10.1.i386
subversion-perl-1.6.5-1.fc10.1.i386
mod_dav_svn-1.6.5-1.fc10.1.i386

Anyone have an idea about this problem ?
Any idea on how change a svn:externals via perl on a remote repository?

Thank you


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

Date: Sun, 1 Nov 2009 20:03:30 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: unintialised warning
Message-Id: <slrnherms3.bas.hjp-usenet2@hrunkner.hjp.at>

On 2009-11-01 18:43, sln@netherlands.com <sln@netherlands.com> wrote:
> On Sun, 1 Nov 2009 15:32:17 -0000, "John" <john1949@yahoo.com> wrote:
>>The following can cause a warning  if undefined
>>
>>my $value=$PAR{$name};
>>
>>What the best solution?
>>
>>my $value=$PAR{$name }or $value='';
>>or
>>my $value=''; if (defined $PAR{$name}) {$value=$PAR{$name}}
>>or
>>is there a cleaner solution?
>
> The only uninitialized warning would be if $name were undefined
> when you try to use it, ie: $PAR{$name}. It is always legitimate
> to assing undef to a scalar variable.
>
> Don't be confused between logical's  'or' and ||. They both do the
> same logical test form, but 'or' is used for control flow.

Both 'or' and '||' have the same effect on control flow, i.e., both are
short-circuiting operators. The only difference is that 'or' has lower
precedence so sometimes you can avoid typing a pair of parentheses.

	hp


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

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:

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

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#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 2662
***************************************


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