[19160] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1355 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 23 00:05:45 2001

Date: Sun, 22 Jul 2001 21:05:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <995861111-v10-i1355@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 22 Jul 2001     Volume: 10 Number: 1355

Today's topics:
    Re: Collin hates subject lines. <goldbb2@earthlink.net>
        creating another file <hoss@chungk.com>
    Re: creating another file (Steven Smolinski)
        Deciphering Carp::carp message <kj0@mailcity.com>
        does the function log work in perl? (Alexvalara)
    Re: does the function log work in perl? <tony_curtis32@yahoo.com>
        Engineering vs. Hacking (was Re: How to supply modules  <newspost@coppit.org>
        FAQ: Does Perl have a round() function?  What about cei <faq@denver.pm.org>
        GMT to seconds past 1-1-1970 <craig.robinson@env.qld.gov.au>
    Re: GMT to seconds past 1-1-1970 <krahnj@acm.org>
    Re: Hashes tutorila <weiss@kung.foo.at>
    Re: How to supply modules with your software. <godzilla@stomp.stomp.tokyo>
    Re: How to supply modules with your software. <newspost@coppit.org>
        I found sprintf - is there a sscanf? <jazrant@zsc.nrcan.zc.ca>
    Re: I found sprintf - is there a sscanf? <krahnj@acm.org>
    Re: I found sprintf - is there a sscanf? <jazrant@zsc.nrcan.zc.ca>
    Re: Including a perl file into another perl file??? <rob_13@excite.com>
    Re: Including a perl file into another perl file??? <tony_curtis32@yahoo.com>
    Re: Including one perl file into another??? <racso83@bellatlantic.net>
    Re: manpage styles/templates??? <no@mail.addr>
    Re: manpage styles/templates??? <jeff@vpservices.com>
        perl wrapper for java <Neilmorris@btinternet.com>
    Re: Premature End of Script Headers <goldbb2@earthlink.net>
    Re: Premature End of Script Headers <goldbb2@earthlink.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 22 Jul 2001 23:41:46 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Collin hates subject lines.
Message-Id: <3B5B9CFA.9437E2CD@earthlink.net>

Collin E Borrlewyn wrote:
[snip]
> Any help is appreciated.

Others have pointed out the mistake you mentioned and some other
shortcomings of the code.  As a favor (since noone /else/ has mentioned
about how to keep the file open with a lock), I'll write some code with
everything put together.

One other problem with your code [which noone mentioned] is that it
doesn't localize the filehandle, and perhaps more important, it uses
DATA as the filehandle, which has special meaning to perl [well, until
you clobber it, anyway].  Usually, when a maintainer sees DATA, they
assume that it has perl's special meaning.

use constant HAS_FLOCK => eval {
	require Fcntl;
	Fcntl->import(qw(:flock));
	flock( STDOUT, 0 ); 1;
};

sub update_info {
	my ($userid, $key, $val) = @_;
	local *DATA;
	open( DATA, "+<", "$userdir/$userid" )
		or return;
	if( HAS_FLOCK ) {
		flock $datafh, LOCK_EX or return;
	}
	chomp( my $data = <DATA> );

	if( $key eq "SIG" ) {
		print DATA $val;
		return truncate(DATA, tell) && close DATA;
	}

	my %data = map { split /\*/, $_, 2 } split /\t/, $data;
	my $sig = do { local $/; <$datafh> };

	$data{$key} = $val;

	seek DATA, 0, 0 or return;
	my @data;
	while( ($key, $val) = each %data ) {
		push @data, "$key*$val";
	}
	print DATA join("\t", @data), "\n";
	print DATA $sig;

	return truncate(DATA, tell) && close DATA;
}

-- 
I need more taglines. This one is getting old.


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

Date: Sun, 22 Jul 2001 23:17:26 GMT
From: "Devon Perez" <hoss@chungk.com>
Subject: creating another file
Message-Id: <aaJ67.32492$k33.2811249@typhoon.kc.rr.com>

how do i have perl create another file? i want it to create an html file...
i use this code:
open (FILEA,">$idnum.html");
print FILEA "$test";
close(FILEA);

but it does not work, it doesnt create a new html file... please help






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

Date: Mon, 23 Jul 2001 01:36:18 GMT
From: steven.smolinski@sympatico.ca (Steven Smolinski)
Subject: Re: creating another file
Message-Id: <mcL67.4673$i%.704807@news20.bellglobal.com>

Devon Perez <hoss@chungk.com> wrote:
> how do i have perl create another file? i want it to create an html
> file...  i use this code:
>
> open (FILEA,">$idnum.html");
                             ^^
  open FILEA, "> $idnum.html" or die "Can't open $idnum.html: $!";

Always check the return values, *especially* when they fail!  Always use
perl's nice, informative error message for system calls (in $!).  Of
course you don't know what's wrong, you don't even look.

> print FILEA "$test";
              ^     ^
Useless use of doublequotes.

  print FILEA $test;

> close(FILEA);
> 
> but it does not work, it doesnt create a new html file... please help

You must provide more information than "does not work".  No one here is
a mind-reader.

Steve
-- 
Steven Smolinski => http://arbiter.ca/


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

Date: 22 Jul 2001 18:42:41 -0400
From: kj0 <kj0@mailcity.com>
Subject: Deciphering Carp::carp message
Message-Id: <9jfkt1$5nl$1@panix3.panix.com>




Carp::carp is giving me the error

  myscript: Use of uninitialized value at (eval 13) line 17.

even though myscript has no line 17.  What does this mean?  What does
"(eval 13)" mean?

Thanks,

KJ


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

Date: 22 Jul 2001 22:48:04 GMT
From: alexvalara@aol.com (Alexvalara)
Subject: does the function log work in perl?
Message-Id: <20010722184804.23805.00000489@ng-cm1.aol.com>

Hi all,
i use the log function but i figured out that i doesn't work I mean that i
tested using the log(0.3) and i got the result -1.09... which is not correct(
it should be -0.47..).

Does anyone knows why this happens?

Thanks in advance.

Alexandros


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

Date: 22 Jul 2001 18:37:13 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: does the function log work in perl?
Message-Id: <87n15wtu1i.fsf@limey.hpcc.uh.edu>

>> On 22 Jul 2001 22:48:04 GMT,
>> alexvalara@aol.com (Alexvalara) said:

> Hi all, i use the log function but i figured out that i
> doesn't work I mean that i tested using the log(0.3) and
> i got the result -1.09... which is not correct( it
> should be -0.47..).

log-e  of 0.3 is -1.20
log-10 of 0.3 is -0.52

I have no idea where you got those values from.

perldoc -f log

       log EXPR
           Returns the natural logarithm (base e) of EXPR.

hth
t
-- 
Beep beep!  Out of my way, I'm a motorist!


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

Date: Sun, 22 Jul 2001 20:40:23 -0400
From: David Coppit <newspost@coppit.org>
Subject: Engineering vs. Hacking (was Re: How to supply modules with your software.)
Message-Id: <3B5B7277.8000902@coppit.org>

Godzilla! wrote:
> Eric Bohlman wrote:
>>Yep, the difference between engineering and dabbling is that in
>>engineering, you design your system to be able to work under >>worst-case
>>conditions, whereas when you're dabbling you only care that it works >>under
>>ideal conditions.  The mark of a poor developer is that he/she >>believes
>>that Murphy's Law has been repealed.
> 
> The mark of a poor thinking person is just that; his thinking.
> 
> The Titanic, the Heindenberg, the Bradley Fighting Machine, the Edsel
> and other similar projects of time, were designed by engineers, yes?

And your point is? Who ever said that engineering was immune to failure? 
In fact, engineers always focus on failure. Read Petroski's _To Engineer 
Is Human_. For example, the engineers who built the Hindenberg were able 
to analyze the cause of failure (poor grounding of outer panels coupled 
with highly flammable paint), and learned from their failure.

To get back to the original discussion, you are advocating a position in 
which one does *not* learn from previous failure. Instead, you assume 
that you can anticipate all possibilities and design and implement a 
solution that will work on the first try. If anything, the engineering 
failures of the past support my position that you should use tried and 
true designs and components. (You can bet that ultra-light suspension 
bridges went out of vogue after the Tacoma Narrows bridge fell due to 
oscillations caused by the wind.)

> This person
> interested in learning about gravity is one of our more famous
> dabblers of history, Galileo Galilei.

LOL! Did you know that Galileo is recognized as the first scientist to 
study failure? i.e. he started engineering?

> Other famous non-engineer dabblers of history include, Socrates, Aristotle,
> Johannes Kepler, Sir Issac Newton and, more recently, Albert Einstein
> and Stephen Hawking.

Hm... Philosophers, scientists, and engineers are not comperable. 
Engineers generally apply the theories developed by scientists for the 
construction of tangible objects that benefit society. Einstein never 
would have called himself an engineer. But that doesn't make him any 
better or worse than, say, the men that sent astronauts to the moon.

> Engineers are not noted for original thought; they are noted
> for designing practical applications of others original thoughts.
> These practical applications often prove to be not very practical
> due to a lack of original thought and imagination on the part
> of narrow thinking engineers.

Engineers do rely on past experience more than you might like. But 
that's for good reason. New designs tend to be risky because of 
unanticipated issues. (See, for example, what happened to the Citibank 
building in Chicago.)

On the other hand, engineers have often shown amazing creativity. The 
moon missions show this (esp. Apollo 13). The folks at Apple are fairly 
innovative. I'm sure there plenty of other examples.

>>It's been quite reliably established that if you divide the number of
>>lines of code a programmer produces, regardless of the language used, 
>>by
>>the total number of days he/she spends on a particular project, you >>come
>>up with about 10 lines of code per day.  
> 
> Would you mind posting an easily attained reference source for
> this statistical study you quote but not cite? If not, a reader
> should dismiss your claims as unsubstantiated fabrication.

This is a well known figure among software engineers, sorta like the 
80/20 rule. It was first quantified by Belady and Lehman 
("Characteristics of Large Systems", Belady & Lehman 1977) studying the 
development of OS 360. Of course, it really depends on the application 
and how you count, but most later studies have averaged less than 100 
LOC/day (particularly studies of NASA software). This number goes up 
when you do OO because of the bloat. :)

