[13524] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 934 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 28 19:33:01 1999

Date: Tue, 28 Sep 1999 16:05:13 -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: <938559912-v9-i934@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 28 Sep 1999     Volume: 9 Number: 934

Today's topics:
        2 Perl Questions <alligator333@my-deja.com>
    Re: a question of buttons <davids@desertigloo.com>
    Re: Absolute or Relative paths? <aqumsieh@matrox.com>
        Basic Question iltiaz@hotmail.com
        Can I post messages to Windows in Perl like "SendMessag tiiger@my-deja.com
    Re: CGI.pm POST_MAX uploading <admin@gatewaysolutions.net>
        Communication between a C++ appln and perl appln on Win tiiger@my-deja.com
    Re: DB_File <joe.buhr@motorola.com>
    Re: DB_File <dheera@usa.net>
    Re: Dealing with "MS-ASCII" - again! (yes, I know it is <flavell@mail.cern.ch>
    Re: Dealing with "MS-ASCII" - again! (yes, I know it is (Kenny McCormack)
    Re: Error <Chicheng_Zhang-P29601@email.mot.com>
        Exclusive open()? paulco44213@my-deja.com
    Re: File Upload <sariq@texas.net>
    Re: gcos/gecos <uri@sysarch.com>
        How to convert perl file into binaries? <Chicheng_Zhang-P29601@email.mot.com>
    Re: How to create files from CGI script? <davids@desertigloo.com>
    Re: How to save a file as binary? (Larry Rosler)
    Re: How to save a file as binary? (Abigail)
    Re: I finally created a counter with 1 small problem <moran_z*no spam*@sasa.org.il>
    Re: I finally created a counter with 1 small problem (Larry Rosler)
        Is there a Perl WikiWeb {-Skript} ? EOM (Dr. Fridemar Pache)
    Re: JAPH (was Re: remove the html tag in the file) (Randal L. Schwartz)
    Re: kill extra white space in a variable <msalter@primenet.com>
    Re: kill extra white space in a variable (Larry Rosler)
    Re: Line-wrap <AgitatorsBand@yahoo.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 28 Sep 1999 21:58:08 GMT
From: Alligator <alligator333@my-deja.com>
Subject: 2 Perl Questions
Message-Id: <7srdlb$s4e$1@nnrp1.deja.com>

1. I need to get the "last-modified" date of a file.  By reading the
FAQs at Perl.com, I was able to learn how to do this for a local file,
but the file I am trying to access is on another server.  How can I get
its timestamp?

2. This question is much more basic than the first.  What is the best
way to store dates (numerically) in Perl?  I'm planning to parse the
output of localtime() and store the day, month, and year in 3 different
variables.  However, before I base the structure of a program (and its
data files) on this plan, I wanted to see if there was a better way, or
if date functions in general expected some other format, such as a
single integer containing a date in yyyy/mm/dd format.

Thanks for any help.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 28 Sep 1999 16:01:56 -0700
From: "David P. Schwartz" <davids@desertigloo.com>
Subject: Re: a question of buttons
Message-Id: <37F148E4.418FEE03@desertigloo.com>

> David P. Schwartz (davids@desertigloo.com) wrote on MMCCXVIII September
> MCMXCIII in <URL:news:37EF34E2.9448A457@desertigloo.com>:
> == Abigail wrote:
> ==
> == > That's not a Perl question, is it?
> == >
> <snip>
>
> You don't know, but I do. I told you it isn't a Perl question. Why don't
> you take your more-than-80 char lines and just bugger off?
>
> Abigail
> --
>

   "That's not a Perl question, is it?" is a question, not a statement.  I answered
it.  If you don't want to deal with the answer to a question, then why ask it?

Most of the posts I've seen from you while skimming through here are basically
telling people to "go away".  The purpose of these newsgroups is to get questions
answered, get some guidance or directions for further inquiry.  Why do you bother to
post so many useless non-answers?  Everyone else responding to this question has
been very courteous and tried to be helpful.

re: "more-than-80 char lines":  You have a choice of whether to have the browser do
auto-line-wrapping for you.  Don't blame others because you're unhappy with YOUR
choices.  Personally, I choose to let the computer manage tedious stuff like
worrying about line lengths.  That's why browsers have settings on them.

You've wasted three messages now NOT ANSWERING MY QUESTION, or providing any useful
guidance or direction.

WHY ARE YOU WASTING EVERYBODY'S TIME HERE WITH YOUR INCONSIDERATE, EGOTISTICAL BS?



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

Date: Tue, 28 Sep 1999 15:13:38 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Absolute or Relative paths?
Message-Id: <x3ybtamvogt.fsf@tigre.matrox.com>


garry_stewart@veritasdgc.com writes:

> In the process of developing our Web Site, previous developers have
> created several perl scripts that have hard-coded paths inside of them.
> Some of which are used as part of reference documents and others which
> point to other perl scripts.   ie:
> "http://intranet/cgi-bin/someone/ascript.pl"

[snip]

> Is there a perl standard?  Are relative paths better?

Perl has nothing to do with your problem.
If you write your CGI in Python, would that problem disappear? Would
you go to comp.lang.python and ask there?

Please ask your question in a more appropriate forum.

--Ala



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

Date: Tue, 28 Sep 1999 21:39:18 GMT
From: iltiaz@hotmail.com
Subject: Basic Question
Message-Id: <7srci5$rbc$1@nnrp1.deja.com>

Hi
I have install IIS 4.0 and Active perl 519 on my NT Box. I have a form
on my website which takes input and email me back. Right now this is
not working properly. Do i need to install any sendmail program for
that. If yes from where? could anybody help me out? Thanks in advance.
Regards
Iltiaz


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 28 Sep 1999 22:03:29 GMT
From: tiiger@my-deja.com
Subject: Can I post messages to Windows in Perl like "SendMessage" in C++?
Message-Id: <7srdvb$s77$1@nnrp1.deja.com>

Can I post messages to Windows in Perl like "SendMessage" in C++? I
will using this Perl script on Win95/98.

Thanks...


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 28 Sep 1999 16:47:07 -0500
From: "Scott Beck" <admin@gatewaysolutions.net>
Subject: Re: CGI.pm POST_MAX uploading
Message-Id: <rv2e3p603i590@corp.supernews.com>

<terryking@my-deja.com> wrote in message news:7sqbgs$1hf$1@nnrp1.deja.com...
> Hi,
> When using CGI.pm to upload files you can use POST_MAX to specify the
> maximum size of an upload file. Trouble is when it's reached it calls
> die which causes a server error.
>
> Is there a way around this to give a friendly html error instead ?

Yes there is a way around this. Use CGI::Carp
Here is a bit of code you can use to make your own error message for this.

    use CGI::Carp qw(fatalsToBrowser set_message);
    BEGIN {
       sub handle_errors {
          my $msg = shift;
          print "<h1>Oh gosh</h1>";
          print "Got an error: $msg";
      }
      set_message(\&handle_errors);
    }

This is annotated in the CGI.pm script.
<CUT>
Since an attempt to send a POST larger than $POST_MAX bytes
will cause a fatal error, you might want to use CGI::Carp to echo the
fatal error message to the browser window as shown in the example
above.  Otherwise the remote user will see only a generic "Internal
Server" error message.  See the L<CGI::Carp> manual page for more
details.
</CUT>

>I know I can check the file size afterwards but I'd rather stop the
> upload in progress to improve security.
>

This is also documented in CGI.pm.

<CUT>
The main technical challenge of handling file uploads is that it potentially
involves sending more data to the CGI script than the script can hold in
main memory. For this reason CGI.pm creates temporary files in either the
/usr/tmp or the /tmp directory. These temporary files have names like
CGItemp125421, and should be deleted automatically.
</CUT>

Hope this helps,
Scott Beck




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

Date: Tue, 28 Sep 1999 22:21:36 GMT
From: tiiger@my-deja.com
Subject: Communication between a C++ appln and perl appln on Windows?
Message-Id: <7srf15$t1e$1@nnrp1.deja.com>

I am trying to send messages to and fro from a C++(MFC based app) to a
seperate Perl Script. I am trying to see, if I can communicate between
these two apps by posting windows messages?

Or, can I have a shared pipe, or a shared i/o stream?

Greatly appreciate your efforts!

Thanks...


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 28 Sep 1999 16:11:19 -0500
From: Joe Buhr <joe.buhr@motorola.com>
Subject: Re: DB_File
Message-Id: <37F12EF7.F3B4E9B4@motorola.com>

Anno Siegel wrote:

> Joe Buhr  <joe.buhr@motorola.com> wrote in comp.lang.perl.misc:
> >I think this should be a simple problem...  hopefully someon can point
> >out my err right away, so here goes.
> >
> >I would like to use the perl DB_File module to store some data.  I'll
> >show what I'm trying to do in to seperate scripts.  Here's the syntax:
> >
> >************************************
> >#!/usr/misc/bin/perl
>
> No -w.  No use strict.  Bat practice.
>
> >use DB_File;
> >
> >tie %h, "DB_File", "test", O_RDWR|O_CREAT, 0644;
>
> Always check tie for success.  It's like open in that respect.
>
> >            $h{1} = "Joe";
> >            $h{2} = "Ernie";
> >            $h{3} = "Charly";
> >            $h{4} = "Alex";
> >            $h{5} = "Ted";
> >            untie %h;
> >************************************
> >************************************
> >#!/usr/misc/bin/perl
> >
> >use DB_File;
> >
> >tie %h, "DB_File", "test", O_RDWR|O_CREAT, 0644;
>
> The same comments as above apply.  Moreover, why do you use O_CREAT
> with a Database that already exists?
>
> >            foreach (1,2,3,4,5) {
> >                    print "$h{$_}\n";
> >            }
> >            untie %h;
> >*************************************
> >The file "test" gets created, but no data gets stored in it?  Is that
> >right?
> >
> >Heres a listing of the files:
> >-rwxr-xr-x   1 buhr     3g           250 Sep 27 08:32 program1
> >-rwxr-xr-x   1 buhr     3g           196 Sep 27 08:32 program2
> >-rw-r--r--   1 buhr     3g          8192 Sep 27 08:28 test
> >
> >
> >If anyone can let me know what I'm doing wrong I'd appreciate it.
>
> What makes you think there's no data in test?  The code runs fine
> for me.
>
> Oh, and if all you want is numbered records (which you simulate
> with a hash here), DB_File has the DB_RECNO option that does just
> that:
>
>   tie %h, "DB_File", "test", O_RDWR|O_CREAT, 0644, $DB_RECNO or
>     die "Can't create DB_File test: $!\n";
>
> Anno
>
> Anno

There is data in the test file... just nothing readable.    The example
works fine for me also...  when I try it on my mac, just not when I use my
unix box.  I've also tried the DB_RECNO, but it didn't work either.  I'm
thinking of grabbing the module and recompiling it... can't think of what
else it might be.

Thanks,

Joe



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

Date: Tue, 28 Sep 1999 22:52:04 GMT
From: Dheera <dheera@usa.net>
Subject: Re: DB_File
Message-Id: <7srgqf$ua3$1@nnrp1.deja.com>

Are you sure you have DB_File set up properly? I tried your code and it
worked fine, and the second program printed everything correctly.

In article <37EF7664.25C8D185@motorola.com>,
  Joe Buhr <joe.buhr@motorola.com> wrote:
> I think this should be a simple problem...  hopefully someon can point
> out my err right away, so here goes.
>
> I would like to use the perl DB_File module to store some data.  I'll
> show what I'm trying to do in to seperate scripts.  Here's the syntax:
>
> ************************************
> #!/usr/misc/bin/perl
>
> use DB_File;
>
> tie %h, "DB_File", "test", O_RDWR|O_CREAT, 0644;
>             $h{1} = "Joe";
>             $h{2} = "Ernie";
>             $h{3} = "Charly";
>             $h{4} = "Alex";
>             $h{5} = "Ted";
>             untie %h;
> ************************************
> ************************************
> #!/usr/misc/bin/perl
>
> use DB_File;
>
> tie %h, "DB_File", "test", O_RDWR|O_CREAT, 0644;
>             foreach (1,2,3,4,5) {
>                     print "$h{$_}\n";
>             }
>             untie %h;
> *************************************
> The file "test" gets created, but no data gets stored in it?  Is that
> right?
>
> Heres a listing of the files:
> -rwxr-xr-x   1 buhr     3g           250 Sep 27 08:32 program1
> -rwxr-xr-x   1 buhr     3g           196 Sep 27 08:32 program2
> -rw-r--r--   1 buhr     3g          8192 Sep 27 08:28 test
>
> If anyone can let me know what I'm doing wrong I'd appreciate it.
> Thanks,
>
> Joe
>
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 28 Sep 1999 22:51:16 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Dealing with "MS-ASCII" - again! (yes, I know it is a bad term, but we're stuck with it)
Message-Id: <Pine.HPP.3.95a.990928223654.22229E-100000@hpplus01.cern.ch>

On 28 Sep 1999, Kenny McCormack wrote:

> Does that mean I could do something like: lynx -dump MS-ASCIIfile > file.txt
> and lynx would do the cleaning for me?

I didn't know the answer to that question, but I just tried configuring
lynx (Options -> display Character set -> 7bit approximation) and saving
the options so that they would take effect in subsequent sessions, and
yes, it then seems to use those approximations not only for the
"terminal" (screen) display, but also for the commandline -dump option
and for its "print" command (one of whose options is to save to a disk
file). 

> That would be good, since it should be clear that I really don't want to do
> this myself and/or re-invent any wheels.

Whether you'll be content with the approximations that Lynx uses, we'll
see ;-)  

This seems desperately off-topic for either of the groups we're on, but
as I guess there's little more needs saying on this branch of the topic,
I took a chance of answering here on the thread.

If you wanted to go into detail on Lynx I'd want to refer you to
comp.infosystems.www.browsers.misc, OK? 

It occurs to me that "Free recode" also addresses your requirement.
http://www.iro.umontreal.ca/contrib/recode/HTML/



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

Date: 28 Sep 1999 16:44:07 -0500
From: gazelle@yin.interaccess.com (Kenny McCormack)
Subject: Re: Dealing with "MS-ASCII" - again! (yes, I know it is a bad term, but we're stuck with it)
Message-Id: <7srcr7$obd$1@yin.interaccess.com>

In article <Pine.HPP.3.95a.990928223654.22229E-100000@hpplus01.cern.ch>,
Alan J. Flavell <flavell@mail.cern.ch> wrote:
 ...
>It occurs to me that "Free recode" also addresses your requirement.
>http://www.iro.umontreal.ca/contrib/recode/HTML/

I checked that out - it looks like a winner - kind of sledge hammer approach
(the manual page appears to be 81 pages long), but it could very well be the
big solution.

Thanks!


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

Date: Tue, 28 Sep 1999 14:50:51 -0700
From: Chicheng Zhang <Chicheng_Zhang-P29601@email.mot.com>
Subject: Re: Error
Message-Id: <37F1383B.CBDC0B9@email.mot.com>

If you are using cgi.pm, remember always write header(), start_html() first to
generate pages.
Missing or improperly placing the header() is a major problem causing "premature
end of script headers".
It will help a lot more if you can post the entire program here.

Ajay Khanna wrote:

> Hi..
> I have written a perl program which when tried to run on a browser gives
> an "Internal Server Error". The error written in the error_log is :
> [Mon Sep 27 16:44:09 1999] [error] (8)Exec format error: exec of
> /home/imsc2/www/cgi-bin/calendar-show.pl failed
> [Mon Sep 27 16:44:09 1999] [error] [client 128.125.163.100] Premature end
> of script headers " /home/imsc2/www/cgi-bin/calendar-show.pl
> Could someone help me with it
> -Ajay
>
> ------------------------------------------------------------------------------
> Ajay Khanna
> University of Southern California               MSCENG (Networks)
> 1184 West 30th #17, LA, CA 90007.
> (323) 735 6931
> http://www-scf.usc.edu/~aakhanna
>
> LOGO :SUCCESS IS A TRIBUTE TO THE VIRTUES OF HARD WORK, DEDICATION AND THE
>       UNCOMPROMISING PURSUIT OF EXCELLENCE.
> ------------------------------------------------------------------------------





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

Date: Tue, 28 Sep 1999 22:51:22 GMT
From: paulco44213@my-deja.com
Subject: Exclusive open()?
Message-Id: <7srgp6$u9r$1@nnrp1.deja.com>

Is it possible to exclusively open a file with perl, such that any
other open()s by other perl scripts running at the same time will fail?


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 28 Sep 1999 15:54:07 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: File Upload
Message-Id: <37F12AEF.42A6096C@texas.net>

Burt Hwang wrote:
> 
> Sorry if this is a silly question but what is "Jeopardy style"?  In case I'm
> doing it, I want to know so that I don't do it again.
> 
> Thanks.

Yep, you're doing it.

Go to Deja.com and search comp.lang.perl.misc for "Quoting Strategies
and the Jeopardy Game".  You'll get a hit like:

http://www.deja.com/getdoc.xp?AN=528985540

- Tom


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

Date: 28 Sep 1999 18:59:31 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: gcos/gecos
Message-Id: <x7vh8uy758.fsf@home.sysarch.com>

>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:

  LR> General (Electric) Comprehensive? Operating System

you win there.

  LR> Unix (described then as the UNIX(TM) Operating System) was developed 
  LR> simultaneously at Bell Labs as a manageable, scalable, portable 
  LR> alternative to the pachydermous Multics, on 16-bit DEC PDP-7 computers.  
  LR> I implemented a GCOS shell and ported many Unix commands, and gave a 
  LR> paper titled "The Best of UNIX on GCOS" at the Honeywell Large Systems 
  LR> Users' Association meeting in 1978.

but no one mentioned how the passwd field got named gecos. this is from:

http://www.netmeg.net/jargon/terms/g/gcos.html

GECOS/GCOS left one permanent mark on Unix. Some early Unix systems at
Bell Labs used GCOS machines for print spooling and various other
services; the field added to `/etc/passwd' to carry GCOS ID information
was called the `GECOS field' and survives today as the `pw_gecos' member
used for the user's full name and other human-ID information.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Tue, 28 Sep 1999 15:30:34 -0700
From: Chicheng Zhang <Chicheng_Zhang-P29601@email.mot.com>
Subject: How to convert perl file into binaries?
Message-Id: <37F1418A.F45DB1EB@email.mot.com>

When running a perl file with shebang #!, I need +rx it(chmod 555).  So
it is still reable. if I want
 it to be unreadable but still executable, all I know is +s it.  Is
there any simply way just convert
this file into binaries??

Thanks.



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

Date: Tue, 28 Sep 1999 15:41:58 -0700
From: "David P. Schwartz" <davids@desertigloo.com>
Subject: Re: How to create files from CGI script?
Message-Id: <37F14436.66508987@desertigloo.com>

> In article <37EF3779.53E87E10@desertigloo.com>,
> David P. Schwartz <davids@desertigloo.com> wrote:
> >Kragen Sitaker wrote:
> >
> >> In article <37EDAEFC.C929A798@desertigloo.com>,
> >> David P. Schwartz <davids@desertigloo.com> wrote:
> >> >This strikes me as very unusual and unexpected behavior.  Is there some
> >> >chance that
> >> >directories named "protected" are set to behave differently than normal?
> >> >Or perhaps
> >> >even subdirs beneath tmp (it's possible, but unlikely)?
> >>
> >> No.  What part of it strikes you as unusual and unexpected?  That I
> >> couldn't rm or mv the file?
> >> --
> >
> >Well, that too. You had read+write perms on the dir.  So it looks like
> >you couldn't
> >read or write from/to it.  What am I missing here?
>
> I didn't have execute permission on the dir, so I couldn't access files
> in it.  I thought I'd be able to delete files from it and rename files
> into or out of it, too, but I couldn't do that either.  That's what
> execute permission on a directory does.
>
> This is why I was suggesting that 666 perms on a directory might be a
> problem.  :)
>
> Notice that 'ls' worked fine.  (ls -l doesn't, though, because it can't
> lstat the files.)
> --

Wow, I never knew that.  Thanks!

-David



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

Date: Tue, 28 Sep 1999 14:44:02 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How to save a file as binary?
Message-Id: <MPG.125ad6805f237263989ff0@nntp.hpl.hp.com>

In article <Pine.HPP.3.95a.990928220853.22229D-100000@hpplus01.cern.ch> 
on Tue, 28 Sep 1999 22:20:48 +0200, Alan J. Flavell 
<flavell@mail.cern.ch> says...
> On Tue, 28 Sep 1999, Larry Rosler wrote:
> 
> > It would be *so* nice if the educators and writers told people always to 
> > use *binmode* before reading or writing a binary file,
> 
> The trouble is that the majority of commentators on this topic appear to
> be unix bigots, and if they mention binmode at all, it's usually only to
> carp that you wouldn't need it with a "real" operating system.
> 
> The idea of systematically putting it in, in the interests of
> portability, even when it "does nothing", somehow doesn't seem to appeal
> to them.  I've seen educational material that explicitly recommends
> leaving it out when using unix-oid OSes.

What is the antonym of 'educational'?  :-)

> Which is a pity, in the interests of portability.  IMHO.
> 
> Don't mind me: I have no objection to unix-oid OSes, quite the contrary;
> but I also have to use other operating systems too (and glorified task
> monitors lurking behind a windowing UI, if you take my drift).  Anything
> that can minimise the confusion is to be applauded. 
> 
> Now I suppose I'd better get down behind the parapet before the
> brickbats start getting hurled.  ;-)

The brickbats should be flying the other way.

I approach this issue from the exactly analogous situation in Standard 
C.  (Remember that Perl is implemented using the C library.)  To open a 
binary file, one appends 'b' to the 'r', 'w', or 'a' mode string.  No 
issue about whether this is necessary -- one simply does it, to write 
conforming programs.

Here is some *truly* educational material from the brilliant Rationale 
for the C Standard, written by P. J. Plauger.  Perhaps some of the 
purported Perl educators will hereby be educated.

<QUOTE>

The definition of lines.

In the UNIX model, division of a file into lines is effected by new-line 
characters.  Different techniques are used by other systems -- lines may 
be separated by CR-LF (carriage return, line feed) or by unrecorded 
areas on the recording medium, or each line may be prefixed by its 
length.  The Standard addresses this diversity by specifying that new-
line be used as a line separator at the program level, but then 
permitting an implementation to transform the data read or written to 
conform to the conventions of the environment.

 ...

Transparency.

Some programs require access to external data without modification.  For 
instance, transformation of CR-LF to new-line character is usually not 
desirable when object code is processed.  The Standard defines two 
stream types, *text* and *binary*, to allow a program to define, when a 
file is opened, whether the preservation of its exact contents or of its 
line structure is more important in an environment which cannot 
accurately reflect both.

 ...

Thus, the Standard imposes a clear distinction between *text streams*, 
which must be mapped to suit local custom, and *binary streams*, for 
which no mapping takes place.  Local custom on UNIX (and related) 
systems is of course to treat the two sorts of streams identically, and 
nothing in the Standard requires any changes to this practice.

</QUOTE>

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 28 Sep 1999 18:01:31 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: How to save a file as binary?
Message-Id: <slrn7v2ikp.9kl.abigail@alexandra.delanet.com>

Larry Rosler (lr@hpl.hp.com) wrote on MMCCXIX September MCMXCIII in
<URL:news:MPG.125ab0c01a36ec7d989fee@nntp.hpl.hp.com>:
~~ 
~~ It would be *so* nice if the educators and writers told people always to 
~~ use *binmode* before reading or writing a binary file, just as they tell 
~~ them to always check the result of 'open()'.


Except that you only need binmode on some OSses, while the need for
checking the result of open() is crossplatform.

I never use binmode, and I doubt I ever will.


Abigail
-- 
perl -weprint\<\<EOT\; -eJust -eanother -ePerl -eHacker -eEOT


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Tue, 28 Sep 1999 22:56:59 +0200
From: "Moran" <moran_z*no spam*@sasa.org.il>
Subject: Re: I finally created a counter with 1 small problem
Message-Id: <7sr9su$d4e$1@news.netvision.net.il>

hi,
i tryed to do what you did and look what i got:
warp:~/cgi# perl -cws counter.pl
Can't modify subroutine entry in scalar assignment at counter.pl line 5,
near "<
COUNT>;"
counter.pl had compilation errors.
warp:~/cgi# cat counter.pl
#!/usr/bin/perl
print "Content-type: text/html\n\n";
open (COUNT, "<counter.dat"); # opens the file puts into COUNT buffer the
data
$count = <COUNT>;
close COUNT;
$count++;
open (COUNT, ">counter.dat");
print COUNT $count;

close COUNT;

warp:~/cgi#

is it really working for you ?

VC wrote in message ...
>I created a counter that works with lots of help from many wonderfull
>people.
>
>Question:  This code prints the counter results to a different html page
>how can I set it to read on the same page??
>
>#!/usr/bin/perl
>print "Content-type: text/html\n\n";
>open (COUNT, "<counter.dat"); # opens the file puts into COUNT buffer the
>data
>$count = <COUNT>;
>close COUNT;
>$count++;
>open (COUNT, ">counter.dat");
>print COUNT $count;
>
>close COUNT;
>print $count;
>
>
>Best Regards
>Vin
>
>




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

Date: Tue, 28 Sep 1999 15:05:04 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: I finally created a counter with 1 small problem
Message-Id: <MPG.125adb697dbe57d4989ff3@nntp.hpl.hp.com>

In article <7sr9su$d4e$1@news.netvision.net.il> on Tue, 28 Sep 1999 
22:56:59 +0200, "Moran" <moran_z*no spam*@sasa.org.il> <"Moran" 
<moran_z*no spam*@sasa.org.il>> says...

[Reordered to put referred to material first, in accordance with normal 
uses of language in communication.]

> VC wrote in message ...

 ...

> >open (COUNT, "<counter.dat"); # opens the file puts into COUNT buffer the
> >data
> >$count = <COUNT>;

1.  It is bad practice to post code that doesn't check the results of an 
open() statement.

2.  It is bad practice to post code with long trailing comments.  
Newsreaders tend to wrap them.

 ...

> open (COUNT, "<counter.dat"); # opens the file puts into COUNT buffer the
> data
> $count = <COUNT>;

 ...

3.  It is bad practice to copy-and-paste code with long trailing 
comments from posts.

4.  It is bad practice to post code here that doesn't compile, without 
making some effort to figure out why and to fix the problem yourself.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Tue, 28 Sep 1999 21:47:16 GMT
From: dr.pc@data-music.com (Dr. Fridemar Pache)
Subject: Is there a Perl WikiWeb {-Skript} ? EOM
Message-Id: <37f136da.28461130@news.uni-erlangen.de>

EOM=End of Message



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

Date: 28 Sep 1999 15:19:04 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: JAPH (was Re: remove the html tag in the file)
Message-Id: <m1puz2d6hz.fsf@halfdome.holdit.com>

>>>>> "Ala" == Ala Qumsieh <aqumsieh@matrox.com> writes:

Ala> It seems to me that JAPHs should contain a \n at the end, since one
Ala> would normally sign:

Ala> 	Just another Perl hacker,
Ala> 	<one's name>

Ala> similar to

Ala> 	Sincerely,
Ala> 	<one's name>

Ala> but it doesn't. Any good reason for this?

I believe this is an IAQTIABITVF (infrequently asked question that I
answered before in this very forum).

Hysterical reasons, mostly.

Also, 25 chars goes better into some of the 5x5 scrambling schemes
that I did in the early years instead of 26 characters.  And I
remember deliberately making that choice to be consistent with it.

Back when I had a lot of time to play, that is.  Now, I'm just getting
the jobs done instead. :)

