[22397] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4618 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Feb 25 00:06:02 2003

Date: Mon, 24 Feb 2003 21:05:07 -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, 24 Feb 2003     Volume: 10 Number: 4618

Today's topics:
    Re: auto generate curly brackets around C-statements (r <jurgenex@hotmail.com>
    Re: Change a variable <jurgenex@hotmail.com>
    Re: Checking something to see if it isn't there........ (Anno Siegel)
    Re: Checking something to see if it isn't there........ <steven.smolinski@sympatico.ca>
    Re: Checking something to see if it isn't there........ <usenet@tinita.de>
    Re: compiling perlcc generated c code with gcc (Sisyphus)
    Re: editting photos on the fly <jurgenex@hotmail.com>
    Re: extract string from another string <krahnj@acm.org>
        Flash Remoting in Perl (FLAP) (Simon)
        locate 1, 1 wont work properly, perhaps it's only meant <tyrannous@o-space.com>
    Re: Long strings're causing problems <goldbb2@earthlink.net>
    Re: map two lists <eric.schwartz@hp.com>
    Re: parens () <racsw@frontiernet.net>
    Re: Parsing line into hash... <goldbb2@earthlink.net>
    Re: Perl -- CGI and background process <usenet@tinita.de>
    Re: Perl -- CGI and background process <goldbb2@earthlink.net>
        Posting Guidelines for comp.lang.perl.misc ($Revision:  tadmc@augustmail.com
    Re: Splice problem <tore@aursand.no>
        Tk::TableMatrix for ActivePerl 8xx Build? (Jim Seymour)
        translate ( tr ) question (Taber)
    Re: try my program out... <jurgenex@hotmail.com>
    Re: Using DBI::mysql <tore@aursand.no>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 25 Feb 2003 03:08:35 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: auto generate curly brackets around C-statements (regexp?)
Message-Id: <T6B6a.30723$_J5.3027@nwrddc01.gnilink.net>

norbert sant wrote:
> I wonder if there's an easy way in Perl to detect following constructs
> in a C-file
>
> 1. if (cond)
> action;
>
> 2. for (init; cond; incr)
> action;
>
> 3. do
> action;
> while (cond);

I would think this is pretty much impossible without writing a (mostly)
fully functional C parser.

> I tried different solutions, but could not accomodate all the possible
> constructs you might be able to think of in C.

Doesn't surprise me at all. Parsing a programming language is not a trivial
task and certainly not something you do with a simple RE.

jue




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

Date: Tue, 25 Feb 2003 03:21:34 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Change a variable
Message-Id: <2jB6a.30731$_J5.17527@nwrddc01.gnilink.net>

Steve wrote:
>> Lt. wrote:
>>> My apologies, I am very new to this.
>>
>
> jue wrote:
>> I guess 'this' includes Usenet? :-{
>> I just replied to exactly the same question of yours in the other NG.
>>
>> _DO_NOT_MULTIPOST_!
>
>
> Sooo ... rather than be helpful you decided to be an jerk

I think I was helpful (on the subject matter) by posting a response that
addressed the original question (on the subject matter) in the other NG
before I saw this identical posting here.
Now, would you answer exactly the same question submitted by the same person
twice? Or maybe three times? Or when will you run out of patience?

> (I was
> going to say asshole, but I guess that's excessive)?  Good job jue,
> good job.  This isn't a grad school class or some place that people
> should be hesitant to ask a question, in fear of sounding stupid or
> ignorant ... its just a newsgroup.

And as such they have certain rules like any social group. One of them is
that your time is no more valuable than the time of the thousand of other
users who will have to read your posting twice (or three or four or
 ....times) because you didn't follow the most basic common sense.

jue




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

Date: 24 Feb 2003 23:07:02 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Checking something to see if it isn't there..........
Message-Id: <b3e8im$fc1$1@mamenchi.zrz.TU-Berlin.DE>

Steven Smolinski  <steven.smolinski@sympatico.ca> wrote in comp.lang.perl.misc:
> Spero <spero126NOSPAM@yahoo.com> wrote:
> > "Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote:
> >> Spero <spero126NOSPAM@yahoo.com> wrote in comp.lang.perl.misc:
> >> >
> >> > How can I successfully check if $ARGV[$#ARGV] has been entered and
> >> > it is in the correct format?
> >>
> >> If anything is in @ARGV at all $ARGV[$#ARGV] (or, equivalently
> >> $ARGV[-1]) will be its last element.  So you could do this:
> >>
> >>     die "Invalid operation" unless @ARGV;
> >>     my $operation = @ARGV[ -1];
> >>     # ...
> 
> I prefer (after Getopt::Std has removed the options from @ARGV):
> 
>     my $operation = shift or die "No operator given";

Yes, that's a common idiom, and it may be applicable here.  However,
Taking the OP literally, the question was whether the argument was
given at all and scalar @ARGV tests that.  "or" tests if anything
substantial (boolean true) was given, which isn't quite the same thing.
The difference may well not matter here.

Anno


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

Date: Tue, 25 Feb 2003 01:34:03 GMT
From: Steven Smolinski <steven.smolinski@sympatico.ca>
Subject: Re: Checking something to see if it isn't there..........
Message-Id: <fKz6a.5449$os6.328230@news20.bellglobal.com>

Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> Steven Smolinski  <steven.smolinski@sympatico.ca> wrote in comp.lang.perl.misc:

>>     my $operation = shift or die "No operator given";
> 
> Yes, that's a common idiom, and it may be applicable here.  However,
> Taking the OP literally, the question was whether the argument was
> given at all and scalar @ARGV tests that.  "or" tests if anything
> substantial (boolean true) was given, which isn't quite the same thing.
> The difference may well not matter here.

Agreed.  I like the idiom, but it doesn't exactly DWIM.  Ideally I want
an "or" that tests its lhs for definedness rather than truth.  I only
use the above when I'm fairly certain that a reasonable value returned
by shift() won't be '' or 0.  That is, if I have no valid $operation
that evalutaes to false.

Steve
-- 
Steven Smolinski => http://arbiter.ca/
GnuPG Public Key => http://arbiter.ca/steves_public_key.txt
                 => or email me with 'auto-key' in the subject.
Key Fingerprint  => 08C8 6481 3A7B 2A1C 7C26  A5FC 1A1B 66AB F637 495D


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

Date: 25 Feb 2003 02:54:45 GMT
From: Tina Mueller <usenet@tinita.de>
Subject: Re: Checking something to see if it isn't there..........
Message-Id: <tinhaugmv$1q5$tina@news01.tinita.de>

Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> Steven Smolinski  <steven.smolinski@sympatico.ca> wrote in comp.lang.perl.misc:
>>     my $operation = shift or die "No operator given";

> Yes, that's a common idiom, and it may be applicable here.  However,
> Taking the OP literally, the question was whether the argument was
> given at all and scalar @ARGV tests that.  "or" tests if anything
> substantial (boolean true) was given, which isn't quite the same thing.
> The difference may well not matter here.

defined(my $operation = shift) or die "No operator given";

regards, tina

-- 
http://www.tinita.de/     \  enter__| |__the___ _ _ ___
http://Movies.tinita.de/   \     / _` / _ \/ _ \ '_(_-< of
http://www.perlquotes.de/   \    \ _,_\ __/\ __/_| /__/ perception
http://www.tinita.de/peace/link.html - Spread Peace


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

Date: 24 Feb 2003 20:14:30 -0800
From: kalinabears@hdc.com.au (Sisyphus)
Subject: Re: compiling perlcc generated c code with gcc
Message-Id: <e615828f.0302242014.90f23f7@posting.google.com>

stig <nospam_stigerikson@yahoo.se> wrote in message news:<b3a5d1$7o4$1@oden.abc.se>...
> Benjamin Goldberg wrote:
> 
> > stig wrote:
> > [snip]
> >> as gcc begins to parse the c file it generates 4-5 lines of warnings
> >> per line c code, and ends in error
> >> 
> >> this is how the errors and warnings begin
> >> myprogram.c:1:20: EXTERN.h: No such file or directory
> >> myprogram.c:2:18: perl.h: No such file or directory
> >> myprogram.c:3:18: XSUB.h: No such file or directory
> > 
> > You need to have the perl source installed on your machine to be able to
> > compile the output of perlcc... that is where those headers are.
> > 
> > 
> 
> 
> hi again. it seems like the sources solved some of the problems.
> an object file is now created, however then gcc complains again.
> 
> myprogram.o: In function `perl_init_aaaa':
> myprogram.c:3278: undefined reference to `Perl_Gthr_key_ptr'
> 
> and so on for other function, spits out a couple of hundred rows
> 
> any further hints?
> 
> thanks
> stig

Yesterday, having been unable to post to Usenet for about 3 days (and
with no end in sight), I sent the OP an email suggesting that it is
necessary to link to libperl56.a. This file is in the ../lib/CORE
folder relative to the directory in which perl was built. The include
files mentioned in the OP's first post are also in the same folder. At
least that's the way it is for me on Win32 with mingw and gcc.

To test, I created a little try.pl and ran 'perlcc -c try.pl' which
produced the file 'try.c'.

Then I ran:
gcc try.c -I\downloads\AP633_source\lib\CORE
-L\downloads\AP633_source\lib\CORE -lperl56

That built the executable just fine without any warnings or errors.
Only problem is that when I run the executable, I get a fatal error in
the form of a popup telling me that 'The instruction at "0x00405067"
referenced memory at "0x00000000". The memory could not be "read".'

The include files (perl.h, etc.) also can be found in
\downloads\AP633_source\, but if I include that directory instead of
the one I used, then I get errors about other include files (eg
config.h) not being found.

That's about as far as I can get with this approach.

Cheers,
Rob


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

Date: Tue, 25 Feb 2003 03:13:54 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: editting photos on the fly
Message-Id: <SbB6a.30726$_J5.20017@nwrddc01.gnilink.net>

Steve wrote:
> I am probably months behind on this one, but I recently was sent an
> e-mail with a link where I enter my name and it shows up on a picture.
> I tried completely random names to be sure it wasn't just a database
> of millions of pictures.
>
> So my question is, how do they do this?

I do not know how 'they' do it, but it's not difficult at all.
Even Image::Magick has a feature that allows you to overly any graphic with
text in different styles, fonts, colors, coordinates, orientations, etc.

jue




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

Date: Tue, 25 Feb 2003 01:15:21 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: extract string from another string
Message-Id: <3E5AC397.6F59A528@acm.org>

piet wrote:
> 
> what it there were several (from 1 to 10) matches to extract?
> example:
> $teststring =' stuff 650 N other stuff 90N stuff"


my @extract = $teststring =~ /\b(\d{2,3} *[a-zA-Z])\b/g;


John
-- 
use Perl;
program
fulfillment


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

Date: 24 Feb 2003 17:12:50 -0800
From: simonf@simonf.com (Simon)
Subject: Flash Remoting in Perl (FLAP)
Message-Id: <3226c4d3.0302241712.563fee30@posting.google.com>

Hi,

This is a project that lets Macromedia Flash applications to talk to
Perl server-side scripts:
http://www.simonf.com/flap/
The site includes a simple working example.

FLAP, in short, enables web programmers to create visually appealing
client-side applications that are not constrained to the CGI
mechanisms of data transfer. (Simplified SOAP, if you will.)
Macromedia is big on this, and PHP folks are already implementing the
server side also.

Please respond if you would like to use this technology or contribute
to its development.

Simon Ilyushchenko


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

Date: Mon, 24 Feb 2003 23:21:16 -0000
From: <tyrannous@o-space.com>
Subject: locate 1, 1 wont work properly, perhaps it's only meant for linux
Message-Id: <b3e9dc$tk2$1@newsg1.svr.pol.co.uk>

locate 1, 1 wont work properly, perhaps it's only meant for linux


use Term::ASCIIScreen;

system 'cls'; locate 1,1;

print chr(65);


could someone please tell me how to get this to work on a Windows ME system?




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

Date: Mon, 24 Feb 2003 22:21:55 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Long strings're causing problems
Message-Id: <3E5AE153.27B6ACE0@earthlink.net>

aybikem wrote:
> 
> Hi,
> 
> I am quite new to Perl and trying to dig up following issue. Any
> insight would be greatly appreciated.
> 
> We have been experiencing very strange behaviour in our Perl Scripts.
> 
> There are text fields and text areas that user fill out on the web
> using the page written with perl.

How an HTML form was produced (whether it's a piece of static HTML, or
whether it's a CGI program (and whether that CGI program is written in
C, perl, python, lisp, java, etc.)) is NOT relevant to the problem.

Nor, for that matter, does it matter how the form is filled out (by the
user running a web browser, by program (perl using LWP, etc)).

> The values of text fields and text areas are than written to the
> Oracle database.

How?

Using DBI and DBD::Oracle? Using Win32::ODBC? Using IPC::Open2 and
open2(...,"sqlplus")?  Using something else?

Furthermore, how are you getting the data?  Using the CGI.pm module? 
Using CGI::Lite?  Using cgi-lib.pl?  Using some roll-your-own code?

> Corresponding field's names and sizes are equal
> in database with those in the perl code...

What do you mean by this?

> The problem comes alive when user enters a long strings into these
> fields, this induces cgi-bin database errors. I am trying to figure
> out the reason.

What are these errors?  Could you cut and paste from your error log?

> My initial thought was the column name in database for the given text
> field (or area) might be smaller than the actual value that is
> assigned in the Perl code. But the sizes are the same.

And if that *were* the problem, then it would be a database problem, not
a perl problem.

> Would it be a problem while transfering big chunks of data (long
> strings) the system can not handle the job? and than give cgi-bin
> database errors?

The CGI protocol can handle data of any size.

Perl is able to handle strings of any length (as long as they fit into
memory).

If you want us to help you, then you need to show us some code.

Please don't post your whole program, though -- instead, write the
smallest possible program which demonstrates your problem.

-- 
$;=qq qJ,krleahciPhueerarsintoitq;sub __{0 &&
my$__;s ee substr$;,$,&&++$__%$,--,1,qq;;;ee;
$__>2&&&__}$,=22+$;=~y yiy y;__ while$;;print


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

Date: 24 Feb 2003 19:53:05 -0700
From: Eric Schwartz <eric.schwartz@hp.com>
Subject: Re: map two lists
Message-Id: <eto4r6t6pgu.fsf@wormtongue.emschwar>

Johannes Fürnkranz <johannes.fuernkranz@t-online.de> writes:
> While looking at this, I realized that I have one of my two lists in @_.
> So in this case, I can even get rid of the $i:
> 
> @result = map function($_,shift), @list1;
> 
> This should be fast *and* pretty. :-)

I'd go with something a little more verbose and clear; this is not
necessarily the most easy-to-read way of doing what you want.  I have
found of late that making code easy to read is far more important to
me than making it 0.5 milliseconds faster. :)

This code also has the side effect of emptying @_, which may or may
not be what you want.

-=Eric
-- 
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
		-- Blair Houghton.


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

Date: Mon, 24 Feb 2003 19:10:28 -0500
From: Robert Krueger <racsw@frontiernet.net>
Subject: Re: parens ()
Message-Id: <v5ld3l1ts7gad4@corp.supernews.com>

Steve Grazzini wrote:

> Robert Krueger <racsw@frontiernet.net> writes:
>> Robert Krueger wrote:
>>>   Why does this work:
>>>      print (( 2 * 3 ) * 8 );
>>> 
>>>   and this doesn't?
>>>      print ( 2 * 3 ) * 8;
> ...
> 
>> Well, I apologize for not being more specific, I was in a rush
>> before going to work. I always enable warnings, and I receive
>> this warning:
>> 
>> "Useless use of integer multiplication (*) in void context at
>>  <line #>"
> 
> You should actually get two warnings, and the first one
> is more helpful:
> 
>   $ perl -Mdiagnostics -we 'print (2*3)*6'
>   print (...) interpreted as function at -e line 1 (#1)
>     (W syntax) You've run afoul of the rule that says that any
>     list operator followed by parentheses turns into a function,
>     with all the list operators arguments found inside the
>     parentheses.  See perlop/Terms and List Operators (Leftward).
> 
> There's also an explanation toward the top of the perlfunc
> manpage:
> 
>   $ perldoc perlfunc
>     ...
> 
>     Any function in the list below may be used either with or
>     without parentheses around its arguments.  (The syntax
>     descriptions omit the parentheses.)  If you use the
>     parentheses, the simple (but occasionally surprising) rule
>     is this: It looks like a function, therefore it is a
>     function, and precedence doesn't matter.  Otherwise it's a
>     list operator or unary operator, and precedence does
>     matter.  And whitespace between the function and left
>     parenthesis doesn't count--so you need to be careful
>     sometimes:
>  
>         print 1+2+4;        # Prints 7.
>         print(1+2) + 4;     # Prints 3.
>         print (1+2)+4;      # Also prints 3!
> 
>> In C or C++, I would never get a warning for this syntax
> 
>   $ gcc -Wunused ...
> 

Wow... I want to thank all of you that took the time to reply.  I didn't 
expect such a response.  You all explained the difference between the two 
code snippits and the result of the expression very well.
There's not much I can say...except thanks.

Robert



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

Date: Mon, 24 Feb 2003 22:41:22 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Parsing line into hash...
Message-Id: <3E5AE5E2.F804B0D7@earthlink.net>

Hamish Marson wrote:
> 
> I have a datafile that contains lines in the following format
> 
> <IDENT> key value
> 
> e.g.
> 
> USER HITS fred 22 john 36 joe 33
> 
> where key value is repeated many times. I want to read the key value
> pairs into a hash... But am having problems. I'm trying
[snip]

use strict;
use warnings;
my %all_data;
while( <> ) {
   chomp;
   my ($ident, $data) = /^(\w+ \w+) (.*)/
      or die "Malformed data [$_] on line $.\n";
   my %hash = split ' ', $data;
   $all_data{$ident} = \%hash;
}
use Data::Dumper; Dumper \%all_data;
__END__
[untested]



-- 
$;=qq qJ,krleahciPhueerarsintoitq;sub __{0 &&
my$__;s ee substr$;,$,&&++$__%$,--,1,qq;;;ee;
$__>2&&&__}$,=22+$;=~y yiy y;__ while$;;print


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

Date: 25 Feb 2003 02:46:57 GMT
From: Tina Mueller <usenet@tinita.de>
Subject: Re: Perl -- CGI and background process
Message-Id: <tinhaug9w$1pc$tina@news01.tinita.de>

mlm <mlm@nospam.com> wrote:

> I envisage a program called on first access to the web page which will 
> open a connection to the NNTP server and keep it open waiting for 
> requests to retrieve particular articles.  A CGI program would take HTTP 
> requests and hand them off to the NNTP manager to be serviced and 
> returned to the client browser.  Perhaps after 3-400 seconds of no 
> activity, the NNTP management program would close the NNTP connection and 
> shut itself down.

> I am looking for suggestions as to where to start looking to create this 
> type of setup.  My real lack of knowledge is in how to kickstart the NNTP 
> manager and keep it running on my (remote) unix web server until it 
> decides to stop or is told by the CGI program to stop.

i'd do a fork() and then start a second script which does
the NNTP connection. In the parent you have to remember the
pid (e.g. create a file.pid) and then in the following
requests the CGI script can talk to this process.
you might want to read
 perldoc -f fork
 perldoc perlipc

hth, tina
-- 
http://www.tinita.de/     \  enter__| |__the___ _ _ ___
http://Movies.tinita.de/   \     / _` / _ \/ _ \ '_(_-< of
http://www.perlquotes.de/   \    \ _,_\ __/\ __/_| /__/ perception
http://www.tinita.de/peace/link.html - Spread Peace


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

Date: Mon, 24 Feb 2003 22:37:28 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Perl -- CGI and background process
Message-Id: <3E5AE4F8.A0EC88E5@earthlink.net>

mlm wrote:
> 
> I would like to have two perl programs, one to manage a connection to
> a news server, and the other to look after the CGI part.  I want to
> avoid CGI for the news server part to avoid continually opening and
> closing the connection to the news server.
> 
> I envisage a program called on first access to the web page which will
> open a connection to the NNTP server and keep it open waiting for
> requests to retrieve particular articles.  A CGI program would take
> HTTP requests

CGI is is an inter-program protocol.
HTTP is a network protocol.

Don't get them confused.

> and hand them off to the NNTP manager to be serviced and
> returned to the client browser.  Perhaps after 3-400 seconds of no
> activity, the NNTP management program would close the NNTP connection
> and shut itself down.

A much more sensible program is to create your own mini-webserver,
rather than deal excessively with the CGI protocol.

You would start it with HTTP::Daemon, then fork; the parent process
would use a 'location:' CGI response, to redirect the query to the
started daemon, then exit.

In the daemon, you would reopen stdin from /dev/null, reopen stdout to
/dev/null, and reopen stderr to a log file somewhere.  Then, you would
connect to the NNTP server (using Net::NNTP).  Then, use the created
HTTP::Daemon object to accept HTTP connections, make requests to the
NNTP server, and print responses.

-- 
$;=qq qJ,krleahciPhueerarsintoitq;sub __{0 &&
my$__;s ee substr$;,$,&&++$__%$,--,1,qq;;;ee;
$__>2&&&__}$,=22+$;=~y yiy y;__ while$;;print


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

Date: Mon, 24 Feb 2003 20:03:15 -0600
From: tadmc@augustmail.com
Subject: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.4 $)
Message-Id: <nO-cnTT4Hex-U8ejXTWcqQ@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: Tue, 25 Feb 2003 00:26:04 +0100
From: "Tore Aursand" <tore@aursand.no>
Subject: Re: Splice problem
Message-Id: <pan.2003.02.24.23.13.20.7931@aursand.no>

On Mon, 24 Feb 2003 18:09:55 +0100, Jon Rogers wrote:
> my @array=('aaaaa','bbbbb','ccccc','dd','eeeee','fffff','ggggg');
> my $length = scalar @array -1;

'scalar()' doesn't returns the _index_ of the last element.

> for ($i=0 ; $i<=$length; $i++) {
>   if (length $array[$i] <5) {
>       @array = splice (@array, $i+1,$i+2); } }

You don't need to know how many elements there are in '@array' if you just
want to iterate over them;

  my @array = ('aaaaa','bbbbb','ccccc','dd','eeeee','fffff','ggggg');
  my @new   = ();

  foreach my $element ( @array ) {
      if ( length($element) >= 5 ) {
          push( @new, $element );
      }
  }


-- 
Tore Aursand - tore@aursand.no - http://www.aursand.no/


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

Date: Mon, 24 Feb 2003 23:19:51 -0000
From: gort@LinxNet.com (Jim Seymour)
Subject: Tk::TableMatrix for ActivePerl 8xx Build?
Message-Id: <v5la4n1krfc433@corp.supernews.com>

ActiveState apparently hasn't done the Tk::TableMatrix module for
their 8xx build yet.  Anybody know where else I might find it?

TIA,
Jim
-- 
Jim Seymour                    | PGP Public Key available at:
WARNING: The "From:" address   | http://www.uk.pgp.net/pgpnet/pks-commands.html
is a spam trap.  DON'T USE IT! |
Use: jseymour@LinxNet.com      | http://jimsun.LinxNet.com


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

Date: 24 Feb 2003 20:54:09 -0800
From: taber@gonetstat.com (Taber)
Subject: translate ( tr ) question
Message-Id: <2cae6cde.0302242054.4ade6fcd@posting.google.com>

I need to know how to translate letters higher than J to a number i.e. a=1..z=27


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

Date: Tue, 25 Feb 2003 04:03:32 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: try my program out...
Message-Id: <oWB6a.21557$ep5.20696@nwrddc02.gnilink.net>

Ian.H [dS] wrote:
> In a fit of excitement on Mon, 24 Feb 2003 07:56:20 GMT, "Jürgen
> Exner" <jurgenex@hotmail.com> managed to scribble:
>> Some One wrote:
>>> Its a guestbook program, i need it looked at and opinions given..
>>> http://www.[...]/guestbook.exe
>>
>> How stupid does someone have to be to run an unknown exe from an
>> unknown web site written/submitted by an unknown poster who is
>> using a faked name and doesn't even provide a valid email address
>> for questions or to submit those opinions he pretents to be looking
>> for?
>
> It runs fine, and server side, so no viruses or trojan to be worried
> about.

Unfortunately by just looking at the URL there is no way of telling if
accessing the document will run a server side program or if you will be
offered to download and save or even to run the program locally. And I'm
sure there are enough people out there (probably those using browser which
offer those options) who wouldn't hesitate a second to click on "Run now"

> The media way way over hype viruses and trojans and people
> auto aume that a .exe is going to cause them harm.. seems you've
> falled into the hysteria trap (please don't take that offensively..
> many many do that maybe don't understand that particular aspect of
> computing very well).

I agree there is a media hype around viri and other malicious code. But
running an unknown program from an unknown source locally on some Windows
system (it was an EXE) is like playing Russian roulette.

> There's nothing wrong with using binary files on the server, some

Oh no, that's ok. No doubt about that.

However, if it is a server side program indeed, then how are we supposed to
comment on the code? There is no way to see it.
And if it would be a client side EXE, then how are we supposed to comment on
it again? There is no (easy) way to reverse engineer the original Perl code.

In the worst case this was a virus/trojan horse/worm/who knows.
And as pointed out by others: in the best case it was a useless posting
because there is no way to evaluate the code because there is no way to get
at it in the first place. Regardless of client or server side code.

jue





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

Date: Tue, 25 Feb 2003 00:26:05 +0100
From: "Tore Aursand" <tore@aursand.no>
Subject: Re: Using DBI::mysql
Message-Id: <pan.2003.02.24.23.18.01.501140@aursand.no>

On Mon, 24 Feb 2003 21:55:33 +0000, Geoff Soper wrote:
> my $first_name = $dbh->prepare ( "SELECT first_name FROM users WHERE
> username = \'geoff\'");
> 
> #What do I need here??

Why didn't you read the DBI documentation first?

  'perldoc DBI'
  'perldoc DBD::mysql'

Very helpful.  Anyway.  The first thing you should do, is to 'bind' the
parameters into the SQL query;

  my $username = 'geoff';
  my $stFirstName = $dbh->prepare('SELECT first_name
                                   FROM users 
                                   WHERE username = ?');
  $stFirstName->execute( $username );
  my ( $firstname ) = $stFirstName->fetchrow();
  $stFirstName->finish();


-- 
Tore Aursand - tore@aursand.no - http://www.aursand.no/



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

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


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