Regards,
David



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

Date: Mon, 23 Jul 2001 00:16:58 GMT
From: PerlFAQ Server <faq@denver.pm.org>
Subject: FAQ: Does Perl have a round() function?  What about ceil() and floor()?  Trig functions?
Message-Id: <_1K67.32$T3.189598208@news.frii.net>

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 every Standard Distribution of
Perl.

+
  Does Perl have a round() function?  What about ceil() and floor()?  Trig functions?

    Remember that int() merely truncates toward 0. For rounding to a certain
    number of digits, sprintf() or printf() is usually the easiest route.

        printf("%.3f", 3.1415926535);       # prints 3.142

    The POSIX module (part of the standard Perl distribution) implements
    ceil(), floor(), and a number of other mathematical and trigonometric
    functions.

        use POSIX;
        $ceil   = ceil(3.5);                        # 4
        $floor  = floor(3.5);                       # 3

    In 5.000 to 5.003 perls, trigonometry was done in the Math::Complex
    module. With 5.004, the Math::Trig module (part of the standard Perl
    distribution) implements the trigonometric functions. Internally it uses
    the Math::Complex module and some functions can break out from the real
    axis into the complex plane, for example the inverse sine of 2.

    Rounding in financial applications can have serious implications, and
    the rounding method used should be specified precisely. In these cases,
    it probably pays not to trust whichever system rounding is being used by
    Perl, but to instead implement the rounding function you need yourself.

    To see why, notice how you'll still have an issue on half-way-point
    alternation:

        for ($i = 0; $i < 1.01; $i += 0.05) { printf "%.1f ",$i}

        0.0 0.1 0.1 0.2 0.2 0.2 0.3 0.3 0.4 0.4 0.5 0.5 0.6 0.7 0.7 
        0.8 0.8 0.9 0.9 1.0 1.0

    Don't blame Perl. It's the same as in C. IEEE says we have to do this.
    Perl numbers whose absolute values are integers under 2**31 (on 32 bit
    machines) will work pretty much like mathematical integers. Other
    numbers are not guaranteed.

