[25225] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7470 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 1 18:05:41 2004

Date: Wed, 1 Dec 2004 15:05:08 -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           Wed, 1 Dec 2004     Volume: 10 Number: 7470

Today's topics:
    Re: "anonymous" variable in Perl? (J. Romano)
    Re: "anonymous" variable in Perl? <Juha.Laiho@iki.fi>
        <FORM> Submit question with perl cgi scripts dogdog@noemail.com
    Re: <FORM> Submit question with perl cgi scripts <noreply@gunnar.cc>
    Re: <FORM> Submit question with perl cgi scripts <spamtrap@dot-app.org>
        Delete lines in a file (Adam)
    Re: Delete lines in a file <jurgenex@hotmail.com>
    Re: Delete lines in a file <mritty@gmail.com>
    Re: Delete lines in a file (J. Romano)
    Re: dmake.exe:  Error code 255, while making 'test' <thirault@liberation.fr>
        FAQ 2.1: What machines support Perl?  Where do I get it <comdog@panix.com>
        FAQ 9.10: How do I decode or create those %-encodings o <comdog@panix.com>
    Re: GD Graph Pie Formatting (Pascal)
    Re: GD Graph Pie Formatting <spamtrap@dot-app.org>
        How to Recruit Perl Developers? (fuego)
    Re: parent of an orphaned process <ddunham@redwood.taos.com>
    Re: parse tr socket $buf dogdog@noemail.com
    Re: Passing huge double arrays in XML-RPC <perl@my-header.org>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 1 Dec 2004 08:20:35 -0800
From: jl_post@hotmail.com (J. Romano)
Subject: Re: "anonymous" variable in Perl?
Message-Id: <b893f5d4.0412010820.5ccae2a6@posting.google.com>

Richard Gration <richard@zync.co.uk> wrote in message news:<pan.2004.11.30.09.51.53.678817@zync.co.uk>...
> 
> You can use undef as an lvalue, as in:
> 
> my $month;
> (undef,undef,undef,undef,$month) = localtime time;


   Just so you know, you can combine the above two lines to one that
looks like:

      my (undef, undef, undef, undef, $month) = localtime time;

or even (as has already been pointed out by another poster):

      (undef, undef, undef, undef, my $month) = localtime time;

I prefer the first line over the second because I find it's more
readable.

   I wouldn't normally think that an "undef" would be allowed in a
variable declaration list, but fortunately Perl is smart enough to
realize that "undef" in a variable declaration list should be ignored.
 (As a result, "undef" occasionally makes a great placeholder.)

   Just thought you might want to know.

   -- Jean-Luc


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

Date: Wed, 1 Dec 2004 17:04:54 +0000 (UTC)
From: Juha Laiho <Juha.Laiho@iki.fi>
Subject: Re: "anonymous" variable in Perl?
Message-Id: <coktjm$5lk$3@ichaos.ichaos-int>

KKramsch <karlUNDERSCOREkramsch@yahooPERIODcom.invalid> said:
>In <219750c.0411300129.2f369a1c@posting.google.com> ronaldf@eml.cc
>(Ronald Fischer) writes:
>
>>Consider a call to, say, localtime, where I only need the current month:
>
>>my ($a, $b, $c, $d, $month) = localtime time,
>
>What I usually do in such cases is something like this
>
>my $month = (localtime)[4];

 ... and if more than one of the return values is needed, it's equally simple:

my ($day,$month) = (localtime)[3,4];
-- 
Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
         PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)


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

Date: Wed, 01 Dec 2004 22:27:58 GMT
From: dogdog@noemail.com
Subject: <FORM> Submit question with perl cgi scripts
Message-Id: <pan.2004.12.01.22.27.59.60691@noemail.com>

Another question, guess I could start a daily question
roster since I've been posting so much lately.

Here goes.

I have my HTML document setup to submit to a cgi script.
The script passes information to my server and responds
back as it should. However, I would like to be able to 
do the following:

1. Have the response post back to my original webpage and
not create a seperate page with the information.
2. If 1 is possible, I would like to have the items returned
to the original webpage placed into the textboxes that I have
setup. These boxes are used when I input information to the
server I have and hit submit. 

Any way to do this ?? Would appreciate suggestions, examples
anything in relation to this.

Thanks
dogdog


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

Date: Wed, 01 Dec 2004 23:45:21 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: <FORM> Submit question with perl cgi scripts
Message-Id: <316vqhF389eg0U1@individual.net>

dogdog@noemail.com wrote:
> I have my HTML document setup to submit to a cgi script. The script
> passes information to my server and responds back as it should.
> However, I would like to be able to do the following:
> 
> 1. Have the response post back to my original webpage and not create
> a seperate page with the information. 2. If 1 is possible, I would
> like to have the items returned to the original webpage placed into
> the textboxes that I have setup. These boxes are used when I input
> information to the server I have and hit submit.

Have the script generate the empty HTML form when invoked without
arguments, and have it include the items when invoked via the submit
button.

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


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

Date: Wed, 01 Dec 2004 17:49:34 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: <FORM> Submit question with perl cgi scripts
Message-Id: <bN2dnUUwTvHi1zPcRVn-3Q@adelphia.com>

dogdog@noemail.com wrote:

> 1. Have the response post back to my original webpage and
> not create a seperate page with the information.

CGI.pm is well suited for that. By default, its methods for producing 
form elements will read the values it assigns to those elements from the 
incoming request.

> Any way to do this?

All is revealed in the docs for CGI.pm:

perldoc CGI

or

<http://stein.cshl.org/WWW/software/CGI/>

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: 1 Dec 2004 07:46:07 -0800
From: real_complex@yahoo.com (Adam)
Subject: Delete lines in a file
Message-Id: <a55cfae2.0412010746.9a26ce@posting.google.com>

Hello:

I am trying to solve the following problem:

A file, on each line  contains typically 5 columns (separated by tabs)
of numbers. Ocassionally, on a line, there appears a single number in
the first column. I want to delete occurrences of such lines (i.e.
lines that only contain a single number.

For example

1.2345 2.3456 3.4567 4.5678 5.6789 ---> Typical line
23                                 ---> Atypical line (delete this
occurence)

How can I do this in Perl ?

Thanks


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

Date: Wed, 01 Dec 2004 16:05:03 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Delete lines in a file
Message-Id: <PYlrd.10496$xk5.10301@trnddc09>

Adam wrote:
> A file, on each line  contains typically 5 columns (separated by tabs)
> of numbers. Ocassionally, on a line, there appears a single number in
> the first column. I want to delete occurrences of such lines (i.e.
> lines that only contain a single number.

Your Question is Asked Frequently, see
    perldoc -q "delete a line"

jue 




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

Date: Wed, 01 Dec 2004 16:54:52 GMT
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Delete lines in a file
Message-Id: <wHmrd.3587$8v3.1952@trndny08>

"Jürgen Exner" <jurgenex@hotmail.com> wrote in message
news:PYlrd.10496$xk5.10301@trnddc09...
> Adam wrote:
> > A file, on each line  contains typically 5 columns (separated by
tabs)
> > of numbers. Ocassionally, on a line, there appears a single number
in
> > the first column. I want to delete occurrences of such lines (i.e.
> > lines that only contain a single number.
>
> Your Question is Asked Frequently, see
>     perldoc -q "delete a line"

I disagree that Tie::File is needed for this operation.  This would
suffice, no?

perl -ni.bak -e'print unless /^\d+$/' file.txt

(obviously, may need to modify the regexp if decimals or other
representations of numbers are allowed on the atypical lines)

Paul Lalli



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

Date: 1 Dec 2004 12:48:01 -0800
From: jl_post@hotmail.com (J. Romano)
Subject: Re: Delete lines in a file
Message-Id: <b893f5d4.0412011248.33683b51@posting.google.com>

real_complex@yahoo.com (Adam) wrote in message news:<a55cfae2.0412010746.9a26ce@posting.google.com>...
> 
> A file, on each line  contains typically 5 columns (separated by tabs)
> of numbers. Ocassionally, on a line, there appears a single number in
> the first column. I want to delete occurrences of such lines (i.e.
> lines that only contain a single number.
> 
> For example
> 
> 1.2345 2.3456 3.4567 4.5678 5.6789 ---> Typical line
> 23                                 ---> Atypical line (delete this
> occurence)


   Try this:

In UNIX:
   perl -ne 'print  unless m/^\d+$/' input.txt > output.txt

In DOS (Win32):
   perl -ne "print  unless m/^\d+$/" input.txt > output.txt

   The file "input.txt" will be the file you already have, and
"output.txt" will be the file that will be created, which will be
exactly like "input.txt" except that it won't have any lines
consisting of a single number (i.e., the atypical lines).

   I hope this helps.

   -- Jean-Luc


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

Date: Wed, 1 Dec 2004 20:42:59 +0100
From: "tt" <thirault@liberation.fr>
Subject: Re: dmake.exe:  Error code 255, while making 'test'
Message-Id: <col6sp$p1i$1@s5.feed.news.oleane.net>


"Michael Carman" <mjcarman@mchsi.com> a écrit dans le message de news: 
coirg7$2vs1@onews.rockwellcollins.com...
> Please don't top-post. Place your comments *after* the text you are
> replying to. [post reordered]
>
> tt wrote:
>>
>> "Ben Morrow" <usenet@morrow.me.uk> a écrit dans le message de news:
>> eckp72-ts4.ln1@osiris.mauzo.dyndns.org...
>>
>>> Quoth "tt" <thirault@liberation.fr>:
>>>>
>>>> [Alternative: text/html]
>>>
>>> Don't do that.
>>>
>>>> [Attachment type=image/gif, name=BlankBkgrd.gif]
>>>
>>> And *certainly* don't do that.
>>
>> I don't understand.
>
> Usenet is a textual medium. Don't post markup (like HTML). Not everyone
> is using a newsreader that understands such things. Similarly, don't
> post binaries (like images). [There are newsgroups where posting of
> binaries is permitted, but these usually have "binaries" somewhere in
> their name.]
>
> -mjc

Ok thanks for informations.

t 




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

Date: Wed, 1 Dec 2004 17:03:03 +0000 (UTC)
From: PerlFAQ Server <comdog@panix.com>
Subject: FAQ 2.1: What machines support Perl?  Where do I get it?
Message-Id: <coktg7$j7m$1@reader1.panix.com>

This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with Perl.

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

2.1: What machines support Perl?  Where do I get it?

    The standard release of Perl (the one maintained by the perl development
    team) is distributed only in source code form. You can find this at
    http://www.cpan.org/src/latest.tar.gz , which is in a standard Internet
    format (a gzipped archive in POSIX tar format).

    Perl builds and runs on a bewildering number of platforms. Virtually all
    known and current Unix derivatives are supported (Perl's native
    platform), as are other systems like VMS, DOS, OS/2, Windows, QNX, BeOS,
    OS X, MPE/iX and the Amiga.

    Binary distributions for some proprietary platforms, including Apple
    systems, can be found http://www.cpan.org/ports/ directory. Because
    these are not part of the standard distribution, they may and in fact do
    differ from the base Perl port in a variety of ways. You'll have to
    check their respective release notes to see just what the differences
    are. These differences can be either positive (e.g. extensions for the
    features of the particular platform that are not supported in the source
    release of perl) or negative (e.g. might be based upon a less current
    source release of perl).



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

Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short.  They represent an important
part of the Usenet tradition.  They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.

If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile.  If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.

Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release.  It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.

The perlfaq manual page contains the following copyright notice.

  AUTHOR AND COPYRIGHT

    Copyright (c) 1997-2002 Tom Christiansen and Nathan
    Torkington, and other contributors as noted. All rights 
    reserved.

This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.


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

Date: Wed, 1 Dec 2004 23:03:04 +0000 (UTC)
From: PerlFAQ Server <comdog@panix.com>
Subject: FAQ 9.10: How do I decode or create those %-encodings on the web?
Message-Id: <colij8$qon$1@reader1.panix.com>

This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with Perl.

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

9.10: How do I decode or create those %-encodings on the web?

    If you are writing a CGI script, you should be using the CGI.pm module
    that comes with perl, or some other equivalent module. The CGI module
    automatically decodes queries for you, and provides an escape() function
    to handle encoding.

    The best source of detailed information on URI encoding is RFC 2396.
    Basically, the following substitutions do it:

        s/([^\w()'*~!.-])/sprintf '%%%02x', ord $1/eg;   # encode

        s/%([A-Fa-f\d]{2})/chr hex $1/eg;            # decode

    However, you should only apply them to individual URI components, not
    the entire URI, otherwise you'll lose information and generally mess
    things up. If that didn't explain it, don't worry. Just go read section
    2 of the RFC, it's probably the best explanation there is.

    RFC 2396 also contains a lot of other useful information, including a
    regexp for breaking any arbitrary URI into components (Appendix B).



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

Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short.  They represent an important
part of the Usenet tradition.  They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.

If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile.  If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.

Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release.  It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.

The perlfaq manual page contains the following copyright notice.

  AUTHOR AND COPYRIGHT

    Copyright (c) 1997-2002 Tom Christiansen and Nathan
    Torkington, and other contributors as noted. All rights 
    reserved.

This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.


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

Date: 1 Dec 2004 10:18:16 -0800
From: pascal@straec.com (Pascal)
Subject: Re: GD Graph Pie Formatting
Message-Id: <3c155555.0412011018.f213ac5@posting.google.com>

Sherm Pendley <spamtrap@dot-app.org> wrote in message news:<Q-Kdnf9ijqtg8DDcRVn-gw@adelphia.com>...
> Pascal wrote:
> 
> > print $gd->jpeg;
> 
> Not really on-topic for a Perl group, but you might want to try an image 
> type that's better suited for this type of imagery, like GIF or PNG. 
> JPEG is optimized for photographic content, and it isn't very well 
> suited to blocks of solid colors with sharp boundaries.
> 
> sherm--

I've tried PNG and it looks identical. If the wrong forum please
inform on the correct one. I dont think it is the image format... i
think it is the font that is at issue. i cant get it to change size.


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

Date: Wed, 01 Dec 2004 16:59:18 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: GD Graph Pie Formatting
Message-Id: <zKWdnWJNU5ArozPcRVn-sA@adelphia.com>

Pascal wrote:

> I've tried PNG and it looks identical. If the wrong forum please
> inform on the correct one.

Sorry, I didn't mean to say it was the wrong place for your question, I 
meant than my answer was going astray, as it had nothing to do with 
Perl. I thought the JPEG compression might be blurring the text, making 
it harder to read.

> think it is the font that is at issue. i cant get it to change size.

GD uses FreeType for font rendering, which supports scalable fonts. If 
there are none installed, it might be defaulting to a bitmapped font. If 
you're using Linux, or another *nix that doesn't come with many display 
fonts, you might want to have a look around the FreeType site 
<http://freetype.sourceforge.net> for links.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: 1 Dec 2004 06:30:13 -0800
From: fuego13@excite.com (fuego)
Subject: How to Recruit Perl Developers?
Message-Id: <388e4edd.0412010630.2f1e97a2@posting.google.com>

I also posted this in the Python board.  So, please accept my
apologies if you are seeing this twice.  My company
(http://primedia.com/divisions/businessinformation/) has
two job openings that we're having a heckuva time filling.  We've
posted at Monster, Dice, jobs.perl.org and python.jobmart.com.  Can
anyone advise other job boards that might be helpful?  Also, feel free
to have a look at the job description and let me know if there is
anything that we're missing.  This is the first time we've recruited
specifically for these Python and Zope, as we've had internal
advocates who have brought its use to critical mass.
http://jobs.primediabusiness.com/ar/internal_programmer_analyst/index.htm

Thanks in advance!


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

Date: Wed, 01 Dec 2004 21:22:13 GMT
From: Darren Dunham <ddunham@redwood.taos.com>
Subject: Re: parent of an orphaned process
Message-Id: <9Cqrd.27130$zx1.20077@newssvr13.news.prodigy.com>

madhav_a_kelkar@hotmail.com wrote:
> hi all,

>             i was doing the following program in perl

>      #!/usr/bin/perl
>       2
>       3 main();
>       4
>       5 sub main
>       6 {
>       7     my $id;
>       8     if(($id=fork())==0)
>       9     {
>      10       print("in child process, id=$$!\n");
>      11       sleep 5;
>      12       $i=getppid;

What OS, what perl version, and was it built with threads?

This used to not work under Linux and a threaded perl.  I don't know if
that has changed.  getppid instead returned a value cached when the
process was launched, not a value dynamically determined.

-- 
Darren Dunham                                           ddunham@taos.com
Senior Technical Consultant         TAOS            http://www.taos.com/
Got some Dr Pepper?                           San Francisco, CA bay area
         < This line left intentionally blank to confuse you. >


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

Date: Wed, 01 Dec 2004 20:53:56 GMT
From: dogdog@noemail.com
Subject: Re: parse tr socket $buf
Message-Id: <pan.2004.12.01.20.53.52.380411@noemail.com>

On Wed, 01 Dec 2004 10:41:34 +0000, Bart Lateur wrote:

> dogdog@noemail.com wrote:
> 
>>I can understand the concerns however I'm using ethereal and I'm
>>seeing the correct amount of bytes returning. I can also currently
>>post it using
>>print "Content-type: text/html";
>>So I guess the answer to this is that I know I'm getting the
>>right data back, I just am not sure how I can use tr in the
>>script before posting the data to the webpage. I would like
>>to remove the XXX before the 123456 and just post the 123456
>>to the webpage.
> 
> You don't want to use tr, believe me. Use a regex. Describe exactly what
> kind of data you want to extract, and make a pattern out of it. For now,
> it would seem to me that you want a substring of consecutive digits:
> 
> 	my($digits) = $buf =~ /(\d+)/;
> 
> $digits now holds that number. 
> 
> For example:
> 
> 	my $buf = "XXX 123456 lalalala";
> 	my($digits) = $buf =~ /(\d+)/;
> 	print $digits;
Bart, 

Thank you greatly .. this should work and is exactly what I was
looking for and to do. 

thanks again
dogdog


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

Date: Wed, 01 Dec 2004 22:44:28 +0100
From: Matija Papec <perl@my-header.org>
Subject: Re: Passing huge double arrays in XML-RPC
Message-Id: <r5esq01dq19lm1tm79psbqglon2j7nio3i@4ax.com>

X-Ftn-To: zapata 

"zapata" <zapata@hotmail.com> wrote:
>Whren I pass an array with doubles, I see from my port sniffer that it is 
>coded in XML in long hand, i.e. the doubles are converted to ASCII strings, 
>and enveloped with each number getting its own wrapper.
>I lose the absolute bit patterns of the doubles, and the data being passed 
>gets bulky.

I think that problem isn't RPC related (compare Dumper \@zip before and
after rpc call), but you can force doubles to be sent as strings
($server->string) if you want to sprintf them first?



-- 
Matija


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

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


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