[24973] in Perl-Users-Digest
Perl-Users Digest, Issue: 7223 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 8 09:06:58 2004
Date: Fri, 8 Oct 2004 06:05:08 -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 Fri, 8 Oct 2004 Volume: 10 Number: 7223
Today's topics:
any tools to enable test automation for scripting langu (matt)
Re: Find::Find <Joe.Smith@inwap.com>
Re: finding the last element in a referenced array (Heinrich Mislik)
getting telnet banner <zebee@zip.com.au>
How to automatically log in a web page? <nntp@rogers.com>
Re: How to automatically log in a web page? <nobull@mail.com>
Re: How to flush a stinkin' socket? <ThomasKratz@REMOVEwebCAPS.de>
Re: linked list for string class <Joe.Smith@inwap.com>
Re: linked list for string class <mritty@gmail.com>
Re: linked list for string class larry_wallet@yahoo.com
Re: linked list for string class <tadmc@augustmail.com>
Re: need some visual clarity/implimentation LWP help <tadmc@augustmail.com>
Posting Guidelines for comp.lang.perl.misc ($Revision: tadmc@augustmail.com
Re: Running vi from Perl <Joe.Smith@inwap.com>
Re: Storable.pm size limit? <Joe.Smith@inwap.com>
Re: Using a variable size with the repetition quantifie <nobull@mail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 8 Oct 2004 05:45:27 -0700
From: ty_li@yahoo.com (matt)
Subject: any tools to enable test automation for scripting language like perl?
Message-Id: <10ca4b4a.0410080445.5a72a00c@posting.google.com>
hi all:
I am working on a script language very similiar to Perl. It is really
cool if I can automate the test. is there any automatic test tools
around? if the tool can also report how quick the script to be tested
can be executed, that would be even better. if tools are not
available, i will appreciate if you could give me any reference book
or web site on how to make automatic test for scripting language.
thanks a lot!
------------------------------
Date: Fri, 08 Oct 2004 09:14:46 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: Find::Find
Message-Id: <aUs9d.203522$MQ5.62478@attbi_s52>
Dan Jones wrote:
> As near as I can tell, Find::Find was not designed for this. It's only
> capable of running a command on each file, not processing files and file
> names in batches as I'm trying to do. Am I missing some of Find::Finds
> capabilities?
Yes, you're missing the 'preprocess' and 'postprocess' hooks that I added
to File::Find back in 2000.
Here's how to get all the file names and then process as a single batch:
#!/usr/bin/perl
use strict;
use warnings;
use File::Find;
use vars qw/*name/;
*name = *File::Find::name;
our(@files,@dirs);
find( sub {if(-d $_){push @dirs,$name}else{push @files,$name}}, 'Olympus');
print "Directories: @dirs\nFiles: @files\n";
Here's how to process the beginning and the end of directories, recursively.
#!/usr/bin/perl
use strict;
use warnings;
use File::Find;
use vars qw/*name *dir/;
*name = *File::Find::name;
*dir = *File::Find::dir;
my %options = (
wanted => \&wanted,
preprocess => \&pre,
postprocess => \&post,
);
our %info;
find \%options, qw(Olympus Canon); # Subdirectories full of pictures
print "$info{$_}\n\n" for sort keys %info;
exit;
sub pre { # Called before entering a directory
$info{$dir} = "\t DIR: $dir\n";
sort @_; # Pre-process directory entries by sorting them
}
sub wanted { # Called for each directory entry
$info{$dir} .= (-d $_) ? "Dir: $_\n" : "File: $_\n";
}
sub post { # Post-process dir by appending END
$info{$dir} .= "\t END: $dir\n";
}
-Joe
P.S. Don't post to comp.lang.perl; post to comp.lang.perl.misc instead.
------------------------------
Date: 08 Oct 2004 09:48:03 GMT
From: Heinrich.Mislik@univie.ac.at (Heinrich Mislik)
Subject: Re: finding the last element in a referenced array
Message-Id: <4166624f$0$12646$3b214f66@usenet.univie.ac.at>
In article <5d65e7ed.0410060231.4e6862bc@posting.google.com>, rhavin@shadowtec.de says...
>
>
>Rhesa Rozendaal <perl&nntp@rhesa.com> wrote in message news:<4162C656.8050301@rhesa.com>...
>
>> $hash{'%1'}{'%2'}[-1]
>
>*g* thanx a lot to all ... i really never thought of this simple
>solution ... i think i once again outed myself as a c-styler, thinkin
>the minus-first element is the element preceding the zeroth in a
>reference to the middle of an array - i guess now that kind of
>construction is impossible in perl?
I know it's deprecated, but I didn't expect this strange results:
perl -e '$[ = -4;@x = (1,2,3,4,5,6,7,8,9);print "$x[-1]\n";print "$x[0]\n";print "$x[1]\n"'
prints
4
5
6
as kind of expected. But
perl -e '$[ = -4;@x = (1,2,3,4,5,6,7,8,9);print "$_ -> $x[$_]\n" for -4 .. 4'
prints
-4 -> 6
-3 -> 7
-2 -> 8
-1 -> 9
0 -> 1
1 -> 6
2 -> 7
3 -> 8
4 -> 9
Any explanation?
For completeness:
This is perl, v5.8.2 built for cygwin-thread-multi-64int
Cheers
--
Heinrich Mislik
Zentraler Informatikdienst der Universitaet Wien
A-1010 Wien, Universitaetsstrasse 7
Tel.: (+43 1) 4277-14056, Fax: (+43 1) 4277-9140
------------------------------
Date: Fri, 08 Oct 2004 09:11:48 GMT
From: Zebee Johnstone <zebee@zip.com.au>
Subject: getting telnet banner
Message-Id: <slrncmcm29.noj.zebee@zeus.zipworld.com.au>
I want to connect to a machine's telnet server, read its banner, and
disconnect.
Net::Telnet doesn't appear to read banners, it doesn't return info till
you log on.
A simple: perl -e 'print `telnet clone`;'
will give the info back, but not till the telnet session has timed out.
The following code doesn't time out and doesn't return anything either.
I've tried printing \n to the socket before getting $answer, makes no
difference.
Anyone know what I can do to get the banner?
#!/usr/bin/perl -w
use strict;
use IO::Socket;
my $remote_host = shift;
my $remote_port = 23;
my $socket = IO::Socket::INET->new(PeerAddr => $remote_host,
PeerPort => $remote_port,
Proto => "tcp",
Type => SOCK_STREAM)
or die "Couldn't connect to $remote_host:$remote_port : $@\n";
my $answer = join("\n",<$socket>);
close($socket);
print "answer is $answer\n";
--
Zebee Johnstone (zebee@zip.com.au), proud holder of
aus.motorcycles Poser Permit #1.
"Motorcycles are like peanuts... who can stop at just one?"
------------------------------
Date: Fri, 8 Oct 2004 07:53:33 -0400
From: "nntp" <nntp@rogers.com>
Subject: How to automatically log in a web page?
Message-Id: <q_udndhTLcBH4vvcRVn-tA@rogers.com>
I did basic UserAgent, but it is not working as it is password protected.
When I use browser to visit
http://www.goofiz.com/forum/login.php?redirect=gf_history.php?user_id=1443
It asks for a password. I checked cookie. It uses a session ID by PHP
I have the password and login username. How do I access it by automatically
submit login/pass? Where should I use the POST?
------------------------------
Date: Fri, 08 Oct 2004 13:13:37 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: How to automatically log in a web page?
Message-Id: <ck6011$4mf$1@sun3.bham.ac.uk>
nntp wrote:
> I did basic UserAgent, but it is not working as it is password protected.
>
> When I use browser to visit
> http://www.goofiz.com/forum/login.php?redirect=gf_history.php?user_id=1443
> It asks for a password. I checked cookie. It uses a session ID by PHP
What do you mean by "I checked cookie. It uses a session ID by PHP"?
Do you mean the session ID is simply a cookie?
> I have the password and login username. How do I access it by automatically
> submit login/pass? Where should I use the POST?
Assuming its a simply cookie based system - look at the source of the
login form and to start you session post the credentials to the URL that
it would. This, of course, has nothing to do with Perl.
You also need to enable cookies in your LWP::UserAgent. For details
look for the word "cookie" in the LWP::UserAgent documentation.
------------------------------
Date: Fri, 08 Oct 2004 12:09:11 +0200
From: Thomas Kratz <ThomasKratz@REMOVEwebCAPS.de>
Subject: Re: How to flush a stinkin' socket?
Message-Id: <ck5p09$bp9$1@online.de>
your name here wrote:
> Brian McCauley <nobull@mail.com> wrote in message news:<cjs2rh$8nm$1@sun3.bham.ac.uk>...
>
>>your name here wrote:
>>
>>
>>>You may be familar with the following code snippet as it was taken
>>>from some posts in this group. However, whatever I do, I cannot get
>>>this message through the socket immediately which causes the other
>>>side to determine I am in trouble because it hasn't received a health
>>>check. The message finally shows up after I issue the shutdown
>>>command, which is unacceptable. Any ideas? Windows peculiarity?
>>
>>How are you sure that it is not being sent? Is it possible that
>>there's unwanted buffering at the reading end? Perhaps the reading
>>application is waiting for some kind of end-of-message seqence that does
>>not appear in you message.
>
>
> The message on the receiving end appears when the shutdown command is
> issued. I am not particularly familiar with the receiving end's
> application (a Delphi program) but I have the source and can step
> through. The receive event is triggered when that shutdown command
> occurs.
How does the receiving application read the data? If it tries to read a
whole line it will wait until a newline is sent (which you don't) or EOF
of the socket (which you trigger with your shutdown).
So try to send a newline after your string.
Thomas
------------------------------
Date: Fri, 08 Oct 2004 10:00:21 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: linked list for string class
Message-Id: <Vyt9d.90574$He1.65773@attbi_s01>
larry_wallet@yahoo.com wrote:
> could be used as a "string" class,
> literally a string of characters, not bound by the limitations of
> simple common strings.
Perl handles UTF-8, which included characters that are not bound by
the limitation of being held in a single byte. Is that what you're
talking about?
Using 5 or 9 bytes to hold a single character is mighty wasteful.
-Joe
------------------------------
Date: Fri, 08 Oct 2004 11:35:03 GMT
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: linked list for string class
Message-Id: <HXu9d.7980$Ua.688@trndny05>
<larry_wallet@yahoo.com> wrote in message
news:2ef9cd87.0410072057.50dafd0e@posting.google.com...
> How would I go about creating a linked list in Perl? I would like to
> dynamically generate structures or objects and link one to the next so
> that I may traverse the list back and forth.
Have you read
perldoc -q "linked list"
? Please check the Perl FAQ before posting.
> I would then like to have each object in the list contain as a member
> a single text character. By stringing together an arbitrary number of
> these objects, this larger structure, which could be a class
> containing the linked list, could be used as a "string" class,
> literally a string of characters, not bound by the limitations of
> simple common strings.
Exactly what limitations do you believe Perl's native strings have, and
how do you believe your class will overcome them?
Perhaps you should ask us for help with your *actual* goal is, rather
than with how you believe you should achieve that goal.
> I appreciate any thoughts on how I might implement this structure in
> Perl, which seems uniquely well suited to the task.
I'm sure I somewhere read something like "Just because There's More Than
One Way To Do It, that doesn't mean all ways are equally good."
Paul Lalli
------------------------------
Date: 8 Oct 2004 05:09:51 -0700
From: larry_wallet@yahoo.com
Subject: Re: linked list for string class
Message-Id: <2ef9cd87.0410080409.61e80aec@posting.google.com>
> I'm curious to know what the limitations of common strings are and how
> your string class overcomes them.
>
> --Ala
You are right, I did not explain clearly the benefits. Strings as
they are are made up of dead characters. Characters with no life, no
awareness, no sense of purpose, no knowledge of where they are and who
surrounds them.
Imagine a string of characters in which each character is of a
different class, derived from the same class of course, and each knows
its place in the string yet cooperates with its fellow characters in
ways that we can only dream of. This leads to technology like
self-correcting strings, intelligent documents, and even interactive,
multitasking text. The benefits are basically issues of encapsulation
and extensibility.
****
*lw*
****
Director of Generic Programming and Abstractions,
Integrated Distributed Systems, Inc.
------------------------------
Date: Fri, 8 Oct 2004 07:22:44 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: linked list for string class
Message-Id: <slrncmd1kk.1a7.tadmc@magna.augustmail.com>
larry_wallet@yahoo.com <larry_wallet@yahoo.com> wrote:
> How would I go about creating a linked list in Perl?
By reading the Perl FAQ *before* posting to the Perl newsgroup.
perldoc -q linked
How do I handle linked lists?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 8 Oct 2004 07:27:38 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: need some visual clarity/implimentation LWP help
Message-Id: <slrncmd1tq.1a7.tadmc@magna.augustmail.com>
buildmorelines <bulk88@hotmail.com> wrote:
> The code works fine, but for visual clarity
> it would be nice to merge the cookies line into some other line if
> possible.
One way to do that would be to remove the newline character
between the two lines in question. :-)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 08 Oct 2004 02:23:10 -0500
From: tadmc@augustmail.com
Subject: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.5 $)
Message-Id: <4IGdnR9eXPHD3fvcRVn-oA@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: Fri, 08 Oct 2004 09:24:48 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: Running vi from Perl
Message-Id: <A1t9d.203565$MQ5.53953@attbi_s52>
Gerhard M wrote:
> rickKasten@gmail.com (DrStrangepork) wrote in message news:<a4cf4e10.0410071249.68034a9@posting.google.com>...
>
>>rickKasten@gmail.com (DrStrangepork) wrote in message news:<a4cf4e10.0410061323.789d8f39@posting.google.com>...
>>
>>>I wrote a script from which I sometimes launch a system command. In
>>>Win32, this system call launches Notepad, but in Linux it must launch
>>>vi. It does, but I get a warning "Vim: Warning: Output is not to a
>>>terminal". vi is there, because the commands work (like :q exits and
>>>I am returned to my perl script), but like the warning says, no
>>>output. How can I resolve this problem?
>>
>>I figured it out. The proper code is
>>
>> system "p4 protect";
>>
>>Thanks!
>
>
> i don't now "p4" and "which p4" will return "no p4 in ....".
I know that 'p4' is a client for the Perforce application, but
that is irrelevant. The key is that
$_ = `command_that_calls_vi $filename`;
cannot be expected to work, and indeed it does not.
As rickKasten discovered,
system "command_that_calls_vi $filename";
does work.
-Joe
------------------------------
Date: Fri, 08 Oct 2004 09:46:48 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: Storable.pm size limit?
Message-Id: <cmt9d.90484$He1.43424@attbi_s01>
Michele Dondi wrote:
> the (main) point being that (as 'Perl' neq 'C') most times a simple
> print() would do, instead of a prinf().
Another handy device is
perl -le '...'
so that the output from print() gets a "\n" appended automatically.
-Joe
------------------------------
Date: Fri, 08 Oct 2004 13:24:49 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: Using a variable size with the repetition quantifier
Message-Id: <ck60m1$549$1@sun3.bham.ac.uk>
Philippe Aymer wrote:
>
> I'm looking at a PERL regex (if possible) that will be able to use a
> repetition quantifier metachar, but the number of repetition is
> unknown until runtime.
In general if you want a regex that adapts itself during its own
execution you want (??{}).
> For example:
>
> X3xyz...
>
> the number 3 give me the number of "repetition" for the next chars
> (length of string), something like:
>
> /X(\d)(\w{\1})/
>
> but \1 is not possible within {} the repetition quantifier.
>
> Is there a way to use {} with the repetition number only known from
> the regex ?
/X(\d)((??{"\\w{$1}"}))/
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 7223
***************************************