[22037] in Perl-Users-Digest
Perl-Users Digest, Issue: 4259 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 13 14:06:07 2002
Date: Fri, 13 Dec 2002 11:05:11 -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 Fri, 13 Dec 2002 Volume: 10 Number: 4259
Today's topics:
=?ISO-8859-1?Q?.NET,_a_necessary_conflict=3F_=A9_(Pleas (James Foster)
Re: A formating problem (Tad McClellan)
ANNOUNCE: HTML::Mason 1.16 (Dave Rolsky)
Re: can I ship perl interpreter & do I need to send imp (Tad McClellan)
Re: Checking for human user with images (Robert Nicholson)
Re: copy, rename, open - more confusion? (Tad McClellan)
Displaying query output to form, newbie needs help. (unixfox)
Re: Displaying query output to form, newbie needs help. <no@email.com>
Re: Eject CD with Perl <zentara@highstream.net>
Re: Get current date / time? (Helgi Briem)
Re: matching words starting and ending with defined let <jurgenex@hotmail.com>
Net::Telnet and \r <Olivier.Gontier@ifremer.fr>
Re: Net::Telnet and \r <nobull@mail.com>
perlre question <a@b.c>
Re: perlre question <no@email.com>
Re: perlre question (Tad McClellan)
Simple Regex (Jason Quek)
Re: Simple Regex <nobull@mail.com>
Re: unix2dos newbie question <vervoom@hotmail.com>
Use Strict warning .. why? <noone@nowhere.com>
Re: whatever happened to Tom Christiansen? <comdog@panix.com>
Re: when uploading a file to CGI.pm, how to tell if fil (Ryan)
Re: when uploading a file to CGI.pm, how to tell if fil <flavell@mail.cern.ch>
Where can I find book about perl4 (Phov)
Re: Where can I find book about perl4 <uri@stemsystems.com>
Re: Where can I find book about perl4 <twhu@lucent.com>
Re: Where can I find book about perl4 (Tad McClellan)
Re: Where can I find book about perl4 <jurgenex@hotmail.com>
Re: Win32::OLE writing to excel. <spikey-wan@bigfoot.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 13 Dec 2002 10:49:11 -0800
From: idmercury@yahoo.co.uk (James Foster)
Subject: =?ISO-8859-1?Q?.NET,_a_necessary_conflict=3F_=A9_(Please_read_this!)?=
Message-Id: <b4d37d82.0212131049.7583517e@posting.google.com>
To those who are interested in the future and want their say, please
read this and reply. Thank you!
Recently I have noticed a large divide appearing in the
programming community, one that is uniting some while driving the
others away. The source of this seeming conflict can be found within a
certain Redmond company. Its name, .NET. The new set of development
tools and standards for programming specifically aimed at web
developers and e-commerce has been in the air for a while now, hanging
there, however, it is only now that coders have sat up and begun to
listen. .NET is a direct assault on the Internets commercial,
financial and enterprise markets, challenging established platforms
like Sun's Java. The standards are not just for developing web
content, each of the major languages have a new versions of
Microsoft's development software, Visual Studio, .NET or course. This
is the latest ploy to dominate the commercial programming market from
Microsoft. There are those who have adopted the new standards quickly,
keen to be seen as supporters of Microsoft and those who feel they
have no choice. The message from Microsoft, ‘Join or burn!' Those that
are left are waiting, unsure, are sceptical or will never adopt. I
have recently acquired the .NET development software and have used it
to code C++ (if your interested in the language, don't be) The editor
is adequate but nothing special, the compiler is fast but not the
fastest I've seen and the Debug was quite frankly crap. Give me
Borland any day. And, how much, bloody hell! Depending on your needs
and use of the software, professional, enterprise and so on it ranges
from £850 to almost £2000 (new copy, upgrade prices are a little
lower). I am young and foolish but many programmers just won't spend
that kind of money unless they are among the ‘elite' or work for a
large company. Why shell out when you can get something better for
half the price or even free? BBEdit is a wonderful editor, Borland
and others make equal and better compilers and although this may seem
ignorant but if your code is tight and well written, a serious
debugger shouldn't be necessary. Compilers will tell you of any errors
and there is no substitute for good, thorough testing. I let the
debugger loose on a simple program that calculated results from inputs
and printed text strings for the required outputs, 500 lines of code,
simple, neat and consistent. I asked my friends to review and test the
code and we all agreed that it could not be written more practically
and systematically. In other words it was optimised and as perfect as
it could get. I compiled it, ran it and it was perfect, no bugs.
Huzzah! I then put it through the debugger. The result: same
functions, almost unreadable code and multiple compile errors. This
one actually took up more code and was not as good as the first.
Although this probably wont happen with all of the crap you put
through it, it shouldn't have done it at all. It could spell disaster
for large projects and important apps. My advice is don't cut corners
with code. Be thorough and consistent. There is no doubt that soon it
will become the supposed ‘only way', the .NET way. Me, I will be
staying with BB and Borland, however I will keep a close eye on the
rest of the world. I foresee that soon companies will only consider
.NET coders and the rest of us will have to abide or fade away. But
not yet. As well as this, the new language C# is beginning to receive
more supporters. It is undoubtedly a good language, solid stable and
quite powerful. However it is immature and has not gained global
recognition. Its development will be interesting and may become a
necessary requirement for future programmers. At the moment though I
will be fine set in my ways. I would like to have your feedback on
this article and see what you think about .NET. I will now go back to
my desk and begin working again. I almost inhaled the end of my Palm's
stylus while chewing on it and I have a project to finish. What can we
do but watch and wait, I don't know. I will ponder it.
James Foster.
ID/mercury.
------------------------------
Date: Fri, 13 Dec 2002 06:52:45 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: A formating problem
Message-Id: <slrnavjm0t.2f2.tadmc@magna.augustmail.com>
Jan Fure <jan_may2002_fure@attbi.com> wrote:
> Is it correct to state that when processing data,
>
> while ( <FILEHANDLE> ) {
> EXPR;
> }
>
> and
>
> foreach ( @ARRAY ) {
> EXPR;
> }
>
> will be transparent to the code reprecented by EXPR if the file and
> the array contains the same information?
Nearly transparent.
If EXPR modifies $_, then @ARRAY gets modified but the contents
of the file does not get modified.
And they're not equivalent for code outside the blocks, since foreach
local()izes $_ and the while does not.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 13 Dec 2002 10:52:16 -0800
From: autarch@urth.org (Dave Rolsky)
Subject: ANNOUNCE: HTML::Mason 1.16
Message-Id: <3dfa2a0c$1_5@news.teranews.com>
This is the latest action-packed release of HTML::Mason, with more bloody
fights, steamy sex, and outrageous laughs than ever before.
Thrill ... as an autohandler calls the next component in the chain.
Tremble ... at the awesome might of the wicked dhandler.
Cry ... for the humble subcomponent.
This release fixes a bunch of bugs, including one potentially serious
memory leak (if you created many Interp objects). It also includes a much
rewritten version of the Admin Guide. Comments and suggestions on this
are welcome for future releases.
Have fun.
Changes
1.16 December 13, 2002
[ ENHANCEMENTS ]
- Documented behavior of $m->flush_buffer when a filter is present.
- Turned off "nowrap" for error message on HTML error page. No more
horizontal scrolling!
- Substantially rewrote portions of the Admin Guide, in order to
improve and clarify the portions related to configuring and
customizing Mason under mod_perl.
- Added back "raw error" on HTML error page.
- Replaced FilesMatch with LocationMatch in docs and FAQ, because
using FilesMatch means you can't use dhandlers.
- Reduced memory usage when compiling large components. Memory usage
for smaller components hasn't changed much, but they weren't really a
problem in the first place.
- Added a cgi_request method to the CGIHandler::Request object, which
parallels the apache_req method offered by the ApacheHandler::Request
object.
[ BUG FIXES ]
- When using the code cache within an Interp, a circular reference was
created which prevented the Interp object from ever being destroyed.
With Perl 5.6.0+, this will be automatically prevented by using weak
references as needed. With Perl 5.00503, you will need to call the
new Interp->flush_code_cache method in order to break the circular
reference. This bug could cause memory leaks with code that created
new Interp objects over time, though most uses of Mason do not do
this. Reported by Kate Porter.
- Fixed bad parsing of <% $foo || 50 %>. Mason was interpreting this
as an escape flag. Escape flags now much match /^[[:alpha:]_]\w+/ and
Mason specifically looks for || in a substitution as well. Reported
by Kwindla Kramer.
- If a dhandler one subdirectory down (like /foo/dhandler) called
$m->decline, Mason threw a bogus exception. Fixed by Harmen.
- Running the test suite caused an error in the shell on Win32 with
newer versions of MakeMaker. Reported by Murat Unalan. (We _think_
this is fixed but we'd like confirmation from a Win32 user).
- It was not possible to set the data_cache_defaults parameter from
the httpd.conf file. Now it is.
- Mason was using Apache::Request->new instead of
Apache::Request->instance. This meant that if you had a handler that
ran earlier (like a TransHandler) and that handler created an
Apache::Request object, then the one Mason created would be missing
any POST arguments. Reported by Ray Zimmerman.
- Several different places in the docs said that Cache::Cache accepts
a username option, but there is no such thing.
- alter_superclass didn't work with CGIHandler because CGIHandler
didn't define a $VERSION variable. Reported by Nadine and Harry
Laxen.
- Made CGIHandler merge together POST and query string arguments in
order to be consistent with ApacheHandler. Reported by Nadine and Harry
Laxen.
- The CGIHandler module was overriding any out_method provided by the
user. Reported by Nadine and Harry Laxen.
------------------------------
Date: Fri, 13 Dec 2002 07:56:51 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: can I ship perl interpreter & do I need to send imported modules
Message-Id: <slrnavjpp3.2f2.tadmc@magna.augustmail.com>
qanda <fumail@freeuk.com> wrote:
> Assuming I wanted to deliver perl script(s) to a customer:-
> 1) what should I do legally - from the perspective of perl not my
> company
You do what Perl's license says to do. :-)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 13 Dec 2002 07:19:33 -0800
From: robert@elastica.com (Robert Nicholson)
Subject: Re: Checking for human user with images
Message-Id: <24a182bd.0212130719.27f9d53c@posting.google.com>
I'm noticing a disturbing trend on the web doing this and just
recently my cell phone provide DTAC in Thailand has introduced a user
based imaging scheme that totally breaks my LWP code that I was using
to automate the sending of SMS messages to myself.
Q. What OCR software can currently OCR untransformed images in the
form of gifs.
------------------------------
Date: Fri, 13 Dec 2002 08:50:35 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: copy, rename, open - more confusion?
Message-Id: <slrnavjstq.2f2.tadmc@magna.augustmail.com>
qanda <fumail@freeuk.com> wrote:
> I'm all confused again - the more of my Camel book, perldoc man pages,
> this newsgroup and faqs I read the more confused I seem to get!
That never happens to anyone else. (not! :-)
> Background ...
> I need to process x number of files, each with 1 record per line.
> Each record has a record identifier within a field (say the 15th
^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^ implies unique amongst the records
> field). As I read each file I write out different record types to new
> files, eg if the current file has 5 records with ID's a, b, c, d and
> e, I want to write out all the records with ID a to a_type.txt, b to
^^^
^^^ implies more than one record with same ID
> b_type.txt. However I'm not interested in types c or e, so I write
> out types d to d_type.txt; types c and e need to go back into the
> original file.
So it isn't really a "record identifier" at all, it is a
"type identifier" or some such.
> I'm happy with record processing, my question concerns copy/rename
> etc. I imagine the best way is to use the current file for record
> splitting putting ignored types into ignore.txt for eg, then when when
> the current file is finished, close it then rename ignore to original.
^^^^^^ ^^^^^^^^^^^
> So we end up with types c and e only in the original file.
Perl can handle in-place editing for you, as described in the
answer to this FAQ:
How do I change one line in a file/delete a line in a
file/insert a line in the middle of a file/append to the
beginning of a file?
> The perl must be efficeint, portable and robust (ie commercially safe
> to use).
Oh. I think there's a problem with in-place editing on Windows
when you don't specify a backup for -i (or $^I), but I'm not
clear on the details as I don't use Windows.
> I've seen examples using open to create a tempfile, the rename
> function, sysopen and the File::Copy but am confused taking the above
> into account what to use.
>
> Any ideas, suggestions?
untested:
# open A, B and D filehandles before here
{ local $^I = '.old';
local @ARGV = 'file.original';
while ( <> ) {
my $type = determine_type($_);
if ( $type eq 'a' )
{ print A }
elsif ( $type eq 'b' )
{ print B }
elsif ( $type eq 'd' )
{ print D }
else
{ print }
}
unlink 'file.original.old'; # don't really want a backup file
}
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 13 Dec 2002 06:23:29 -0800
From: unixfox@planetlink.net (unixfox)
Subject: Displaying query output to form, newbie needs help.
Message-Id: <f914825a.0212130623.3b0ded37@posting.google.com>
Hello all,
I have designed an input form that posts the data to a flat text file.
My question is this..When I do a query on that data is it possible to
have it
displayed in the same form layout for editing? Or is there some way to
design
another form that looks like the original but allows for editing?
I'm kinda new at this CGI stuff so go gently please...
Thanks in advance
------------------------------
Date: Fri, 13 Dec 2002 16:04:29 -0000
From: "Brian Wakem" <no@email.com>
Subject: Re: Displaying query output to form, newbie needs help.
Message-Id: <atd0ee$12rm30$1@ID-112158.news.dfncis.de>
"unixfox" <unixfox@planetlink.net> wrote in message
news:f914825a.0212130623.3b0ded37@posting.google.com...
> Hello all,
>
> I have designed an input form that posts the data to a flat text file.
> My question is this..When I do a query on that data is it possible to
> have it
> displayed in the same form layout for editing? Or is there some way to
> design
> another form that looks like the original but allows for editing?
Get the data from the text file and put it in the relevant value=""
attributes of the <input> tags. Then you'll need to resubmit it and write
over the original. One way of doing this is to put a reference number (if
there is one) in a hidden input tag, and match it against the reference in
the text file and write over it. (In reality you'll delete the whole file
and re-write it with the new data).
--
Brian Wakem
------------------------------
Date: Fri, 13 Dec 2002 12:51:18 -0500
From: zentara <zentara@highstream.net>
Subject: Re: Eject CD with Perl
Message-Id: <kb7kvuk577jkarjs247nheilsma1hf23vb@4ax.com>
On 12 Dec 2002 20:28:44 -0800, miketaylorsf@yahoo.com (Mike) wrote:
>I need to create a perl script to eject a CD.
>
>Can anybody help with providing the code to do that?
Here is a way with Inline::C
http://perlmonks.org/index.pl?node_id=194848
Here is the same code, using swig to compile a .so module
http://perlmonks.org/index.pl?node_id=201350
------------------------------
Date: Fri, 13 Dec 2002 14:39:25 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: Get current date / time?
Message-Id: <3df9f0ad.757738200@news.cis.dfn.de>
On Thu, 12 Dec 2002 19:26:16 +0100, "Alan J. Flavell"
<flavell@mail.cern.ch> wrote:
>On Dec 12, codeWarrior inscribed on the eternal scroll:
>
>> # IF PASSED A DATE (MM/DD/YYYY) THIS MAKES A NICELY FORMATTED DATE
>
>There are quite large areas of the world where a date in the form
>dd/dd/dddd is parsed as meaning DD/MM/YYYY. It has a certain logic,
>indeed (although YYYY/MM/DD has even more logic). Why take the risk
>of ambiguity? There are some international standards, after all.
>
>Let's look at it this way. When US-ASCII was reaching its sell-by
>date, quite some years back, and 8-bit codings were being mooted, the
>ANSI considered defining a US-standard 8-bit coding, then thought
>better of it and deferred to the ISO - AFAIK, they did that in
>consideration of the fact that some USAns actually wanted to talk to
>the rest of the world, and vice versa.
>
>Y2K was a good moment to make a break with the past and do the same
>with date formats. How about it?
Why don't you tell them to convert over to the metric
system while they're at it? It's been standard in the
rest of the world for about a 100 years.
--
Regards, Helgi Briem
helgi AT decode DOT is
A: Top posting
Q: What is the most irritating thing on Usenet?
- "Gordon" on apihna
------------------------------
Date: Fri, 13 Dec 2002 17:53:41 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: matching words starting and ending with defined letters
Message-Id: <F8pK9.788$4W1.325@nwrddc02.gnilink.net>
liglin wrote:
> How must I modify this code so it returns all words starting with M
> AND ending with a?
>
> Thanks, Liglin
>
> @names=qw(Maria Marion Martha Barbara Carina);
>
> foreach(@names){
> if(/a$/){print "Success: $_\n";}
> if(/^M/){print "Success: $_\n";}
> }
Are you talking about _words_ or _strings_?
If your strings contain nothing but a single word (as in your example data)
then the simple solutions provided by the other posters are sufficient.
Or just combine your two conditions:
if(/a$/ and /^M/){print "Success: $_\n";}
However, if your strings contain many words and other characters and you
still want to get a list of all words(!) from this string starting with M
and ending with a then you need something more elaborate (untested):
@words = m/\b(M\w*a)\b/;
For details please see "perldoc perlre" about the special symbols in the
regular expression and "perldoc perlop" about the behaviour of the match
operator in list context.
jue
------------------------------
Date: Fri, 13 Dec 2002 15:21:55 +0100
From: Olivier GONTIER <Olivier.Gontier@ifremer.fr>
Subject: Net::Telnet and \r
Message-Id: <3DF9ED03.4BBF40EA@ifremer.fr>
Hi all,
When i send a packet with Net::Telnet and
(Output_record_separator => "\r") like that
$t->print("HELLO");
the length of ip packet is 7 ???
48 45 4C 4C 4F 0D 00
Why this null character ?
Is it possible to avoid this?
I i try (Output_record_separator => "") and
i send
$t->print("a"); ip length = 1 => it's ok
$t->print("\r"); ip length = 2 => Strange !!
$t = new Net::Telnet (Host => $hostname, Port => $port, Timeout => 20,
Prompt => '/[%#>] $/', Output_record_separator => "\r");
Thanks in advance for your help.
--
|Olivier GONTIER
------------------------------
Date: 13 Dec 2002 17:23:04 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Net::Telnet and \r
Message-Id: <u9k7id6dfr.fsf@wcl-l.bham.ac.uk>
Olivier GONTIER <Olivier.Gontier@ifremer.fr> writes:
> When i send a packet with Net::Telnet and
> (Output_record_separator => "\r") like that
> $t->print("HELLO");
> the length of ip packet is 7 ???
>
>
> 48 45 4C 4C 4F 0D 00
>
> Why this null character ?
Because Net::Telent implements the telnet protocol. The reason why
the telnet protcol encodes "0D" (other than in "0D 0A") as "0D 00" is
beyond the scope of this newsgroup but can be found in RFC854.
> Is it possible to avoid this?
I believe it is possible to negotiate telnet protocol options such
that "OD" is not so encoded. I do not know if Net::Telent can be made
to do this. Anyhow why do you care? One extra byte one the network
is not that significant.
Of course if the thing at the other side of the network is not
implementing the telnet protocol then either should you.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 13 Dec 2002 16:55:24 +0100
From: ZZT <a@b.c>
Subject: perlre question
Message-Id: <atcvtd$9rt$1@news1.wdf.sap-ag.de>
Hello,
I would like to fit and extract "a bb ccc" in the following string:
"running a bb ccc Somewhat"
while the spaces between are undefined but at least 2.
I use /^running\s{2,}(.*)\s{2,}.*/ but it extract not correctly.
Any idea?
thanks
------------------------------
Date: Fri, 13 Dec 2002 16:17:43 -0000
From: "Brian Wakem" <no@email.com>
Subject: Re: perlre question
Message-Id: <atd177$121jvd$1@ID-112158.news.dfncis.de>
"ZZT" <a@b.c> wrote in message news:atcvtd$9rt$1@news1.wdf.sap-ag.de...
> Hello,
>
> I would like to fit and extract "a bb ccc" in the following string:
>
> "running a bb ccc Somewhat"
>
> while the spaces between are undefined but at least 2.
>
> I use /^running\s{2,}(.*)\s{2,}.*/ but it extract not correctly.
> Any idea?
>
> thanks
>
/^running\s{2,}(\w+.*\w+)\s{2,}.*/
Will work for that example.
--
Brian Wakem
------------------------------
Date: Fri, 13 Dec 2002 10:19:22 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: perlre question
Message-Id: <slrnavk24a.2s2.tadmc@magna.augustmail.com>
ZZT <a@b.c> wrote:
> I would like to fit and extract "a bb ccc" in the following string:
>
> "running a bb ccc Somewhat"
>
> while the spaces between are undefined but at least 2.
>
> I use /^running\s{2,}(.*)\s{2,}.*/ but it extract not correctly.
perldoc -q regex
"What does it mean that regexes are greedy? How can I get
around it?"
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 13 Dec 2002 17:21:38 GMT
From: jason@generationterrorists.com (Jason Quek)
Subject: Simple Regex
Message-Id: <3dfc1111.51843436@news.starhub.net.sg>
Hi
To get the value between the first 2 'a's, I do this:
#------------------------------------
$string = 'a monkey a cat a dolphin a';
$string =~ /a([^a]*)a/;
print $1;
#------------------------------------
However, if 'a's weren't a single character, for example:
#------------------------------------
$string = 'dog monkey dog cat dog dolphin dog';
#------------------------------------
$string =~ /dog([^###]*)dog/;
What should I be using in place of ###?
I cannot do this
$string =~ /dog([^dog]*)dog/;
because ([^dog]*) will not match 'dog', but rather 'd' or 'o' or 'g'.
I've read the FAQ "How do I find matching/nesting anything?" but am
not sure if this describes the same problem.
Any help would be appreciated.
Regards,
Jason Q.
------------------------------
Date: 13 Dec 2002 17:33:55 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Simple Regex
Message-Id: <u9fzt16cxo.fsf@wcl-l.bham.ac.uk>
jason@generationterrorists.com (Jason Quek) writes:
> To get the value between the first 2 'a's, I do this:
> $string =~ /a([^a]*)a/;
> However, if 'a's weren't a single character, for example:
> I cannot do this
>
> $string =~ /dog([^dog]*)dog/;
>
> because ([^dog]*) will not match 'dog', but rather 'd' or 'o' or 'g'.
> I've read the FAQ "How do I find matching/nesting anything?" but am
> not sure if this describes the same problem.
It does, but only in passing.
That FAQ is actually about a more complex problem but your simple
problem and its solution are mentioned in the first paragraph to
explain why the simple solution is not the solution to the more
complex problem.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 13 Dec 2002 18:13:14 -0800
From: "Edward Quick" <vervoom@hotmail.com>
Subject: Re: unix2dos newbie question
Message-Id: <atd87d$o0a$1@cspc1n11.baplc.com>
Bart Lateur <bart.lateur@pandora.be> wrote in message
news:8jijvuclkqbti2gnj2j3l2q6oa4qcmr4rk@4ax.com...
> Tad McClellan wrote:
>
> >Edward Quick <vervoom@hotmail.com> wrote:
> >
> >> I need to perform a unix2dos function on $ftpbuf,
> >> but I'm not too sure how to do this in Perl.
> >
> >
> >If your Perl program is running on Unix:
> >
> > $ftpbuf =~ s/\n/\r\n/g;
>
> If you're doing this on DOS/Windows, you don't need to do anything.
> Just don't use binmode() on the output handle. The I/O will take care of
> it, then.
>
> I just hope this works for the kind of application you have in mind. It
> sure works for normal file handles. Thus, if you read a file on DOS/Win
> without binmode() applied to it, CRLF sequences will be turned into a
> bare "\n" = LF. You have to use binmode() on the handle to prevent that.
> In the same way, "\n" will be converted back to CRLF when printing to a
> handle to which you didn't apply binmode(). Again, binmode() will
> prevent that.
>
> binmode() does nothing on Unix.
>
>
> --
> Bart.
Thanks for your answers. This line:
$ftpbuf =~ s/\n/\r\n/g;
was what I needed. Works great now.
------------------------------
Date: Fri, 13 Dec 2002 18:54:01 GMT
From: "gibbering poster" <noone@nowhere.com>
Subject: Use Strict warning .. why?
Message-Id: <c1qK9.610$1D3.34585724@newssvr14.news.prodigy.com>
The following code:
package Map;
use Room;
use strict;
my $MAX_WIDTH = 80;
my $MAX_HEIGHT = 40;
my $MAX_ROOM_WIDTH = 16;
my $MAX_ROOM_HEIGHT = 16;
sub new ($) {
bless {}, $_[0];
}
sub init_map ($) {
my $self = shift;
@{$self}{width, height} = ($MAX_WIDTH, $MAX_HEIGHT); # <-- THIS LINE
GENERATES WARNING
$self->{rooms} = ();
my @grid;
for my $x (0 .. $self->{width} - 1) {
for my $y (0 .. $self->{height} - 1) {
$grid[$x][$y] = ' ';
}
}
$self->{grid} = \@grid;
}
Bareword "width" not allowed while "strict subs" in use Map.pm line 18
Bareword "height" not allowed while "strict subs" in use Map.pm line 18
if I assign these with $self->{width} = $MAX_WIDTH, I dont get the warning...
For some reason, the interpreter doesn't like the hash-slice method of assigning
values to keys within the object hash... why?
------------------------------
Date: Fri, 13 Dec 2002 11:29:22 -0600
From: brian d foy <comdog@panix.com>
Subject: Re: whatever happened to Tom Christiansen?
Message-Id: <131220021129220066%comdog@panix.com>
In article <zv-cnYjkQ8OCeWSgXTWcqA@portbridge.com>, <klassa@nc.rr.com>
wrote:
> Seems like some of the "olde guarde" have disappeared (not just from here,
> but from a visible presence in the perl community, period)... Is everybody
> doing well, and just getting away from perl?
why not ask Tom? he's the one who would know. :)
--
brian d foy, comdog@panix.com
------------------------------
Date: 13 Dec 2002 06:54:26 -0800
From: zirconx9@yahoo.com (Ryan)
Subject: Re: when uploading a file to CGI.pm, how to tell if file is zero bytes?
Message-Id: <e7d49913.0212130654.fda1de3@posting.google.com>
tadmc@augustmail.com (Tad McClellan) wrote in message news:<slrnavi08v.3va.tadmc@magna.augustmail.com>...
> Ryan <zirconx9@yahoo.com> wrote:
>
>
> > I'd like to
> > check for a zero byte file at that point.
>
>
> if ( -z $filename ) {
> print "'$filename' is empty\n";
> }
But at this point $filename is just 'foo.gif', its the name of the
file they uploaded. It doesn't exist on disk yet (maybe is does in a
temp file somewhere, I don't know how CGI.pm handles that).
Any other ideas?
-Ryan
------------------------------
Date: Fri, 13 Dec 2002 19:19:11 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: when uploading a file to CGI.pm, how to tell if file is zero bytes?
Message-Id: <Pine.LNX.4.40.0212131905340.10895-100000@lxplus073.cern.ch>
On Dec 13, Ryan inscribed on the eternal scroll:
> But at this point $filename is just 'foo.gif',
It's a bit more subtle than that. Go to
http://stein.cshl.org/WWW/software/CGI/ , and find the heading
"Creating a File Upload Field".
> its the name of the file they uploaded.
Read on:
The filename returned is also a file handle. You can read the
contents of the file using standard Perl file reading calls:
[and so on]
> It doesn't exist on disk yet
What does it say in the last paragraph of this section? :
http://stein.cshl.org/WWW/software/CGI/#upload_caveats
Not that I would actually get involved with what that temporary file
was named, because - after all - you've been given a filehandle to it.
So work with that.
> (maybe is does in a
> temp file somewhere, I don't know how CGI.pm handles that).
>
> Any other ideas?
My idea is that when I'm aware that I lack relevant information, I
usually react by consulting the documentation to see what I've missed.
Good luck.
--
Caution: sysadmin. Keep away from bright light and naked flames.
Always read the instructions on the package. May contain traces of nut.
------------------------------
Date: 13 Dec 2002 07:50:49 -0800
From: vpho@avaya.com (Phov)
Subject: Where can I find book about perl4
Message-Id: <261ba728.0212130750.5f7f1067@posting.google.com>
Our root refused to upgrade perl 4 to perl 5. are there any perl4
books or resource online. Can anyone help me to locate them.
Thanks in a millions
Phov
------------------------------
Date: Fri, 13 Dec 2002 15:52:50 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Where can I find book about perl4
Message-Id: <x77kedc3vz.fsf@mail.sysarch.com>
>>>>> "P" == Phov <vpho@avaya.com> writes:
P> Our root refused to upgrade perl 4 to perl 5. are there any perl4
P> books or resource online. Can anyone help me to locate them.
get another isp or host. that admin deserves to lose his job or more.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Fri, 13 Dec 2002 10:52:57 -0500
From: "Tulan W. Hu" <twhu@lucent.com>
Subject: Re: Where can I find book about perl4
Message-Id: <atcvou$q2u@netnews.proxy.lucent.com>
You don't really need to use the one root provides.
You may just download and install Perl 5 in a project directory and use it.
"Phov" <vpho@avaya.com> wrote in message ...
> Our root refused to upgrade perl 4 to perl 5. are there any perl4
> books or resource online. Can anyone help me to locate them.
> Thanks in a millions
> Phov
------------------------------
Date: Fri, 13 Dec 2002 10:08:46 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Where can I find book about perl4
Message-Id: <slrnavk1ge.2q7.tadmc@magna.augustmail.com>
Phov <vpho@avaya.com> wrote:
> Our root refused to upgrade perl 4 to perl 5.
What reason was offered for the refusal?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 13 Dec 2002 17:57:10 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Where can I find book about perl4
Message-Id: <WbpK9.798$4W1.141@nwrddc02.gnilink.net>
Phov wrote:
> Our root refused to upgrade perl 4 to perl 5. are there any perl4
> books or resource online. Can anyone help me to locate them.
Why not install your own Perl5?
jue
------------------------------
Date: Fri, 13 Dec 2002 15:58:57 -0000
From: "Richard S Beckett" <spikey-wan@bigfoot.com>
Subject: Re: Win32::OLE writing to excel.
Message-Id: <atd05c$jm1$1@newshost.mot.com>
"Richard S Beckett" <spikey-wan@bigfoot.com> wrote in message news:...
> Hello World!
>
> Guys,
>
> I'm having a horrendous time trying to write to cells in my spreadsheet
that
> are specified by variables.
>
> I'm trying to write like this:
>
> $active_sheet -> Cells ($set, ($loop + 24)) -> {Value} = ("$loop");
>
> $active_sheet -> Cells (($set + 1), ($loop + 24)) -> {Value} = ("some
> text");
>
>
>
> I've tried all combinations of brackets and quotes that I can think of,
and
> I've also tried using Range as well, but I can't get it to write anything.
>
> I've succeeded in doing a simple write to the sheet, so I know it's my
write
> commands that are at fault, but the docs aren't very helpful. Someone out
> there must be doing this!
>
> Thanks.
>
> R.
Scrub that, I found the mistake:
Range writes by column, then row. Cell writes by row, then column!
I'd got me rows and columns the wrong way round.
R.
------------------------------
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 4259
***************************************