print "Just another Perl hacker,"

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Tue, 28 Sep 1999 14:32:52 -0700
From: Mike Salter <msalter@primenet.com>
Subject: Re: kill extra white space in a variable
Message-Id: <Pine.BSI.3.96.990928142530.20723A-100000@usr01.primenet.com>

Given a file called pics.txt that is line sequential, and one filename per
line (leading,trailing blanks, whatever), with filenames like one.gif,
two.jpg, etc, the following code does what I think you're trying to do:
 
#!/usr/bin/perl 
$FNAME = "pics.txt";
$i = 0;
open FNAME or die "oops";
while (<FNAME>) {
  if (/(\w+\.\w+)/) {
    $images[$i++] = $1;
  }
}
close FNAME;
for($i=0;$images[$i];$i++) {
  print ($images[$i] . ".data\n");
}

The print statement could be changed to something like:
$images[$i] .= ".data";

to add the extra extension.

mike


On Tue, 28 Sep 1999, mikej wrote:

> Date: Tue, 28 Sep 1999 13:26:51 -0700
> From: mikej <mikej@1185design.com>
> Newsgroups: comp.lang.perl.misc
> Subject: kill extra white space in a variable
> 
> Hi all,
> 
> I have a piece of code which gives me an element of an array, like this:
> 
> $myimage[$arrayposition]
> 
> I get the array from a flat text file, and so far there is only one item
> that should be in the array, an image name called "one.gif".
> 
> The weird thing is that when the script returns the value for
> $myimage[$arrayposition], which in this case would be
> $myimage[0], there is a space that gets put on the end of the variable,
> so when I try to add an extension onto the name such as ".data", it
> gives me the value:
> 
> one.gif .data
> 
> instead of what I need, which is:
> 
> one.gif.data
> 
> I dont know why its giving me the space. The flat file doesnt seem to
> have any white space after the name. Any ideas on what is causing this
> phantom space? Thanks.
> 
> mike
> 
> 
> 




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