- 

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.

Answers to questions about LOTS of stuff, mostly not related to
Perl, can be found by pointing your news client to

    news:news.answers

or to the many thousands of other useful Usenet news groups.

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-1999 Tom Christiansen and Nathan
    Torkington.  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.

                                                           04.03
-- 
    This space intentionally left blank


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

Date: Mon, 23 Jul 2001 09:50:59 +1000
From: Craig Robinson <craig.robinson@env.qld.gov.au>
Subject: GMT to seconds past 1-1-1970
Message-Id: <3B5B66E3.1F42F73A@env.qld.gov.au>

Folks,
The 'gmtime' function converts the value returned by time() [ie. seconds
past 1-1-1970].
Does anyone know of a function that converts 'gmtime' into the 'seconds
past 1-1-1970'???
Cheers, Craig
--
Craig Robinson
Environmental Protection Agency
Tel: (07) 3247 3272   Fax: (07) 3247 6534
Email: craig.robinson@env.qld.gov.au

Visit us at: http://www.env.qld.gov.au


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

Date: Mon, 23 Jul 2001 01:15:12 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: GMT to seconds past 1-1-1970
Message-Id: <3B5B7AF5.5080F855@acm.org>

Craig Robinson wrote:
> 
> The 'gmtime' function converts the value returned by time() [ie. seconds
> past 1-1-1970].
> Does anyone know of a function that converts 'gmtime' into the 'seconds
> past 1-1-1970'???

