[22027] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4249 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 11 14:06:53 2002

Date: Wed, 11 Dec 2002 11: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, 11 Dec 2002     Volume: 10 Number: 4249

Today's topics:
        Apology (Rob Richardson)
    Re: Comparison confusion (Rob Richardson)
    Re: Get current date / time? <RobTM@fake.addr.ess>
    Re: Get current date / time? <dave@dave.org.uk>
    Re: HOW DO YOU CONSTRUCT A URL STRING FROM A POST METHO (gnuist006)
    Re: open (Walter Roberson)
    Re: perl bad interpreter: No such file or directory (Tad McClellan)
    Re: reg exp problem (jaya prakash)
        Return a range of strings (jim ryan)
    Re: The CPAN Police (was: Re: first element of a hash) <bkennedy@hmsonline.com>
    Re: The CPAN Police (was: Re: first element of a hash) <comdog@panix.com>
    Re: The CPAN Police (was: Re: first element of a hash) <bkennedy@hmsonline.com>
    Re: The CPAN Police (was: Re: first element of a hash) <comdog@panix.com>
    Re: Using Mail::Header modul for array of messages <No_Mail_Address@cox.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 11 Dec 2002 08:28:31 -0800
From: therobs@n2net.net (Rob Richardson)
Subject: Apology
Message-Id: <f79bc007.0212110828.26caba2@posting.google.com>

tadmc@augustmail.com (Tad McClellan) wrote in message news:<slrnavd8dv.49c.tadmc@magna.augustmail.com>...
> Rob Richardson <therobs@n2net.net> wrote:
> > 
> > No thanks to Tad.  
> 

Tad,

I apologize for this mean-spirited message.  It was childish and I
should have known better.

Rob


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

Date: 11 Dec 2002 08:44:20 -0800
From: therobs@n2net.net (Rob Richardson)
Subject: Re: Comparison confusion
Message-Id: <f79bc007.0212110844.2768d4fc@posting.google.com>

James,

Thanks for the links.  Unfortunately, the Yahoo group appears no
longer to exist.  There's one called beginning_perl, but it was
established two months ago and has only 7 members and no messages.

Rob, who will now go look at learn.perl.org.


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

Date: 11 Dec 2002 16:01:26 GMT
From: Robert Szczygiel <RobTM@fake.addr.ess>
Subject: Re: Get current date / time?
Message-Id: <slrn.pl.aveoal.128.RobTM@pcmic25.cern.ch>

Jon Rogers wrote:
> Is it possible to get hold of the current date / time without having to
> install a lot of CPAN modules? I have 5.8.1.

use POSIX qw(strftime);
$now_string = strftime "%a %b %e %H:%M:%S %Y", localtime;

perldoc -f localtime

RobTM:)
-- 
** - Why a bike cannot stand up by itself?
** - Because it is two-tyred!
-- http://3226865153/~szczygie --


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

Date: Wed, 11 Dec 2002 17:35:01 +0000
From: "Dave Cross" <dave@dave.org.uk>
Subject: Re: Get current date / time?
Message-Id: <pan.2002.12.11.17.35.01.921760@dave.org.uk>

On Wed, 11 Dec 2002 16:45:23 +0100, Jon Rogers wrote:

> I have 5.8.1.

You do? How did you manage that? Can we all get a copy?

Dave...

-- 
  And crawling on the planet's face, some insects called the human race
  Lost in time, and lost in space. And meaning.



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

Date: 11 Dec 2002 09:17:37 -0800
From: gnuist006@hotmail.com (gnuist006)
Subject: Re: HOW DO YOU CONSTRUCT A URL STRING FROM A POST METHOD IN A FORM
Message-Id: <b00bb831.0212110917.48319f04@posting.google.com>

> Good for you. So you have a question about HTML and CGI.
> What is your Perl question?

I know little on how to solve this problem with perl. THe post
below gives how to do it with perl. But since I do not know perl
I want someone to give a little perl script to do it. Then I take
from there.

gnuist

