[23509] in Perl-Users-Digest
Perl-Users Digest, Issue: 5718 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 28 06:06:00 2003
Date: Tue, 28 Oct 2003 03:05:10 -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, 28 Oct 2003 Volume: 10 Number: 5718
Today's topics:
Re: 10 CDs with best IT eBooks only for $60 - .NET, Jav <kimbuba3_NOSPAM_@yahoo.it>
Re: Guide for dealing with alternate character sets? <ldo@geek-central.gen.new_zealand>
Re: HTTP Socket/REGEX help (Anno Siegel)
Re: Installing Module on Remote Host (Mike)
OO Design <- Newbie <subs.nntp.wfitzgerald@crtman.com>
Re: OO Design <- Newbie <usenet@morrow.me.uk>
Re: OO Design <- Newbie <mb@uq.net.au>
Re: OO Design <- Newbie <usenet@morrow.me.uk>
perl -ws and "used only once" warnings <jidanni@jidanni.org>
Re: perl -ws and "used only once" warnings (Anno Siegel)
Re: perl -ws and "used only once" warnings <bernard.el-haginDODGE_THIS@lido-tech.net>
Re: Perl and IIS - script runs but 'The page cannot be <usenet@morrow.me.uk>
Posting Guidelines for comp.lang.perl.misc ($Revision: tadmc@augustmail.com
Re: Question (Kobe Clinton)
Re: Question (Tad McClellan)
Re: rsh & perl -Directory creation not possible <me@privacy.net>
run a script periodically on windows (Marco)
Re: run a script periodically on windows <bernard.el-haginDODGE_THIS@lido-tech.net>
Re: Running system() commands in background <tcurrey@no.no.i.said.no>
Re: Running system() commands in background <me@privacy.net>
Re: Running system() commands in background <bik.mido@tiscalinet.it>
Unicode problem with ActivePerl 5.6.0 b623 <jbo@dator.dk>
Unicode problem with ActivePerl 5.6.0 b623 <jbo@dator.dk>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 28 Oct 2003 03:26:05 +0100
From: "kimbuba" <kimbuba3_NOSPAM_@yahoo.it>
Subject: Re: 10 CDs with best IT eBooks only for $60 - .NET, Java, C#, C++, UNIX, Oracle etc.
Message-Id: <2tknb.7494$gA.342@tornado.fastwebnet.it>
Sembra l'offerta del secolo.
Chi l'ha comprato?
Ciao.
"Nik" <sales@best-it-ebooks.com> ha scritto nel messaggio
news:ac6dcae5.0310262206.7f098579@posting.google.com...
> We are glad to introduce you our collection of best eBooks covering
different
> fields of Information Technologies. Totally, our collection includes 1000
books
> from different areas of IT: .NET, Java, C#, C++, Perl, PHP, Python, XML,
Oracle,
> Microsoft SQL Server, MySql, UNIX, Linux, Windows 2000/XP/2003, CISCO,
TCP/IP,
> Maya, Photoshop, Flash, Dreamweaver etc.
> You can purchase the collection only for $60.
> If you are interested, visit the following web site:
> http://www.best-it-ebooks.com
------------------------------
Date: Tue, 28 Oct 2003 19:39:12 +1300
From: Lawrence DčOliveiro <ldo@geek-central.gen.new_zealand>
Subject: Re: Guide for dealing with alternate character sets?
Message-Id: <ldo-CB2226.19391228102003@news.wave.co.nz>
In article <a2f641ca.0310271451.40e49b4f@posting.google.com>,
bernie@fantasyfarm.com (Bernie Cosell) wrote:
>I note that much of my Perl code is already ugly because of a
>character convention mismatch: on our system, the line terminator is
>just \012, but on stuff coming in over a socket, the line terminator
>is \015\012..,
All code for reading text files should be able to deal with all three
line-termination conventions: CR, LF and CR-LF. PostScript figured out
how to do this back in the 1980s, when is everybody else going to catch
up?
For writing files, the Internet standard is CR-LF.
>Once we move to the new system, it'll get worse: *most* of the stuff
>coming in over TCP connections will still be just ISO-Latin [with
>\r\n] and my "local files" will be UTF-8 [with just \n], and I don't
>know *what* I'm going to do.
My feeling is to convert everything incoming to Unicode before working
on it, and if necessary convert it to something else before outputting
it.
For character manipulation, a fixed-length code like UTF-16 is probably
easier to work with than a variable-length code like UTF-8. The only
real reason for the existence of UTF-8 is backward compatibility: it
allows all the old code, that was written over decades to deal only with
7-bit ASCII, to be declared Unicode-compatible (after a fashion),
because 7-bit ASCII is a subset of UTF-8.
------------------------------
Date: 28 Oct 2003 08:43:28 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: HTTP Socket/REGEX help
Message-Id: <bnla7g$534$1@mamenchi.zrz.TU-Berlin.DE>
Truthless <askme@dot.dot> wrote in comp.lang.perl.misc:
> X-IP ADDRESS: 203.239.110.2
> X-User-Agent: Microsoft Outlook 4.0 (AOL 8.0)
> Date: Tue, 28 Oct 2003 04:07:28 +0000
> NNTP-Posting-Host: 24.222.39.234
> X-Trace: nnrp1.uunet.ca 1067327995 24.222.39.234 (Tue, 28 Oct 2003 02:59:55 EST)
> NNTP-Posting-Date: Tue, 28 Oct 2003 02:59:55 EST
>
> Hello All,
>
> Let me start of by saying that I am completely new to Perl but I have a
> decent understanding of programing concepts. I am dissecting a Perl script
> that makes an HTTP socket connection and returns a character value in
> ASCII. The piece of code that I don't follow is this:
>
>
> while ($var = <$socket>)
> {
> if ($var =~ /Location:.*\x23(\d+)/)
> {
> $var2 .= chr ($1);
> }
> }
>
> I would really like if some one could help me understand what
> $var =~ /Location:.*\x23(\d+)/
"\x23" is just a fancy way of saying "#". The regular expression looks
for a line that contains "Location:", somewhere followed by a hash mark
"\x23" and one or more digits "\d+".
> means exactly. What would evaluate to true? Also how does chr ($1) get its
> value? What is $1?
Since the "\d+" enclosed in parentheses, the regular expression captures
the match and stores in $1. The code then interprets the content of $1
(all digits) as a decimal number and finds the corresponding ASCII
(or Unicode) character "chr( $1)".
All characters that can be extracted from a line in this manner are
collected in the variable $var2.
Anno
------------------------------
Date: 27 Oct 2003 19:37:40 -0800
From: csdude@hotmail.com (Mike)
Subject: Re: Installing Module on Remote Host
Message-Id: <46cdc619.0310271937.404694c0@posting.google.com>
> As I said, I thought it was probably a typo, but it would have been a
> nice quick fix if it hadn't :)
That would have been nice! :-)
I think I found the problem, though. My host let's me view the modules
(I just can't edit them unless their in my directory), and when I
looked at the UserAgent.pm module, there was no "sub get," like the
program is calling. However, when I looked on CPAN, the module there
DID have this subroutine.
So, it appears that my host is either using an incomplete or outdated
copy. Turns out it's their problem, after all.
Thanks a lot for the help, guys!
Mike
------------------------------
Date: Tue, 28 Oct 2003 04:42:35 GMT
From: "Warrick FitzGerald" <subs.nntp.wfitzgerald@crtman.com>
Subject: OO Design <- Newbie
Message-Id: <%smnb.990$qq.359703@news4.srv.hcvlny.cv.net>
Hi All,
I'm writing a parser for a layer 4 device (Load Ballancer), and am
trying my hand at OO .. with not much success so far.
The piece that I'm getting stuck on is association and\or adding an
array of other objects as a propery to one object.
For eaxmple: I have a virtual IP address that load ballances a group of
real server. I would like to have three types of objects
1. VirtualIP object
2. Real server Group Object
3. Real Server Object
So you would have multiple real server objects associated with one Real
Server Group object, and then you woudl have multiple group objects
associated with a virtual ip object.
Could someone please push me in the right direction here?
THanks
Warrick
------------------------------
Date: Tue, 28 Oct 2003 05:09:13 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: OO Design <- Newbie
Message-Id: <bnktlp$rtj$1@wisteria.csv.warwick.ac.uk>
"Warrick FitzGerald" <subs.nntp.wfitzgerald@crtman.com> wrote:
> For eaxmple: I have a virtual IP address that load ballances a group of
> real server. I would like to have three types of objects
>
> 1. VirtualIP object
> 2. Real server Group Object
> 3. Real Server Object
>
> So you would have multiple real server objects associated with one Real
> Server Group object, and then you woudl have multiple group objects
> associated with a virtual ip object.
Howsabout something like this (untested):
package Server;
use Socket qw/inet_aton/;
# Constructor: Server->new("10.2.3.4");
sub new {
my $class = shift;
my $self = inet_aton shift;
return bless \$self, $class;
}
package ServerGroup;
# Constructor: ServerGroup->new("name", $srv1, $srv1, $srv3);
sub new {
my $class = shift;
return bless { name => shift, srvs => [@_] }, $class;
}
# Accessors
sub get_name {
my $self = shift;
return $self->{name};
}
sub get_srvs {
my $self = shift;
my $srvs = $self->{srvs};
return @$srvs; # will return number of srvs in scalar context.
}
package VirtualIP;
use Socket qw/inet_aton/;
# Constructor: VirtualIP->new("10.1.1.1", $grp1, $grp2);
sub new {
my $class = shift;
return bless { ip => inet_aton(shift), grps => [@_] }, $class;
}
# etc.
__END__
--
The cosmos, at best, is like a rubbish heap scattered at random.
- Heraclitus
ben@morrow.me.uk
------------------------------
Date: Tue, 28 Oct 2003 15:19:04 +1000
From: Matthew Braid <mb@uq.net.au>
Subject: Re: OO Design <- Newbie
Message-Id: <bnku87$158$1@bunyip.cc.uq.edu.au>
Warrick FitzGerald wrote:
> Hi All,
>
> I'm writing a parser for a layer 4 device (Load Ballancer), and am
> trying my hand at OO .. with not much success so far.
>
> The piece that I'm getting stuck on is association and\or adding an
> array of other objects as a propery to one object.
>
> For eaxmple: I have a virtual IP address that load ballances a group of
> real server. I would like to have three types of objects
>
> 1. VirtualIP object
> 2. Real server Group Object
> 3. Real Server Object
>
> So you would have multiple real server objects associated with one Real
> Server Group object, and then you woudl have multiple group objects
> associated with a virtual ip object.
>
> Could someone please push me in the right direction here?
>
> THanks
> Warrick
>
It all depends on what other information you need to store. If the list
of 'sub-objects' is all you need, simply make sure each is a blessed
array ref, eg:
==== PSEUDO CODE START
package RealServer;
...
sub new {
my $class = shift;
return bless(WHATEVER, # Depends on what you need
(ref($class) or $class or __PACKAGE__);
}
package RealServerGroup;
...
sub new {
my $class = shift;
return bless([], (ref($class) or $class or
__PACKAGE__)->_init(@_);
}
sub _init {
my $self = shift;
for my $thing (whatever) {
push @$self, RealServer->new(...);
}
}
1;
package VirtualIP;
...
sub new {
my $class = shift;
return bless([], (ref($class) or $class or
__PACKAGE__)->_init(@_);
}
sub _init {
my $self = shift;
for my $thing (whatever) {
push @$self, RealServerGroup->new(...);
}
}
1;
==== PSEUDO CODE END
Of course, if you want to store more than just the sub objects, you use
a blessed hashref, eg:
==== START MORE PSEUDO CODE
package VirtualIP;
...
sub new {
my $class = shift;
return bless({}, (ref($class) or $class or
__PACKAGE__)->_init(@_);
}
sub _init {
my $self = shift;
for my $thing (whatever) {
$self->{RSG}->{$thing} = RealServerGroup->new(...);
# OR
push @{$self->{RSG}}, RealServerGroup->new(...);
}
}
1;
==== END PSEUDO CODE
You _could_ still get away with it using a blessed scalar and
class-variables, but then every single RealServerGroup you instantiate
would have the same list of RealServers (unless you get really tricky
and have the class variable as a hash indexed on each instantiated
object's string-ified value - eg RealServer=SCALAR(0x812f36c). Phew! Too
many choices :)).
All you've got to remember is that a perl5 object is just a blessed
'thing' (where thing is a reference), which means you can use the
'thing' as normal, as well as using it to call functions on itself. If
the thing is a hashref, store data in it as hash key/values. If the
thing is an arrayref, store data in it by index etc etc.
Of course you don't need to fill in the array/hash on object creation -
you can have accessors/mutators that let you do it later (or you can be
messy and access the hash keys/array indices directly - this is one
thing that perl5 is badly missing when it comes to objects - data hiding)
MB
------------------------------
Date: Tue, 28 Oct 2003 05:29:11 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: OO Design <- Newbie
Message-Id: <bnkur7$s9b$1@wisteria.csv.warwick.ac.uk>
Matthew Braid <mb@uq.net.au> wrote:
> (or you can be messy and access the hash keys/array indices directly
> - this is one thing that perl5 is badly missing when it comes to
> objects - data hiding)
Hardly... the usual Perl way to do things is to put a note in the docs
saying 'don't touch the internals of this object'. That is sufficient
data hiding for anyone who can read docs. If you want to be stricter
than that, and enforce truly inaccessible data, that's (fairly) easy
as well, and there are plenty of modules under Class:: to help you do
it.
Ben
--
If you put all the prophets, | You'd have so much more reason
Mystics and saints | Than ever was born
In one room together, | Out of all of the conflicts of time.
ben@morrow.me.uk |----------------+---------------| The Levellers, 'Believers'
------------------------------
Date: Tue, 28 Oct 2003 08:30:13 +0800
From: Dan Jacobson <jidanni@jidanni.org>
Subject: perl -ws and "used only once" warnings
Message-Id: <87y8v6xkyy.fsf@jidanni.org>
Perhaps if one of you know the exact bug, you could file a report for
me.
$ cat /tmp/v
#!/usr/bin/perl -ws
if ($xyz) { print "$xyz\n" }
if ($g) {print 66} else {print 55}
$ /tmp/v
Name "main::g" used only once: possible typo at /tmp/v line 3.
55
because $xyz is used twice, the perlrun page authors wouldn't have
triggered the bug when adding -w to their example.
The bug is: g shouldn't be warned about.
Quick hack:
if ($g) {print 65+$g} else {print 55}
------------------------------
Date: 28 Oct 2003 08:59:08 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: perl -ws and "used only once" warnings
Message-Id: <bnlb4s$534$2@mamenchi.zrz.TU-Berlin.DE>
Dan Jacobson <jidanni@jidanni.org> wrote in comp.lang.perl.misc:
> Perhaps if one of you know the exact bug, you could file a report for
> me.
>
> $ cat /tmp/v
> #!/usr/bin/perl -ws
> if ($xyz) { print "$xyz\n" }
> if ($g) {print 66} else {print 55}
> $ /tmp/v
> Name "main::g" used only once: possible typo at /tmp/v line 3.
> 55
>
> because $xyz is used twice, the perlrun page authors wouldn't have
> triggered the bug when adding -w to their example.
Of course not.
> The bug is: g shouldn't be warned about.
Why do you think it shouldn't?
Anno
------------------------------
Date: Tue, 28 Oct 2003 09:21:44 +0000 (UTC)
From: "Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net>
Subject: Re: perl -ws and "used only once" warnings
Message-Id: <Xns9422692FF625Eelhber1lidotechnet@62.89.127.66>
Dan Jacobson <jidanni@jidanni.org> wrote in
news:87y8v6xkyy.fsf@jidanni.org:
> Perhaps if one of you know the exact bug, you could file a report for
> me.
What bug?
> $ cat /tmp/v
> #!/usr/bin/perl -ws
> if ($xyz) { print "$xyz\n" }
> if ($g) {print 66} else {print 55}
> $ /tmp/v
> Name "main::g" used only once: possible typo at /tmp/v line 3.
> 55
The warning message says it all.
> because $xyz is used twice, the perlrun page authors wouldn't have
> triggered the bug when adding -w to their example.
>
> The bug is: g shouldn't be warned about.
There is no spoon, ermm, bug.
> Quick hack:
> if ($g) {print 65+$g} else {print 55}
Well now you're using $g twice, so there's no warning. What do you
consider to be a bug exactly? Do you get what that warning is for? Here's
an example:
my $really_really_really_long_variable_name = 'Hello, world';
print "$realy_really_really_long_variable_name\n";
The warning makes life easier in such situations, because you could
easily miss the typo.
--
Cheers,
Bernard
------------------------------
Date: Tue, 28 Oct 2003 02:31:47 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Perl and IIS - script runs but 'The page cannot be displayed'
Message-Id: <bnkkej$p8v$1@wisteria.csv.warwick.ac.uk>
stewart@webslave.dircon.co.uk (stew dean) wrote:
> I really don't want to be flicking between command line and browser. I
> know others don't understand this but all I want to do is run my
> script without having to pass a lot of arguments using the command
> line. Now maybe there's a way to emulate one script talking to
> another. I personaly don't want to have to remember a string of 10
> arguments (that's where I'm upto).
The reason many people are recommending you start debugging your
script on the command line is that it takes out a whole layer of
complexity: once you are sure your script does what you think, any
remaining problems are with the interface between script and browser
via the server.
If you use CGI or CGI::Lite (which I would recommend if you write your
own HTML); you need make no modification to your program to be able to
simply pass a query string (the bit of an URL after the ?) on the
command line. If you use DOSKey, or a decent shell, you need only type
it once and then use history to run the same command many times.
> There's so many bits I'm not sure about - like does the STDERR include
> everything you would see on the command line?
No. As a general rule, command line apps spew both stdout (which under
CGI would go to the browser) and stderr (which should go to the log)
onto your terminal. If you use a real shell you can redirect either of
them independantly somewhere else; if you are stuck with DOS the best
you can do is send stdout to a file.
> Where does the STDERR go and when is it written to? Is there a
> missing error log I can't see.
That is a question about your web server... at least with Apache,
stderr is logged to error_log.
Ben
--
Joy and Woe are woven fine,
A Clothing for the Soul divine William Blake
Under every grief and pine 'Auguries of Innocence'
Runs a joy with silken twine. ben@morrow.me.uk
------------------------------
Date: Tue, 28 Oct 2003 02:23:09 -0600
From: tadmc@augustmail.com
Subject: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.4 $)
Message-Id: <_t6dnV0S5enwugOiRVn-sg@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.4 $)
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.
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
"Jeopardy" (because the answer comes before the question), or
"TOFU".
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: 27 Oct 2003 18:51:14 -0800
From: kapavars@yahoo.com (Kobe Clinton)
Subject: Re: Question
Message-Id: <52ea746.0310271851.34f6e58f@posting.google.com>
Silly you , Ben Morrow. Teach your dad how to f**k.
O O
)|(
| ----> This is why you are born
0 0 ---> Your dad balls
Ben Morrow <usenet@morrow.me.uk> wrote in message news:<bnjrhq$df9$2@wisteria.csv.warwick.ac.uk>...
> kapavars@yahoo.com (Kobe Clinton) wrote:
> > By the way,,, I don't even know how this message shot up twice on the
> > board. I am using Google groups to post messages as against the
> > Outlook express that I have been using until a while ago. I think that
> > could be the problem.
>
> This is not a flame, rather it is a small piece of helpful advice.
>
> This is not a 'board', it is a newsgroup.
> Don't top-post. Put your replies at the bottom, after a suitably
> trimmed and attributed quote.
>
> Many people will already have killfiled you for those mistakes :(.
>
> Ben
------------------------------
Date: Mon, 27 Oct 2003 22:38:35 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Question
Message-Id: <slrnbprsmb.cm4.tadmc@magna.augustmail.com>
Kobe Clinton <kapavars@yahoo.com> wrote:
> Silly you , Ben Morrow. Teach your dad how to f**k.
>> Don't top-post.
>> Many people will already have killfiled you for those mistakes :(.
I hadn't.
I'll take care of that right now...
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 28 Oct 2003 19:36:35 +1300
From: "Tintin" <me@privacy.net>
Subject: Re: rsh & perl -Directory creation not possible
Message-Id: <bnl2r9$10bdck$1@ID-172104.news.uni-berlin.de>
"qazmlp" <qazmlp1209@rediffmail.com> wrote in message
news:db9bbf31.0310270645.62719980@posting.google.com...
> >
> > You still haven't answered by previous question.
> >
> > Post a relevant snippet of your code.
>
> Here is an excerpt from the script:
> $opath=$ProtName;
> opendir(DIR,$opath) || system("mkdir $ProtName");
> closedir (DIR);
>
> I don't know whether it helps to find the cause of the problem.
>
> Meanwhile, the problem was solved by selecting the option,
> "execute all rsh commands as user: ", for rsh in remote machine.
Originally, I asked:
> > > > Does your script have something like?
> > > >
> > > > mkdir '/path/to/dir' or die "Can not mkdir /path/to/dir $!\n";
and you answered.
> > > I have mkdir command in the script.
Yes, you have a mkdir, but you are forking out to do something that can be
done natively in Perl (as in my example) and you have no error checking.
Use the Perl mkdir with error checking, and then see what happens.
------------------------------
Date: 28 Oct 2003 02:42:04 -0800
From: ver_for@yahoo.it (Marco)
Subject: run a script periodically on windows
Message-Id: <da63f24c.0310280242.42f4eeb6@posting.google.com>
Hi,
I would like to run a perl script every day without lqunching it manually.
On unix I would use a cron command but I am on Windows. How can I do?
Thanks in advance for your answers.
Marco
------------------------------
Date: Tue, 28 Oct 2003 10:44:40 +0000 (UTC)
From: "Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net>
Subject: Re: run a script periodically on windows
Message-Id: <Xns9422773F6D295elhber1lidotechnet@62.89.127.66>
ver_for@yahoo.it (Marco) wrote in
news:da63f24c.0310280242.42f4eeb6@posting.google.com:
> Hi,
>
> I would like to run a perl script every day without lqunching it
> manually. On unix I would use a cron command but I am on Windows. How
> can I do?
Why don't you ask on a Windows newsgroup?
--
Cheers,
Bernard
------------------------------
Date: Mon, 27 Oct 2003 18:05:34 -0800
From: "Trent Curry" <tcurrey@no.no.i.said.no>
Subject: Re: Running system() commands in background
Message-Id: <bnkiuc$bjf$1@news.astound.net>
qazmlp wrote:
> Whenever system("command") is called in a perl script, a new
> (commandline) window opens and shows the execution of the "command".
> What do I need to do if
> I have to run the command in the background? Basically, I do not
> prefer the user to see what is happening when the perl script is being
> executed.
>
> The test was done in Win2K & the solution is required in the same.
>
> Thanks!
Anyone know if this works in windows (it does under unix/linux):
<code type=perl;handtyped>
#!/usr/bin/perl -w
use strict;
exit if fork;
system("command");
</code>
I'm not sure fork will work under win32. Worth a try I suppose.
--
Trent Curry
perl -e
'($s=qq/e29716770256864702379602c6275605/)=~s!([0-9a-f]{2})!pack("h2",$1)!eg
;print(reverse("$s")."\n");'
------------------------------
Date: Tue, 28 Oct 2003 19:37:45 +1300
From: "Tintin" <me@privacy.net>
Subject: Re: Running system() commands in background
Message-Id: <bnl2tf$12708u$1@ID-172104.news.uni-berlin.de>
"qazmlp" <qazmlp1209@rediffmail.com> wrote in message
news:db9bbf31.0310270649.5c6b3376@posting.google.com...
> Whenever system("command") is called in a perl script, a new
> (commandline) window opens and shows the execution of the "command".
> What do I need to do if
> I have to run the command in the background? Basically, I do not
> prefer the user to see what is happening when the perl script is being
> executed.
What is the command you are running? Base on your other post, it is likely
there is an Perl function.
------------------------------
Date: Tue, 28 Oct 2003 08:54:10 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Running system() commands in background
Message-Id: <nu7spvg3l6aa7ubrtnr36012tsdfcbh48b@4ax.com>
On Mon, 27 Oct 2003 15:00:39 +0000, "Alan J. Flavell"
<flavell@ph.gla.ac.uk> wrote:
>On Mon, 27 Oct 2003, qazmlp wrote:
>
>> Whenever system("command") is called in a perl script, a new
>> (commandline) window opens and shows the execution of the "command".
>> What do I need to do if
>> I have to run the command in the background?
>
>What you need to do is to read the Windows-specific documentation for
>whichever Windows port of Perl you are using.
Agreed!
>AFAIR, in the case of ActiveState Perl, it tells you that you'd
>execute wperl instead of perl. It worked for me (it's been a while,
This doesn't quite answer the OP's question. In fact AS's wperl
executes perl scripts without opening a new window, but new windows
are opened for each system().
Apart the correct suggestion above, a more generic one could be to use
either qx// or open(), one of which may be more appropriate for other
reasons too.
Michele
--
# This prints: Just another Perl hacker,
seek DATA,15,0 and print q... <DATA>;
__END__
------------------------------
Date: Tue, 28 Oct 2003 11:58:08 +0100
From: "Jesper Bork" <jbo@dator.dk>
Subject: Unicode problem with ActivePerl 5.6.0 b623
Message-Id: <3f9e4c5a$0$246$bc7fd3c@news.sonofon.dk>
I have a large Perl application which I'm trying to port from ActivePerl
5.005 series to 5.6 series, however, while most things works as usual, I get
the following error message
Can't find unicode character property definition via main->r or r.pl at
unicode/Is/r.pl line 0
when invoking the method below
sub getFileCodeSection {
# Create the code section
# Arguments:
# 1: Object instance
# 2: Filename (just in case - probably not used!)
# Return Value:
# GOOD: the code section in a string
# BAD: 0
my $self = shift;
my $pathname = shift;
my ($filename, $type, $code, $keyword, $fullname, $username,
$classname);
my ($packagename);
# Remove the path from filename
$filename = DapUtil::getFileNameFromPath ($pathname);
# Get the name of the primary class in the file
$classname = DapUtil::getFileBaseNameFromPath ($filename);
# Get the username and fullname of the current user
$username = $self->{'username'};
$fullname = $self->{'fullname'};
# Ask the VersionControlSystem for the Revision Keyword
if (Environment::isUsingVersionControl ($ENV{'Project_Name'})) {
$keyword =
ToolFactory::getCurrentVersionControlSystem()->getRevisionNumberKeyword();
} else {
$keyword = '';
}
# Generate the package name to be used for this file.
# The packagename is constructed relative to the "java-code-container"
directory.
# The "java-code-container" directory is constructed by looking up the
path for
# a directory of a special name. If none of the special names are found,
then there
# is not put any "package" statement in the file.
# The priority of the special names are:
# 1: src\java
# 2: src
# 3: test
# We search case-insensitively!
if ($pathname =~ /\\src\\java\\(.+)$/i) {
# The path following src\java is now in $1
$packagename = $1;
} elsif ($pathname =~ /\\src\\(.+)$/i) {
# The path following src is now in $1
$packagename = $1;
} elsif ($pathname =~ /\\test\\(.+)$/i) {
# The path following test is now in $1
$packagename = $1;
} else {
$packagename = '';
}
# Remove filename from rest-path
$packagename =~ s/\\[^\\]+$//;
# Exchange backslashes with dots
$packagename =~ tr/\\/\./;
if ($packagename ne '') {
$code = "package $packagename;\n\n";
}
$code .= <<"MARK";
/*---
Imports -------------------------------------------------------------*/
/*---
Classes -------------------------------------------------------------*/
/**
* Interface description.
*
* \@see java.lang.Object
* \@author $fullname ($username)
* \@version $keyword
*
**/
public interface $classname
{
}
MARK
return $code;
}
The method above does not imply any use of Unicode to me, however, it is
correct that no r.pl file exists - they seem only to exist for a certain
subset of characters - I've looked through the ActivePerl 5.6.1 build 635
and no r.pl exists there neither.
Any ideas, hints ?!
best regards,
Jesper Bork
FKI Logistex
------------------------------
Date: Tue, 28 Oct 2003 11:59:54 +0100
From: "Jesper Bork" <jbo@dator.dk>
Subject: Unicode problem with ActivePerl 5.6.0 b623
Message-Id: <3f9e4c5b$0$246$bc7fd3c@news.sonofon.dk>
I have a large Perl application which I'm trying to port from ActivePerl
5.005 series to 5.6 series, however, while most things works as usual, I get
the following error message
Can't find unicode character property definition via main->r or r.pl at
unicode/Is/r.pl line 0
when invoking the method below
sub getFileCodeSection {
# Create the code section
# Arguments:
# 1: Object instance
# 2: Filename (just in case - probably not used!)
# Return Value:
# GOOD: the code section in a string
# BAD: 0
my $self = shift;
my $pathname = shift;
my ($filename, $type, $code, $keyword, $fullname, $username,
$classname);
my ($packagename);
# Remove the path from filename
$filename = DapUtil::getFileNameFromPath ($pathname);
# Get the name of the primary class in the file
$classname = DapUtil::getFileBaseNameFromPath ($filename);
# Get the username and fullname of the current user
$username = $self->{'username'};
$fullname = $self->{'fullname'};
# Ask the VersionControlSystem for the Revision Keyword
if (Environment::isUsingVersionControl ($ENV{'Project_Name'})) {
$keyword =
ToolFactory::getCurrentVersionControlSystem()->getRevisionNumberKeyword();
} else {
$keyword = '';
}
# Generate the package name to be used for this file.
# The packagename is constructed relative to the "java-code-container"
directory.
# The "java-code-container" directory is constructed by looking up the
path for
# a directory of a special name. If none of the special names are found,
then there
# is not put any "package" statement in the file.
# The priority of the special names are:
# 1: src\java
# 2: src
# 3: test
# We search case-insensitively!
if ($pathname =~ /\\src\\java\\(.+)$/i) {
# The path following src\java is now in $1
$packagename = $1;
} elsif ($pathname =~ /\\src\\(.+)$/i) {
# The path following src is now in $1
$packagename = $1;
} elsif ($pathname =~ /\\test\\(.+)$/i) {
# The path following test is now in $1
$packagename = $1;
} else {
$packagename = '';
}
# Remove filename from rest-path
$packagename =~ s/\\[^\\]+$//;
# Exchange backslashes with dots
$packagename =~ tr/\\/\./;
if ($packagename ne '') {
$code = "package $packagename;\n\n";
}
$code .= <<"MARK";
/*---
Imports -------------------------------------------------------------*/
/*---
Classes -------------------------------------------------------------*/
/**
* Interface description.
*
* \@see java.lang.Object
* \@author $fullname ($username)
* \@version $keyword
*
**/
public interface $classname
{
}
MARK
return $code;
}
The method above does not imply any use of Unicode to me, however, it is
correct that no r.pl file exists - they seem only to exist for a certain
subset of characters - I've looked through the ActivePerl 5.6.1 build 635
and no r.pl exists there neither.
Any ideas, hints ?!
best regards,
Jesper Bork
FKI Logistex
------------------------------
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 5718
***************************************