use Time::Local;

my @time_array = gmtime;

my $seconds = timegm( @time_array );



John
-- 
use Perl;
program
fulfillment


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

Date: Mon, 23 Jul 2001 03:32:00 +0200
From: "Stefan Weiss" <weiss@kung.foo.at>
Subject: Re: Hashes tutorila
Message-Id: <3b5b7de7@e-post.inode.at>

Jaouad El Bahraoui" <jaouad16@home.com> wrote:

> I am looking for a beginner hashes tutorial,

If you're looking for the Perl reference about hashes, enter "perldoc
perlvar" at the command line.

If you're looking for a tutorial, just ask Jeeves - go to www.ask.com
and enter this line:
Where can I find a beginner's tutorial about Perl hashes?

(Google would do the job just fine, but from time to time I like to
ask a question in plain English and see what happens. Jeeves is quite
okay - for a butler.)


> what I want to do is
> calculating the average of the "values" in the hashe and store them in
> another hashe, there is any simple way to do it?


Try this (I'm trying to keep it easy):

# declare a hash
%hash = (
    lots => 200,
    many => 46,
    some => 8,
    few  => 2,
);

# 'values' in scalar context gives you the total number of values
$n = values %hash;

$sum = 0;

# add all the values
foreach $value (values %hash) {
    $sum += $value;
}

# calculate average
$avg = $sum / $n;

# now do whatever you like with $avg
print $avg, "\n";

__END__
# and if you want it a little more compact:
$sum += $_ for (values %hash);
$avg = $sum / keys %hash;


HTH,
stefan





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

Date: Sun, 22 Jul 2001 15:06:52 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: How to supply modules with your software.
Message-Id: <3B5B4E7C.5882D86B@stomp.stomp.tokyo>

Eric Bohlman wrote:
 
> David Coppit demanded and drooled:

> > If you can accurately anticipate all the exceptional conditions, *and*
> > you could implement them all correctly on the first try, great. You're
> > Godzilla stomping on the problems of software development. But for us
> > mortals, we have to rely on the capabilities of those that have
> > implemented, tested, debugged, documented, and evolved solutions. Please
> > don't ask us to be that good on the first try.
 
> Yep, the difference between engineering and dabbling is that in
> engineering, you design your system to be able to work under worst-case
> conditions, whereas when you're dabbling you only care that it works under
> ideal conditions.  The mark of a poor developer is that he/she believes
> that Murphy's Law has been repealed.


The mark of a poor thinking person is just that; his thinking.


The Titanic, the Heindenberg, the Bradley Fighting Machine, the Edsel
and other similar projects of time, were designed by engineers, yes?

One of these fabulous works of engineering was used for studies
of mass / volume and their relationship to inescapable gravitational
attraction and acceleration, by dropping various objects from this
wonderous work of engineering, the Leaning Tower Of Pisa. This person
interested in learning about gravity is one of our more famous
dabblers of history, Galileo Galilei.

Other famous non-engineer dabblers of history include, Socrates, Aristotle,
Johannes Kepler, Sir Issac Newton and, more recently, Albert Einstein
and Stephen Hawking.

Engineers are not noted for original thought; they are noted
for designing practical applications of others original thoughts.
These practical applications often prove to be not very practical
due to a lack of original thought and imagination on the part
of narrow thinking engineers.

 

> It's been quite reliably established that if you divide the number of
> lines of code a programmer produces, regardless of the language used, by
> the total number of days he/she spends on a particular project, you come
> up with about 10 lines of code per day.  


Would you mind posting an easily attained reference source for
this statistical study you quote but not cite? If not, a reader
should dismiss your claims as unsubstantiated fabrication.


Godzilla!


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

Date: Sun, 22 Jul 2001 19:58:18 -0400
From: David Coppit <newspost@coppit.org>
Subject: Re: How to supply modules with your software.
Message-Id: <3B5B689A.9080901@coppit.org>

Godzilla! wrote:
> David Coppit wrote:
>  
>>Godzilla! wrote:
> 
> 
>>>I never write distribution scripts which require
>>>a module for operation. This is a simple solution
>>>requiring nothing more than decent programming
>>>skills and sufficient personal pride in your work
>>>to motivate you to write real programs rather
>>>than copy and paste baling wire scripts which
>>>rely upon the programming skills of others.
> 
>>Please do not advocate this position.
> 
> Like all others, I am free to express opinions, even
> advocative opinions, as I please despite your inane
> self-proclaimed deity dictates.
> 
> Rest assured I will continue to freely express my
> opinions and will continue to ignore your repeated
> attempts at censorious censure.

Relax... I support your right to say whatever you want. I was just 
trying to persuade you not to advocate that position. ;)