"Carsten Prodoehl" <carsten.prodoehl@neuroinformatik.ruhr-uni-bochum.de>
schrieb im Newsbeitrag
news:3C349422.32F0F573@neuroinformatik.ruhr-uni-bochum.de...
[...]
| Unfortunatly I do not know up till now how to issue http request via
| perl directly so I have used wget -http-name -http-password -
| 'http://cgi...'
| to load the data in a perl array. This has worked until the content
| provider
| has changed the html code. It is now using the mentioned post method
| instead of the old get method and the name and password supplied via
| wget are ignored. You have to go through both screens now. A solution
| would be to do issue the http request from my perl script directly and
| set all the need variables and options.
| Has anyone an idea what is a useful module that helps you to do that or
| at least where I can read more to find out how it works. I hope I will
| not have to implement all the whole html protocoll from the ground.

You might want to have a look at the LWP module that comes with Perl.

| Thanks for reading

You're welcome.

Steffen
--


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

Date: 11 Dec 2002 18:34:04 GMT
From: roberson@ibd.nrc.ca (Walter Roberson)
Subject: Re: open
Message-Id: <at80es$rl4$1@canopus.cc.umanitoba.ca>

In article <at7229$51n$1@discovery.ens-cachan.fr>,
David Nowak  <David.Nowak_NS@libertysurf.fr> wrote:
:So, instead of

:   open (STDOUT, ">-");

:what command should I use to open again the standard output after closing it?

None of {UNIX95, ANSI C, POSIX.1, perl} have any mechanism to keep
track of where a file descriptor -used to be- open to. 

If you knew for sure that STDOUT should now go to the user's
terminal [and don't be too sure that a terminal exists, this
could be a batch job!] then you should open /dev/tty on Unix
or CON: on Windows.

If there was a chance that STDOUT might have been associated with
a file or pipe and you want to get back to that same place, you are
stuck unless you keep track of that place yourself. UNIX and perl
provide standard mechanism to help you keep track, by duplicating
file descriptors. The other poster referred you to the FAQ section
on how to do this.


My guess, considering your code, is that you are likely approaching
this the wrong way. Any time you find yourself changing STDOUT,
you should ask yourself whether that's really what you want to do,
or if instead you just want to change the location that is written
to if the "print" statement did not explicitly specify a handle
to write to. If you want to change the output location for 
prints that do not have a handle specified, then there is a much
simpler way to do so: select() the new handle. perldoc -f select
--
You have reached The Usenet Community. All our operators are occupied
right now. Your posting is important to us, so please stay on the
newsgroup, and someone will be with you shortly.


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

Date: Wed, 11 Dec 2002 10:34:28 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: perl bad interpreter: No such file or directory
Message-Id: <slrnaveq8k.1ja.tadmc@magna.augustmail.com>

Stas Neuberger <stas@epost.de> wrote:

> the line feeds are unix style.


Despite your assertions to the contrary, I persist in not believing them.

Try this (on Unix):

    perl -pe 'tr/\r//d' myprog >myprog.out

    ls -l myprog myprog.out


If the filesizes are the same, then you're right and we're wrong.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 11 Dec 2002 11:02:10 -0800
From: prakashrj@hotmail.com (jaya prakash)
Subject: Re: reg exp problem
Message-Id: <ee5d9.0212111102.31efce86@posting.google.com>

> 
> 
> Use this in your loop instead:
> 
>     pos($sequence) = pos($sequence) - 1;

That should help me get what I expected.

> 
> But I'm pretty sure that that will prove unsatisfactory as well...

thats exactly what I want. I don't have words to appreciate your
patience and greatness. Just to tell you what exactly I wanted. My
program should be able to catch all multiple sequences of (single,
double, triple characters).

Example patterns: 
aaaaaaaaaaaaa
atatatatatatatatat
actactactactactactact

Thanks again for helping me out.


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

Date: 11 Dec 2002 10:24:31 -0800
From: ryan@jimryan.com (jim ryan)
Subject: Return a range of strings
Message-Id: <d220d0c9.0212111024.46a90dd0@posting.google.com>

I want to parse the output from a command and find a particular
string, "foo".  When this string is found I want to return it as well
as x number of strings above it, and y number of strings below it.  I
was thinking I could use the grep function, but it only returns the
string found, or the number of times it occurs.

So if the output from the command is...

this is
the output
from 
the command
I sent
to the 
command interperter

 ...and I search for "I sent" and I want to return 1 line below and 3
lines above I should get...


the output
from 
the command
I sent
to the 

Also, I might want to return something 3 lines above, and not return
the string found at all.

What is one way I could attack this?

Thank you
-jim


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

