[28266] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9630 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Aug 20 14:05:52 2006

Date: Sun, 20 Aug 2006 11:05:04 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 20 Aug 2006     Volume: 10 Number: 9630

Today's topics:
        ANNOUNCE: CGI::Explorer V 2.07 <ron@savage.net.au>
    Re: FAQ 4.22 How do I expand function calls in a string <justin.0607@purestblue.com>
        filehandles <ssivasish@yahoo.co.in>
    Re: filehandles <thepoet_nospam@arcor.de>
    Re: filehandles <justin.0607@purestblue.com>
    Re: filehandles <nobull67@gmail.com>
    Re: filehandles <mgarrish@gmail.com>
    Re: filehandles <1usa@llenroc.ude.invalid>
        Get paid to post in forums.. bloggerer@gmail.com
        Getopt::Std argument list mistake? <zhushenli@gmail.com>
    Re: Getopt::Std argument list mistake? <zhushenli@gmail.com>
    Re: Getopt::Std argument list mistake? <mritty@gmail.com>
    Re: How to install module when I am not allowed to inst <mritty@gmail.com>
    Re: How to install module when I am not allowed to inst <zaifengwang@gmail.com>
    Re: How to install module when I am not allowed to inst <mritty@gmail.com>
    Re: Sort Keys in hash table? <zhushenli@gmail.com>
    Re: Sort Keys in hash table? <mritty@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 20 Aug 2006 02:13:51 GMT
From: Ron Savage <ron@savage.net.au>
Subject: ANNOUNCE: CGI::Explorer V 2.07
Message-Id: <J4B203.1nwM@zorch.sf-bay.org>

The pure Perl module CGI::Explorer V 2.07
is available immediately from CPAN,
and from http://savage.net.au/Perl-modules.html.

On-line docs, and a *.ppd for ActivePerl are also
available from the latter site.

An extract from the docs:

2.07  Fri Aug 18 12:01:00 2006
	- There are no code changes in this version - there is no need to upgrade
	- Change the directory structure for css, js and images, to use URLs of the