David

P.S. In what way was my post inane? Could you please quote particular 
parts of my post, and explain how what I said was inane? It sure seemed 
logical to me (and most of western civilization). Trimming out my 
content and substituting a disparaging remark is not the hallmark of 
reasoned debate.



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

Date: Sun, 22 Jul 2001 21:45:50 -0400
From: "John A. Grant" <jazrant@zsc.nrcan.zc.ca>
Subject: I found sprintf - is there a sscanf?
Message-Id: <9jfvpp$kul13@nrn2.NRCan.gc.ca>

I found sprintf(). Now I'm looking for an equivalent of sscanf().
Is there one?

For example, I need the equivalent of this:
    char buffer[200];
    int width, height;
    char filename[100];
    sscanf(buffer,"%s %d %d",filename,&width,&height);

What is the common way to do this in Perl? Is it just a matter
of locating whitespace and extracting substrings?

Thanks.

--
John A. Grant  * I speak only for myself *  (remove 'z' to reply)
Radiation Geophysics, Geological Survey of Canada, Ottawa
If you followup, please do NOT e-mail me a copy: I will read it here





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

Date: Mon, 23 Jul 2001 02:56:16 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: I found sprintf - is there a sscanf?
Message-Id: <3B5B92A5.EFE26489@acm.org>

"John A. Grant" wrote:
> 
> I found sprintf(). Now I'm looking for an equivalent of sscanf().
> Is there one?
> 
> For example, I need the equivalent of this:
>     char buffer[200];
>     int width, height;
>     char filename[100];
>     sscanf(buffer,"%s %d %d",filename,&width,&height);
> 
> What is the common way to do this in Perl? Is it just a matter
> of locating whitespace and extracting substrings?

my ( $filename, $width, $height ) = split " ", $buffer;
# OR
my ( $filename, $width, $height ) = $buffer =~ /^(\S+) (\d+) (\d+)/;



John
-- 
use Perl;
program
fulfillment


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

Date: Sun, 22 Jul 2001 23:03:08 -0400
From: "John A. Grant" <jazrant@zsc.nrcan.zc.ca>
Subject: Re: I found sprintf - is there a sscanf?
Message-Id: <9jg4an$c3p19@nrn2.NRCan.gc.ca>