Date: Wed, 11 Dec 2002 11:18:24 -0500
From: "Ben Kennedy" <bkennedy@hmsonline.com>
Subject: Re: The CPAN Police (was: Re: first element of a hash)
Message-Id: <C8acnZmXl9As-GqgXTWcpg@giganews.com>


"brian d foy" <comdog@panix.com> wrote in message
news:101220022359294944%comdog@panix.com...
> In article <t109vuggdedhcgfkq2ihcpmiupqg96ee6g@4ax.com>, Bart Lateur
> <bart.lateur@pandora.be> wrote:

> > There's no use in having 5 or 10 modules on CPAN
> > all for the same purpose, with no clear advantage of the newer ones over
> > the already existing ones, but with more bugs. It makes CPAN, and Perl,
> > look like a mess.
>
> CPAN would be much less useful with this sort of moderation.  people
> should be allowed to upload what they like to their author directory and
> let people use it or not use it.

How does saying "no, we already have a module that does exactly what your
module does so we won't add it" decrease the usefulness of CPAN?  Adding a
redundant module produces one the following issues:

1) New module is better / more robust / faster

This is bad because all the existing code that depends on the old module
will have to be ported to a new interface, if people even discover that a
new better module exists

2) New module has same in quality of implementation

This is bad because people now who require the features of the module have
to research two different packages to figure out what to use.  Furthermore,
who knows which module is going to receive more attention/updates in the
future.  Hopefully you don't pick the one that breaks at 5.8.1 while the
author switched to python 2 years ago

3) New module has poorer implemention

This is bad because now people who don't take the time to do research may
end up using poorer code for no good reason

What really should happen is that the author of the new module should get
together with the author of the original module and make suggestions or
ideas for improvement, or perhaps even take over as author.  Or if there are
new features the original author doesn't want, derive a new module that
implements them.  I have a feeling that a lot of authors upload redundant
modules simply for the sake of uploading, or just don't bother to take the
time to see if an existing module exists.

In all honestly, I probably have an incorrect view of CPAN - I view it as a
extended set of Perl libraries (for which redundacy is a killer) rather than
a freshmeat-esque collection of all things Perl, which is really what it is.

--Ben Kennedy




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

Date: Wed, 11 Dec 2002 10:31:15 -0600
From: brian d foy <comdog@panix.com>
Subject: Re: The CPAN Police (was: Re: first element of a hash)
Message-Id: <111220021031156826%comdog@panix.com>

In article <C8acnZmXl9As-GqgXTWcpg@giganews.com>, Ben Kennedy
<bkennedy@hmsonline.com> wrote:

> "brian d foy" <comdog@panix.com> wrote in message
> news:101220022359294944%comdog@panix.com...

> > In article <t109vuggdedhcgfkq2ihcpmiupqg96ee6g@4ax.com>, Bart Lateur
> > <bart.lateur@pandora.be> wrote:


> > CPAN would be much less useful with this sort of moderation.  people
> > should be allowed to upload what they like to their author directory and
> > let people use it or not use it.

> How does saying "no, we already have a module that does exactly what your
> module does so we won't add it" decrease the usefulness of CPAN?

any additional steps in the process of making software available 
decreases people's willingness to deal with the process.  if people
do not upload software, there is no CPAN.

people can upload whatever they like, but we don't register every
namespace.

-- 
brian d foy, comdog@panix.com


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

Date: Wed, 11 Dec 2002 12:35:50 -0500
From: "Ben Kennedy" <bkennedy@hmsonline.com>
Subject: Re: The CPAN Police (was: Re: first element of a hash)
Message-Id: <5c6dnX9bZatF6mqgXTWcqA@giganews.com>


"brian d foy" <comdog@panix.com> wrote in message
news:111220021031156826%comdog@panix.com...

> any additional steps in the process of making software available
> decreases people's willingness to deal with the process.  if people
> do not upload software, there is no CPAN.
>
> people can upload whatever they like, but we don't register every
> namespace.

First of all, people don't have to "do" anything.  The notion of "CPAN
police" is server-side moderation on uploaded modules.  Second, I am not
suggesting any rules that aren't already explicitly stated in the CPAN
module guide:

http://www.cpan.org/modules/00modlist.long.html#ID2_Guidelinesf