Date: Tue, 28 Sep 1999 14:49:03 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: kill extra white space in a variable
Message-Id: <MPG.125ad7a7d1090d7e989ff1@nntp.hpl.hp.com>

In article <37F12700.63CE9119@cisco.com> on Tue, 28 Sep 1999 13:37:20 -
0700, Makarand Kulkarni <makkulka@cisco.com> says...
> [ mikej wrote:
> 
> > I get the array from a flat text file, and so far there is only one item
> > that should be in the array, an image name called "one.gif".
> 
> If you post the code for getting the array from the flat file maybe someone
> will figure out how that extra space is getting into the variable.

My crystal ball says that the extra terminating whitespace character is 
the newline character that he read from the text file.

perldoc -f chomp

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Tue, 28 Sep 1999 22:00:07 GMT
From: Scratchie <AgitatorsBand@yahoo.com>
Subject: Re: Line-wrap
Message-Id: <HTaI3.81$bc.22169@news.shore.net>

Tom Phoenix <rootbeer@redcat.com> wrote:
: On Tue, 28 Sep 1999, A Zielke wrote:

:> Subject: Line-wrap

: If there's a module which does what you want, it should be listed in
: the module list on CPAN. If you don't find one to your liking, you're
: welcome and encouraged to submit one! :-)  Hope this helps!

Actually, isn't Text::Wrap a standard module? Try "perldoc Text::Wrap" at
your command line and take it from there. 

--Art

-- 
--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
                  http://www.agitators.com/calendar/
--------------------------------------------------------------------------


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 934
*************************************


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