"John W. Krahn" <krahnj@acm.org> wrote in message
news:3B5B92A5.EFE26489@acm.org...
> "John A. Grant" wrote:
> >
> > I found sprintf(). Now I'm looking for an equivalent of sscanf().
> > Is there one?
> >
> > For example, I need the equivalent of this:
> >     char buffer[200];
> >     int width, height;
> >     char filename[100];
> >     sscanf(buffer,"%s %d %d",filename,&width,&height);
> >
> > What is the common way to do this in Perl? Is it just a matter
> > of locating whitespace and extracting substrings?
>
> my ( $filename, $width, $height ) = split " ", $buffer;
> # OR
> my ( $filename, $width, $height ) = $buffer =~ /^(\S+) (\d+) (\d+)/;

    Excellent thanks - split is very nice.

--
John A. Grant  * I speak only for myself *  (remove 'z' to reply)
Radiation Geophysics, Geological Survey of Canada, Ottawa
If you followup, please do NOT e-mail me a copy: I will read it here






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

Date: 22 Jul 2001 23:49:38 GMT
From: "Rob - Rock13.com" <rob_13@excite.com>
Subject: Re: Including a perl file into another perl file???
Message-Id: <Xns90E6C9663CFE4rock13com@207.91.5.10>

Bob Rock wrote:

> is there a function that lets you include a perl file inside
> another like the #include statement available in asp?
> Thank you.

Perhaps require or use. Depends what you're doing with it.

-- 
Rob - http://rock13.com/
Web Stuff: http://rock13.com/webhelp/


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

Date: 22 Jul 2001 18:53:11 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Including a perl file into another perl file???
Message-Id: <87itgkttaw.fsf@limey.hpcc.uh.edu>

>> On Sun, 22 Jul 2001 22:02:48 +0200,
>> "Bob Rock" <nospam.yet_another_apprentice@hotmail.com> said:

> Hello, is there a function that lets you include a perl
> file inside another like the #include statement
> available in asp?

"use", "require" or "do".  "perldoc -f" on each.