What's wrong with rejecting modules from people who didn't or won't follow
these guidelines?  Clearly the author of Tie::InsertOrderHash didn't, or he
would have turned up Tie::IxHash.  As time goes on, the problem is only
going to get worse and worse.  I do not accept that any barrier to getting
people to upload code, no matter how trivial, is bad simply because it will
lower the overall quantity of code on CPAN.  I assure you that dedicated
authors who have a serious interest in the Perl community will keep
producing quality code because if they are indeed serious, they would have
followed the guidelines in the first place.

--Ben Kenendy






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

Date: Wed, 11 Dec 2002 12:58:07 -0600
From: brian d foy <comdog@panix.com>
Subject: Re: The CPAN Police (was: Re: first element of a hash)
Message-Id: <111220021258071283%comdog@panix.com>

In article <5c6dnX9bZatF6mqgXTWcqA@giganews.com>, Ben Kennedy
<bkennedy@hmsonline.com> wrote:

> "brian d foy" <comdog@panix.com> wrote in message
> news:111220021031156826%comdog@panix.com...

> > any additional steps in the process of making software available
> > decreases people's willingness to deal with the process.  if people
> > do not upload software, there is no CPAN.

> > people can upload whatever they like, but we don't register every
> > namespace.

> First of all, people don't have to "do" anything. 

sure they do.  they have to upload their module.  if they want to 
be in the module list, they have to fill out the "Register Namespace"
form in PAUSE.


> The notion of "CPAN
> police" is server-side moderation on uploaded modules.

that's a moderation step that people have to go through.  they would
have to explain why their module deserves to be in CPAN.  that's a
deterrent.  if people think that their work will be rejected, they
are less likely to make it available through CPAN.


> What's wrong with rejecting modules from people who didn't or won't follow
> these guidelines?

we typically do not register those namespaces, as i said before.

i understand your opinion, but i disagree.

you are free to build your own search engine on top of CPAN though.

-- 
brian d foy, comdog@panix.com


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

Date: Wed, 11 Dec 2002 16:09:34 GMT
From: Fred <No_Mail_Address@cox.net>
Subject: Re: Using Mail::Header modul for array of messages
Message-Id: <3DF763BE.EFFD3FF7@cox.net>


"John W. Krahn" wrote:
> 
> Fred wrote:
> >
> > I want to use Mail::Header to make a summary of my Mozilla Mailbox
> > (containing 300 messages). The following code runs without error, but
> > creates only an empty outfile. The reason is probably in the line
> > my $header = new Mail::Header $message;
> > I tried all kinds of variations of this line, but nothing worked.
> >
> > --- Fred
> >
> > #!/usr/bin/perl -w
> >
> >         use strict ;
> >         use Mail::Header;
> >
> >         my $messagefile = shift ;
> >         my $outfile = shift ;
> >         my ($message) ;
> >
> >         local $/ = undef ;
> >
> >         open (MESSAGE, "$messagefile") or die "Unable to open
> > $messagefile:$!\n";
> >         open(OUT, "> $outfile") or die "Could not open $outfile for writing:
> > $!\n";
> >
> >         my @messages = split (/^From -/m, <MESSAGE>) ;
> >
> >         foreach $message (@messages) {
> >                 my $header = new Mail::Header $message;
> >                 my @from = $header->get("From");
> >                 my @subject = $header->get("Subject");
> >                 my @date = $header->get("Date");
> >
> >         foreach (@from) {print OUT "From: ", $_ };
> >         foreach (@subject) {print OUT "Subject: ", $_ };
> >         foreach (@date) {print OUT "Date: ", $_ };
> >         }
> 
> You should probably use Mail::Util::read_mbox() to read the mail file:
> 
> #!/usr/bin/perl -w
> use strict;
> use Mail::Util qw(read_mbox);
> use Mail::Header;
> 
> my $messagefile = shift;
> my $outfile = shift;
> 
> open OUT, "> $outfile" or die "Could not open $outfile for writing:
> $!\n";
> 
> foreach my $message ( read_mbox $messagefile ) {
>     my $header = new Mail::Header $message;
>     print OUT "From: $_"    for $header->get( 'from' );
>     print OUT "Subject: $_" for $header->get( 'subject' );
>     print OUT "Date: $_"    for $header->get( 'date' );
>     }
> 
> __END__
> 
> John
> --

Thank you John. Actually I just would like to learn how to open a new
Mail::Header object from a variable ($message) instead of a file
(\*MESSAGE).

--- Fred


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

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


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