form
		/assets/css/explorer/*.css
		/assets/images/explorer/*.png
		/assets/js/explorer/*.js
	- Change the defaults and POD in Explorer.pm, xtree.js, and the examples, to
match the new directory structure
	- Make various small corrections and clarifications to the POD




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

Date: Sun, 20 Aug 2006 09:52:50 -0000
From: Justin C <justin.0607@purestblue.com>
Subject: Re: FAQ 4.22 How do I expand function calls in a string?
Message-Id: <slrneegc64.3bn.justin.0607@moonlight.purestblue.com>

On 2006-08-20, PerlFAQ Server <brian@stonehenge.com> wrote:
>
>     In most cases, it is probably easier to simply use string concatenation,
>     which also forces scalar context.
>
>             print "The time is " . localtime . ".\n";

perl -e 'print "The time is " . localtime . ".\n"'
Warning: Use of "localtime" without parentheses is ambiguous at -e line 1.
The time is Sun Aug 20 10:47:37 2006.

Wouldn't it be better for examples to not generate warnings? What I
mean is that examples should show best practice, which, in this case, 
would be 'print "the time is " . localtime() ...etc".

	Justin.

-- 
Justin C, by the sea. 


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

Date: 20 Aug 2006 02:38:13 -0700
From: "sivasish" <ssivasish@yahoo.co.in>
Subject: filehandles
Message-Id: <1156066692.967327.190690@m73g2000cwd.googlegroups.com>

i am getting an error when i am trying to compile folling program in
perl

#!/usr/bin/perl-w
$file= 'siva.pep';
open(FILENAME,$file);
@protein=<FILENAME>;
print @protein;
close FILENAME;

ERROR - readline<>is a closed filehandle FILENAME.........

file "siva.pep" is stored in F DIRECTORY.
I am not able understand the error. .



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

Date: Sun, 20 Aug 2006 12:13:08 +0200
From: Christian Winter <thepoet_nospam@arcor.de>
Subject: Re: filehandles
Message-Id: <44e835b1$0$6993$9b4e6d93@newsspool1.arcor-online.net>

sivasish wrote:
> i am getting an error when i am trying to compile folling program in
> perl
> 
> #!/usr/bin/perl-w
> $file= 'siva.pep';
> open(FILENAME,$file);
> @protein=<FILENAME>;
> print @protein;
> close FILENAME;
> 
> ERROR - readline<>is a closed filehandle FILENAME.........
> 
> file "siva.pep" is stored in F DIRECTORY.
> I am not able understand the error. .

Please read the Posting Guidelines that are posted every few
days here before posting. Most of all, don't re-type your
code or error messages, but if you have to, make sure you
don't obscure your errors by spelling mistakes.

The Message you are getting is most probably something along
"readline() on closed filehandle FILENAME at ..."

You _should_ have used the strict pragma (use strict) which
would have complained to you that $file and @protein aren't
properly declared in your code (use "my $file = ..." and
"my @protein = ...").

However, the most crucial mistake here is that you don't check
if the call to open() succeeds, like recommended in the documentation
to that function (type "perldoc -f open" on the command line
to read it, or "perldoc perldoc" if you wonder about that perldoc
thingy at all).

Saying
open( FILENAME, $file ) or die "Unable to open $file: $!";
would most probably have given you the real reason for the
error you get, either a "file not found" message, or an
"access denied". From there on, you can investigate further.

HTH
-Chris


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

Date: Sun, 20 Aug 2006 10:25:20 -0000
From: Justin C <justin.0607@purestblue.com>
Subject: Re: filehandles
Message-Id: <slrneege31.3bn.justin.0607@moonlight.purestblue.com>

On 2006-08-20, sivasish <ssivasish@yahoo.co.in> wrote:
> i am getting an error when i am trying to compile folling program in
> perl
>
> #!/usr/bin/perl-w
> $file= 'siva.pep';
> open(FILENAME,$file);
> @protein=<FILENAME>;
> print @protein;
> close FILENAME;
>
> ERROR - readline<>is a closed filehandle FILENAME.........

Just because you said open siva.pep doesn't mean siva.pep got opened.

    open(FILENAME,$file) or die "Cannot open FILENAME: $!" 

would give you a clue.

"perldoc -f open" for better was to use that function.


	Justin.

-- 
Justin C, by the sea. 


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

Date: 20 Aug 2006 03:58:09 -0700
From: "Brian McCauley" <nobull67@gmail.com>
Subject: Re: filehandles
Message-Id: <1156071489.072711.232890@74g2000cwt.googlegroups.com>

sivasish wrote:

> i am getting an error when i am trying to compile folling program in
> perl

In addition to the other useful advice you've been given it appears
that you have jumped to a conclusion that that this is a compile time
error, and this may have coloured your attempts to understand it.



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

Date: 20 Aug 2006 04:54:58 -0700
From: "Matt Garrish" <mgarrish@gmail.com>
Subject: Re: filehandles
Message-Id: <1156074897.989074.97960@h48g2000cwc.googlegroups.com>


Justin C wrote:

> On 2006-08-20, sivasish <ssivasish@yahoo.co.in> wrote:
> > i am getting an error when i am trying to compile folling program in
> > perl
> >
> > #!/usr/bin/perl-w
> > $file= 'siva.pep';
> > open(FILENAME,$file);
> > @protein=<FILENAME>;
> > print @protein;
> > close FILENAME;
> >
> > ERROR - readline<>is a closed filehandle FILENAME.........
>
> Just because you said open siva.pep doesn't mean siva.pep got opened.
>
>     open(FILENAME,$file) or die "Cannot open FILENAME: $!"
>
> would give you a clue.
>
> "perldoc -f open" for better was to use that function.
>

Actually, the open command information is a bit too general in scope.
Although it makes reference to the three-argument form (which what I'm
assuming you mean by better ways), as a description of of all the ways
to use open it doesn't push any one method, and certainly not using
scalars over barewords. I thought perlopentut made reference to the
benefits of using the syntax:

open (my $infile, '<', $file) or die "Cannot open $infile : $!";

but even it is lacking. Since it's generally accepted in current
practice that this is the way one should be opening files, shouldn't
the documentation be updated to refllect this fact, or am I missing the
discussion somewhere?

Matt



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

Date: Sun, 20 Aug 2006 13:44:26 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: filehandles
Message-Id: <Xns9825632FFD975asu1cornelledu@127.0.0.1>

"sivasish" <ssivasish@yahoo.co.in> wrote in news:1156066692.967327.190690
@m73g2000cwd.googlegroups.com:

> i am getting an error when i am trying to compile folling program in
> perl
> 
> #!/usr/bin/perl-w

Do you have a special binary called perl-w in your path, or did you retype 
your code for this message? Don't retype code. Use copy & paste.

Sinan
-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html



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

Date: 20 Aug 2006 00:41:35 -0700
From: bloggerer@gmail.com
Subject: Get paid to post in forums..
Message-Id: <1156059695.429712.97380@m79g2000cwm.googlegroups.com>

myLot promises to pay as you talk on its discussion boards. You can
post and reply to whatever topic that you like.

to join:


http://www.mylot.com/?ref=blogger1






The following is taken from their website:

******************************


How does this work?

We have implemented a system to give everyone who uses the internet the

ablity to make money. The idea is pretty simple - if you contribute to
the myLot Community - whether it is by posting a new discussion,
responding to a current discussion, commenting on a current discussion,

or referring friends, you earn money. Our goal is to provide internet
users a place to earn money using the web on a day to day basis and
provide access to information they need.

We pay each and every member of myLot based on their level of activity.

As stated previously all you need to do is sign up for a myLot account
and we do the rest.

How do I set it up?

We can't stress to you enough how simple the set up process is, all
you need to do to start earning is sign up for a myLot account and
become a user.

How do I get Paid?

Get paid monthly with minimum account balance of $10 and carry forward
of unpaid amounts. All payments will be made via PayPal. All users will

be required to have a valid PayPal Premier account. Click here to learn

how to sign up for a PayPal Premier account.

What can I do to increase my earnings?

What an excellent question, and one we hope every myLot user will ask.
Use myLot, post discussions, respond to discussions.
Post quality content. For example, generate discussions that engage
other users and provide insightful responses and comments to other
users discussions to further the topic.
Refer friends. For each person you send to myLot you will receive 25%
of their earnings.

How do I refer friends?

All myLot users are automatically eligible to make money by referring
new users to myLot. Invite friends, family, new acquaintances, forum
buddies, or whomever you wish. You will receive 25% of their earnings.

I own a website. What tools are available for me to promote myLot?

Right now, the best available tool is our JavaScript feed. We will be
adding more tools in the near future. Click here to find out how to
integrate myLot content into your website (and get paid at the same
time!) with our JavaScript feed.

In general, by appending ?ref=username to the end of any myLot page,
your myLot referrals will be tracked to your user account.

Be creative. We're here to help you. The more money you make, the
faster we grow, so we're in this together!

What are the limitations?

As far as we can see, there really are no limitations. You must have a
myLot account to start.
You get paid for your activity so it is up to you as to how much time
and effort you put into this program. If you contribute you will earn
money!

Why does myLot reward its users financially?

We believe users are the most valuable asset to the longevity of any
website so why only provide them with a service, why not reward them
financially?

How do I calculate my earnings?

Its very simple, earnings equal discussion activity plus user
referrals. You will be able to see both your referral earnings and
discussion activity earnings each time you sign into myLot. The two
will be added together for your total earnings.



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

Date: 20 Aug 2006 04:41:25 -0700
From: "Davy" <zhushenli@gmail.com>
Subject: Getopt::Std argument list mistake?
Message-Id: <1156074085.442660.213630@p79g2000cwp.googlegroups.com>

Hi all,

I have write a small program to test Getopt::Std.

I found when I enter
>>perl test_opt.pl -b 100 -a 50 -v
it work OK: output: minus_result is -50

But when I enter
>>perl test_opt.pl -v -b 100 -a 50
It output the help message?

Why -v must be write at the end of the argument list??

#-------------------------
use warnings;
use strict;
use Getopt::Std;

my $help = <<"EOH";
--------------------------------------------
$0: first_vector minus second_vector

Options:
	-a first_vector
	-b second_vector
	-h print help
	-v verbose
--------------------------------------------
EOH

# set out command-line options,
# requirements, and defaults.
my %options;
getopt("a:b:hv", \%options);

die $help if exists $options{h};
die $help unless $options{a};
die $help unless $options{b};

my $first_vector = $options{a};
my $second_vector = $options{b};

my $minus_result = $first_vector - $second_vector;

if (exists $options{v}) {
    print "minus_result is $minus_result\n";
}
else {
    print "$minus_result\n";
}
#-------------------------------------

Thanks!
Davy



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

Date: 20 Aug 2006 04:52:41 -0700
From: "Davy" <zhushenli@gmail.com>
Subject: Re: Getopt::Std argument list mistake?
Message-Id: <1156074761.512757.172080@74g2000cwt.googlegroups.com>


Davy wrote:
> Hi all,
>
> I have write a small program to test Getopt::Std.
>
> I found when I enter
> >>perl test_opt.pl -b 100 -a 50 -v
> it work OK: output: minus_result is -50
>
> But when I enter
> >>perl test_opt.pl -v -b 100 -a 50
> It output the help message?
>
> Why -v must be write at the end of the argument list??
>
> #-------------------------
> use warnings;
> use strict;
> use Getopt::Std;
>
> my $help = <<"EOH";
> --------------------------------------------
> $0: first_vector minus second_vector
>
> Options:
> 	-a first_vector
> 	-b second_vector
> 	-h print help
> 	-v verbose
> --------------------------------------------
> EOH
>
> # set out command-line options,
> # requirements, and defaults.
> my %options;
> getopt("a:b:hv", \%options);
>
[snip]

Hi all,

I change getopt() to getopts() and all OK;

Thanks!
Davy

> die $help if exists $options{h};
> die $help unless $options{a};
> die $help unless $options{b};
>
> my $first_vector = $options{a};
> my $second_vector = $options{b};
>
> my $minus_result = $first_vector - $second_vector;
>
> if (exists $options{v}) {
>     print "minus_result is $minus_result\n";
> }
> else {
>     print "$minus_result\n";
> }
> #-------------------------------------
> 
> Thanks!
> Davy



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

Date: 20 Aug 2006 05:00:11 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Getopt::Std argument list mistake?
Message-Id: <1156075211.379067.304850@p79g2000cwp.googlegroups.com>

Davy wrote:
> getopt("a:b:hv", \%options);

You are confusing getopt() with getopts().  getopt() takes a list of
options that take values.  Colons don't mean anything special.
getopts() takes a list of options, and those followed by colons take a
value.  So when you put -v before -b, it assumed that -v's value was
'-b'.

Paul Lalli



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

Date: 20 Aug 2006 05:13:00 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: How to install module when I am not allowed to install moudule in system directory?
Message-Id: <1156075980.876975.56130@75g2000cwc.googlegroups.com>

pegasus wrote:
> I tried to execute CPAN in windows by typing "perl -MCPAN -e shell" but
> I failed.

That error description is not helpful.  HOW did it fail?  What error
message did you see?  What output did you see?

> but it works in Linux. But still I can't install a module by
> the command "o conf makepl_arg PREFIX="/mydic/perl/lib""

That command does not install any module.  It sets the arguments for
the `perl Makefile.PL` command that cpan runs for you.

> . confusing.
>
> I wonder how can use CPAN shell in Windows? what's the command?

perl -MCPAN -e "shell"
works fine for me (note the quotes).

But as others have said, you will need a Windows version of 'make' in
order for CPAN to do anything for you.

Paul Lalli



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

Date: 20 Aug 2006 07:33:48 -0700
From: "pegasus" <zaifengwang@gmail.com>
Subject: Re: How to install module when I am not allowed to install moudule in system directory?
Message-Id: <1156084428.761238.247850@b28g2000cwb.googlegroups.com>

To Paul Lalli:

I typed <perl -MCPAN -e "shell"> or <perl -MCPAN -e shell> in windows,
it respond:
Cannot open >C:\Perl\lib\CPAN\Config.pm at c:/Perl/lib/CPAN.pm line
1162"

It seems that it doesn't work here. Any advisory?

Paul Lalli wrote:
> pegasus wrote:
> > I tried to execute CPAN in windows by typing "perl -MCPAN -e shell" but
> > I failed.
>
> That error description is not helpful.  HOW did it fail?  What error
> message did you see?  What output did you see?
>
> > but it works in Linux. But still I can't install a module by
> > the command "o conf makepl_arg PREFIX="/mydic/perl/lib""
>
> That command does not install any module.  It sets the arguments for
> the `perl Makefile.PL` command that cpan runs for you.
>
> > . confusing.
> >
> > I wonder how can use CPAN shell in Windows? what's the command?
>
> perl -MCPAN -e "shell"
> works fine for me (note the quotes).
>
> But as others have said, you will need a Windows version of 'make' in
> order for CPAN to do anything for you.
> 
> Paul Lalli



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

Date: 20 Aug 2006 07:36:52 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: How to install module when I am not allowed to install moudule in system directory?
Message-Id: <1156084612.725971.163290@75g2000cwc.googlegroups.com>

pegasus wrote:
> To Paul Lalli:
>
> I typed <perl -MCPAN -e "shell"> or <perl -MCPAN -e shell> in windows,
> it respond:
> Cannot open >C:\Perl\lib\CPAN\Config.pm at c:/Perl/lib/CPAN.pm line
> 1162"
>
> It seems that it doesn't work here. Any advisory?

Your installation of Perl seems very broken.  I advise reinstalling it.

Paul Lalli



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

Date: 20 Aug 2006 05:13:14 -0700
From: "Davy" <zhushenli@gmail.com>
Subject: Re: Sort Keys in hash table?
Message-Id: <1156075994.364629.42010@i3g2000cwc.googlegroups.com>


A. Sinan Unur wrote:
> "Davy" <zhushenli@gmail.com> wrote in news:1155768562.219578.123460
> @i3g2000cwc.googlegroups.com:
>
> > I want to sort key in hash table.
> > The hash table key format is some integer split with ";" like:
> > "5;12;17;28"
> > And I want to sort the key from the first integer to the last
> > integer(i.e. the first integer has highest priority, and the second,
> > third,... until the last):
> >
> > example:
> > 5;12;17;28
> > 5;13;15;2
> > 5;13;18;1
>
> perldoc -f sort
>
> perldoc -q sort
>
> perldoc Sort::Maker
> http://search.cpan.org/~uri/Sort-Maker-0.05/Sort/Maker.pm
>
[snip]
Hi ,

Is there any good tutorial talk about how to CPAN module document and
use them?

Thanks!
Davy

> Show us what you have tried after reading the above, tell us what is not
> working, and we'll help.
>
> Sinan
> --
> A. Sinan Unur <1usa@llenroc.ude.invalid>
> (remove .invalid and reverse each component for email address)
>
> comp.lang.perl.misc guidelines on the WWW:
> http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html



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

Date: 20 Aug 2006 05:20:11 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Sort Keys in hash table?
Message-Id: <1156076411.238613.78260@m73g2000cwd.googlegroups.com>

Davy wrote:
> A. Sinan Unur wrote:
> > perldoc -f sort
> >
> > perldoc -q sort
> >
> > perldoc Sort::Maker
> > http://search.cpan.org/~uri/Sort-Maker-0.05/Sort/Maker.pm
> >
> [snip]
> Hi ,
>
> Is there any good tutorial talk about how to CPAN module document and
> use them?

I really don't know what you're asking for.  Are you asking how to
create modules and upload them to CPAN?

perldoc perlmodlib

Are you asking how to download and install modules from CPAN?

perldoc perlmodlib

Are you asking how to write documentation for modules?

perldoc perlpod

Are you asking for a listing of 'perldoc' documentation?

perldoc perltoc

Are you asking what modules are available on the CPAN?

perldoc -q cpan
(for links to relevant URLs)

Hope this helps,
Paul Lalli



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

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


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