However, an appropriate idiom in one language may not be
appropriate in another.  If you explain what the
underlying problem is that you're trying to solve, maybe
someone can suggest the best (or seeing this is perl, "a
best") solution...

hth
t
-- 
Beep beep!  Out of my way, I'm a motorist!


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

Date: Sun, 22 Jul 2001 22:20:08 GMT
From: "Racso" <racso83@bellatlantic.net>
Subject: Re: Including one perl file into another???
Message-Id: <skI67.29013$l%.9173086@typhoon2.gnilink.net>

Bob Rock wrote:
>
> Hello,
> is there a function that lets you include a perl file inside another like
> the #include statement available in asp?
> Thank you.

  Hi,

  Since most here are likely too "l337" to answer such a question, I'll
help ya novice to novice.

  You are looking for "require" and "use".

http://theoryx5.uwinnipeg.ca/CPAN/perl/pod/perlfunc/require.html
http://theoryx5.uwinnipeg.ca/CPAN/perl/pod/perlfunc/use.html

--Racso





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

Date: Mon, 23 Jul 2001 09:03:03 +0800
From: MMX166+2.1G HD <no@mail.addr>
Subject: Re: manpage styles/templates???
Message-Id: <78gkltc8t0rr1vvl3go0lgj69bj38iksut@4ax.com>

could u tell me how to use the pod2html tool? 
I've installed the News::NNTPClient module. and I can type 
"perldoc News::NNTPClient" 
to read the manpage, but it's incorrect when I try 
"pod2html News::NNTPClient"
It said:
>Can't open News::NNTPClient: No such file or directory at C:/Perl/lib/Pod/Html.p
>m line 362.
what should I do?
--
On Fri, 20 Jul 2001 23:40:04 +0200, in comp.lang.perl.misc "Steffen
Müller" <tsee@gmx.net> wrote:

>Try the pod format. Info should be in the existing man pages. The format is
>*very* straight forward and can be converted to HTML via pod2html (Guess
>what pod2man does).



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

Date: Sun, 22 Jul 2001 18:22:27 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: manpage styles/templates???
Message-Id: <3B5B7C53.56A4493C@vpservices.com>

"MMX166+2.1G HD" wrote:

[posting rearranged, please reply *after* the thing you are replying to]

> On Fri, 20 Jul 2001 23:40:04 +0200, in comp.lang.perl.misc "Steffen
> Müller" <tsee@gmx.net> wrote:
> 
> >Try the pod format. Info should be in the existing man pages. The format is
> >*very* straight forward and can be converted to HTML via pod2html (Guess
> >what pod2man does).
> 
> could u tell me how to use the pod2html tool?

This is a somewhat recursive answer, but pod2html has its own pod so
this will tell you how to use it:

   perldoc pod2html

You'll notice that the syntax uses --infile and --outfile.

-- 
Jeff



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

Date: Sun, 22 Jul 2001 23:26:32 +0100
From: "Neil Morris" <Neilmorris@btinternet.com>
Subject: perl wrapper for java
Message-Id: <9jfk0f$m71$1@uranium.btinternet.com>

Hi
I have written in the most part a perl wrapper to execute java and to pass
environment variables plus data sent by the post/get method. My question is
I understand that the following code opens a program and "prints" data to
it.

$DATA=getCgiData();
open(JAVA,"| /usr/local/bin/java javaprogram\n");
print JAVA "$DATA";

Does the print statement above prints to the standard input for java as I
have a java code starting as follows.

class ProcessData {

public static void main(String args[]) { \* getting data from perls print
statement hopefully!
 ....
 ...
}
}

thanks in advance

Neil Morris




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

Date: Sun, 22 Jul 2001 18:16:46 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Premature End of Script Headers
Message-Id: <3B5B50CE.BEE301BE@earthlink.net>

Joe Lindquist wrote:
> 
> I've massaged the code a little bit, and now its working.  The only
> thing I changed was that I moved the http header to its own print
> statement.  all of its brethren scripts work fine with it inside the
> print statement.  Any ideas of why this would cause the problem?

Possibly the line after the http header did not actually contain a
newline, but contained one or more spaces or tabs.

Another possibility is that perl was getting confused about what newline
character was needed, and conversion between LF/CRLF was getting
botched.

-- 
I need more taglines. This one is getting old.


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

Date: Sun, 22 Jul 2001 18:38:45 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Premature End of Script Headers
Message-Id: <3B5B55F5.B98E7E77@earthlink.net>

Might I make a suggestion?  Restructure your code so all of the HTML
is seperate from the code, rather than interleaved.

sub generate_HTML {
	my $oldselect = select(STDOUT);
	my $oldbuffering = $|;
	$| = 1;
	my $data = do { local $/; <DATA> };
	my ($top, $bottom) = split /^%%\n/m, $data;
	print "Content-type: text/html\n\n";
	print eval "qq{$head}";
	while( my @row = $sth->fetchrow_array ) {
		my $row = "@row";
		print qq{<option value="$row">$row</option>\n};
	}
	print $bottom;
	$| = $oldbuffering;
	select $oldselect;
}

__DATA__

<html>
<head>
<title>ARIS Support Knowledge Base Logical Search Engine</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Joe Lindquist">
</head>
<body bgcolor="#FFFFFF">
<form name="description" action="solution.pl" method="post">
<table width="600" border="0" cellspacing="0" cellpadding="0" align="center"
height="400">
 <tr>
 <td height="50" colspan="2" align="center" bgcolor="#CCCCCC">
      <img src="../kblogo.gif" width="400" height="50"></td>
 </tr>
 <tr bgcolor="#CCCCCC">
 <td valign="top" colspan="2" height="20">&nbsp;</td>
 </tr>
 <tr bgcolor="#CCCCCC">
  <td valign="top" width="200" height="330"><b>&nbsp;Area<br>&nbsp;Type
        <br>&nbsp;Detail<br>&nbsp;Choose a Description
  </b></td>
  <td valign="top" width="400" height="330">
  <b>$area</b><br>
  <b>$type</b><br>
  <b>$detail</b><br>
  <input type="hidden" name="area" value="$area">
  <input type="hidden" name="type" value="$type">
  <input type="hidden" name="detail" value="$detail">
  <select name="description">
%%
  </select>
   <input type="submit" name="Submit" value="Submit">
 </td>
 </tr>
</table>
</form>
</body>
</html>
__END__

The eval EXPR is evil, but since we know that DATA doesn't contain
anything dangerous (it doesn't come from outside of the file), it's
safe to do.  Even better would be to use a REAL html templating system,
rather than roll-your-own.  If multiple files are required by whatever
system you choose, then you can still put everything in the data section
with Inline::Files.

-- 
I need more taglines. This one is getting old.


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

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


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