[24800] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6953 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 3 09:06:20 2004

Date: Fri, 3 Sep 2004 06: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)

Perl-Users Digest           Fri, 3 Sep 2004     Volume: 10 Number: 6953

Today's topics:
    Re: A question about Perl: using perl command line to r <Joe.Smith@inwap.com>
    Re: ActivePerl and @INC on Win2k (Horst Walter)
        cant view my .pl file with IE <sincityharley@cox.net>
    Re: cant view my .pl file with IE <noreply@gunnar.cc>
    Re: cant view my .pl file with IE <richard@zync.co.uk>
        Data Structures in PERL <romanr@cablespeed.com>
    Re: Data Structures in PERL <tadmc@augustmail.com>
    Re: Data Structures in PERL <mritty@gmail.com>
    Re: Execute Windows program from Perl script (??) <scobloke2@infotop.co.uk>
        Getting System and Hardare Informatin <Some.One@hotmail.com>
    Re: Getting System and Hardare Informatin <Some.One@hotmail.com>
    Re: new to perl <Joe.Smith@inwap.com>
    Re: NEw to Perl <Joe.Smith@inwap.com>
    Re: NEw to Perl <jurgenex@hotmail.com>
    Re: NEw to Perl (Anno Siegel)
    Re: Newbie needs help on pattern matching <nobull@mail.com>
        output becomes unicode <leifwessman@hotmail.com>
    Re: output becomes unicode <jurgenex@hotmail.com>
    Re: output becomes unicode <leifwessman@hotmail.com>
    Re: output becomes unicode <flavell@ph.gla.ac.uk>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 03 Sep 2004 07:57:02 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: A question about Perl: using perl command line to replace strings...
Message-Id: <itVZc.18876$3l3.10793@attbi_s03>

lucy wrote:

> That's great! That's exactly I want. But how can I make this work for all 
> subdirectories recursively?

Put the one-liner into a sub in a file, and 'use File::Find;'.
	-Joe


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

Date: 3 Sep 2004 01:16:28 -0700
From: unkwb@web.de (Horst Walter)
Subject: Re: ActivePerl and @INC on Win2k
Message-Id: <53867fbe.0409030016.7d637a6d@posting.google.com>

Works, thanks a lot!
HW

René Larsen <rene.larsen@spamfilter.dk> wrote in message news:<VA.00000001.00d0c6b2@spamfilter.dk>...
> In article <53867fbe.0409020449.763156e3@posting.google.com>, Horst 
> Walter wrote:
> > 
> > I have just installed ActivePerl and want to start the ppm. There I
> > get the following error
> > 
> > Can't locate Win32/TieRegistry.pm in @INC (@INC contains:
> > C:/ActivePerl/5.8.4/lib .) at C:\ActivePerl\5.8.4\bin\ppm.bat line 15.
> 
> It seems like ActiveState have made an error.
> 
> Try starting a DOS shell (AKA Command prompt) and type the following:
> 
>     set PERL5LIB=C:/ActivePerl/5.8.4/site/lib
>     ppm
> 
> and see if the problem is solved. If it is, you need to get Windows to 
> set this environment variable.
> 
> Regards, René


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

Date: Fri, 3 Sep 2004 00:32:29 -0700
From: "Steven Vaden" <sincityharley@cox.net>
Subject: cant view my .pl file with IE
Message-Id: <Q5VZc.2231$9Y5.1070@fed1read02>

Has anyone used account manager by siteinteractive.com sucessfully while
being hosted on a UNIX server. I am having a really tough time getting this
script to run. I uploaded one of their files to my cgi-bin folder and when I
try to open it using IE I get an Internal Server Error. I uploaded it as
ASCII I put the correct path to perl in the script and my host provider
allows .pl and .cgi any help or advice would be greatly appreciated. By the
way I am being hosted by hostsave.com if that helps any.




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

Date: Fri, 03 Sep 2004 09:45:56 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: cant view my .pl file with IE
Message-Id: <2pqlnkFo0t2hU1@uni-berlin.de>

Steven Vaden wrote:
> Has anyone used account manager by siteinteractive.com sucessfully
> while being hosted on a UNIX server. I am having a really tough
> time getting this script to run. I uploaded one of their files to
> my cgi-bin folder and when I try to open it using IE I get an
> Internal Server Error. I uploaded it as ASCII I put the correct
> path to perl in the script and my host provider allows .pl and .cgi
> any help or advice would be greatly appreciated. By the way I am
> being hosted by hostsave.com if that helps any.

This is not actually a Perl problem.

For some general guidance about using CGI scripts, see
http://my.execpc.com/~keithp/bdlogcgi.htm

You can also try to add this line at the beginning of the script
(after the shebang line):

     use CGI::Carp 'fatalsToBrowser';

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: Fri, 03 Sep 2004 12:57:41 +0100
From: "Richard Gration" <richard@zync.co.uk>
Subject: Re: cant view my .pl file with IE
Message-Id: <ch9m9t$u41$1@news.freedom2surf.net>

<SNIP>

The most common problem I've seen when uploading cgis from a Winders
machine to a UNIX type server is that the shebang line gets a ^M / CR /
0x0D, call it what you like, character on the end and httpd spews about not
being able to find an executable called "/path/to/perl^M". If you have
shell access to your server you can check this in vim, or with cat -v or
just dos2unix the file regardless.

HTH
Rich


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

Date: Fri, 3 Sep 2004 04:28:05 -0700
From: "Roman Rodriguez" <romanr@cablespeed.com>
Subject: Data Structures in PERL
Message-Id: <yridnWpGgaZQyaXcRVn-ow@cablespeedwa.com>

Can you use PERL to create data structures such as linked list?  if so, is
there maybe a link where this can be studied?

Thanks,
-RR




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

Date: Fri, 3 Sep 2004 07:11:51 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Data Structures in PERL
Message-Id: <slrncjgns7.f1i.tadmc@magna.augustmail.com>

Roman Rodriguez <romanr@cablespeed.com> wrote:

> Can you use PERL to create data structures such as linked list?


You are expected to check the Perl FAQ *before* posting to the
Perl newsgroup you know.

   perldoc -q linked

       How do I handle linked lists?


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


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

Date: Fri, 03 Sep 2004 12:15:23 GMT
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Data Structures in PERL
Message-Id: <vfZZc.2291$ZS6.1737@trndny07>

"Roman Rodriguez" <romanr@cablespeed.com> wrote in message
news:yridnWpGgaZQyaXcRVn-ow@cablespeedwa.com...
> Can you use PERL to create data structures such as linked list?  if
so, is
> there maybe a link where this can be studied?

(Perl.  Not PERL.  See:  perldoc -q difference)

You *can*, but you don't want to.  Perl's native arrays are already more
powerful than linked lists.  This simple question smells like an XY
problem.  You need to do X, and you've decided based on programming in
other languages that the way to do X is with a linked list (Y).  So
you're asking us how to do Y intead of how to do X.

What is it you actually want to do?

To answer the question you (sort of) asked, a description of Perl
datastructures - hashes, arrays, arrays of array references, etc, are
discussed in:
perldoc perldsc

Paul Lalli




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

Date: Fri, 3 Sep 2004 09:33:43 +0000 (UTC)
From: Ian Wilson <scobloke2@infotop.co.uk>
Subject: Re: Execute Windows program from Perl script (??)
Message-Id: <ch9dpn$ods$1@titan.btinternet.com>

Tony McGuire wrote:
> What I keep getting is correction of capitalization, correction of use
> of terms,
 ...
> An actual example of this stuff would go a loooong way to making it so
> us idiots didn't need to bother the NG clic so much.

s/this stuff/forking/;
s/loooong/very long/;
s/us/we/;
s/didn't need to/need not/;
s/NG/CLPM/;
s/clic/clique/;

;-)


 From the original posting ...

 > Does anyone have info on how to (whether I can) get perl to execute an
 > external program and continue on?

I think someone has already suggested fork() and identified some of the 
the limitations (e.g. the parent should be coded to eventually reap the 
child's status).

I'm sure I've seen an example in the Camel book.

'perldoc -q fork' describes starting up a child process that is 
completely disassociated from the parent.


However,

If I recall correctly, you want to invoke textpad to edit apache's 
config and then get Apache to reload its config.

I'd find it a lot easier to use perl to

* read the config file,
* write a new httpd.conf.new,
* rename httpd.conf httpd.conf.old
* rename httpd.conf.new httpd.conf
* get Apache's process ID (hit PID file)
* send a 'reload your config' signal (HUP) to Apache. (perldoc -f kill)

I suspect this would be an order of magnitude simpler.


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

Date: Fri, 03 Sep 2004 09:41:55 GMT
From: Noname <Some.One@hotmail.com>
Subject: Getting System and Hardare Informatin
Message-Id: <D%WZc.24507$k4.475860@news1.nokia.com>

Hi,
I need to get system and hardware Information using Perl Scripts
like 
RAM Size and other memory sizes
Processor speed and Make/model etc
Hardware Make and Model
etc
how can I get these




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

Date: Fri, 03 Sep 2004 10:04:37 GMT
From: Noname <Some.One@hotmail.com>
Subject: Re: Getting System and Hardare Informatin
Message-Id: <VkXZc.24512$k4.476007@news1.nokia.com>

Noname <Some.One@hotmail.com> wrote in news:D%WZc.24507$k4.475860
@news1.nokia.com:

> Hi,
> I need to get system and hardware Information using Perl Scripts
> like 
> RAM Size and other memory sizes
> Processor speed and Make/model etc
> Hardware Make and Model
> etc
> how can I get these
> 
> 
> 

I did found some in formation Using Win32::Registry module , like processor 
speed etc, but not Memory size and Exact Model name, on Windows (Sorry for 
not mentionaing before)


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

Date: Fri, 03 Sep 2004 07:16:53 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: new to perl
Message-Id: <FTUZc.25160$_g7.6155@attbi_s52>

MES wrote:

> $file = text.txt
> outputfile = "$file .html
> 
> My outputfile comes out - test.txt.html
> 
> I would like it to be test.html
> 
> Can anyone help?

That is a trivial application of the substitute operator.

   ($outputfile = $file) =~ s/search_string/replacement_string/;

You should be able to figure out what to put for search_string and
replacement_string.

	-Joe


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

Date: Fri, 03 Sep 2004 07:45:18 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: NEw to Perl
Message-Id: <hiVZc.93237$9d6.46031@attbi_s54>

Jürgen Exner wrote:

>>while(&list) {
> 
> That's not the way to call a sub. Change that to
>     while (list()) {

No, change that to
	foreach (list()) { ... }

[Using while() will get the three items, throw two of them away,
and loop infinitely if list() returns the same data each time.]
	-Joe


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

Date: Fri, 03 Sep 2004 08:50:23 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: NEw to Perl
Message-Id: <jfWZc.3314$A63.1632@trnddc09>

Joe Smith wrote:
> Jürgen Exner wrote:
>
>>> while(&list) {
>>
>> That's not the way to call a sub. Change that to
>>     while (list()) {
>
> No, change that to
> foreach (list()) { ... }
>
> [Using while() will get the three items, throw two of them away,
> and loop infinitely if list() returns the same data each time.]

Oooops, indeed!
Sorry.

jue




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

Date: 3 Sep 2004 11:15:36 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: NEw to Perl
Message-Id: <ch9joo$m74$1@mamenchi.zrz.TU-Berlin.DE>

Abigail  <abigail@abigail.nl> wrote in comp.lang.perl.misc:
> Shawn Melnic (sham_x30@yahoo.com) wrote on MMMMXXI September MCMXCIII in
> <URL:news:a365c2aa.0409021716.4dde5964@posting.google.com>:
> ``  greetings,
> ``  
> ``  how do I make while in perl do this:
> ``  
> ``  while(&list) {
> ``  @line = ..
> ``  bla bla
> ``  bla
> ``  }
> ``  
> ``  sub list {
> ``   print "line 1";
> ``   print "line 2" ;
> ``   print "line 3" ;
> ``  }
> ``  
> ``  Basically, I want while to read the sub list into an array..
> 
> 
>     sub list {
>        ("line 1", "line 2", "line 3");
>     }
> 
>     while (my @line = list) {
>         bla bla
>         bla
>     }

That's the second infinite loop to be suggested in this thread :)

Anno


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

Date: Fri, 03 Sep 2004 12:11:34 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: Newbie needs help on pattern matching
Message-Id: <ch9j8f$qhk$1@sun3.bham.ac.uk>



Brian McCauley wrote:

> Madhusudan Singh wrote:
> 
>>         I need to extract some info from /sbin/iwconfig eth1 :
>>
>>         $ /sbin/iwconfig eth1 | grep "Link"
>>
>>           Link Quality:90/92  Signal level:-8 dBm  Noise level:-148 dBm
>> (updated)
>>
>>         I want to extract 90/92 from the stuff above. How do I code it ?
> 
>   my ($link_quality) = `/sbin/iwconfig eth1` =~ /Link Quality:(\S+)/;
> 
>> [...] even better 90 and 92 separately [...]

Oops didn't see that bit.  Like Tad said...

  my ($x,$y) = `/sbin/iwconfig eth1` =~ /Link Quality:(\d+)\/(\d+)/;

Note: Tad will replace the // match with alternate delimiters even to
save a single \/.  I consider this actually, on ballance, makes for
harder to read code.  I don't change the delimiters unless there would
be a lot of \/.




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

Date: 3 Sep 2004 03:02:18 -0700
From: "Leif Wessman" <leifwessman@hotmail.com>
Subject: output becomes unicode
Message-Id: <ch9ffa$sg6@odak26.prod.google.com>


Sorry for this silly question. I've seeked for answer but haven't found
anything.

This simple program:

--
#!/usr/bin/perl
use strict;
use warnings;
print "=E5=E4=F6";
--

prints "=C3=A5=C3=A4=C3=B6" (unicode characters)

Is that a normal behaviour? I would like to see "=E5=E4=F6" instead. Is it
possible to change?

I'm using v5.8.0.

Leif



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

Date: Fri, 03 Sep 2004 10:17:28 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: output becomes unicode
Message-Id: <YwXZc.1353$xr1.670@trnddc04>

Leif Wessman wrote:
> Sorry for this silly question. I've seeked for answer but haven't
> found anything.
>
> This simple program:
>
> --
> #!/usr/bin/perl
> use strict;
> use warnings;
> print "åäö";

[Rest of posting being snipped as signature; don't do that]
[Manually re-attached]

> prints "åäö" (unicode characters)

So? "åäö" are unicode characters, too. As are "abcdef...".
Virtually all commonly used character sets are included in Unicode, 
therefore saying "x" is a Unicode character doesn't bear much information.

> Is that a normal behaviour? I would like to see "åäö" instead. Is it
> possible to change?

It seems your Perl system (or the editor you are using to type and display 
your Perl program) and whatever you are using for display at runtime 
(xterm?) don't agree on the encoding. Did you try a simple "cat 
myperlprogram.pl"? You probably will see the same distortion.

Just change your display devise to the same encoding as you are using to 
type your programs. How to do that, well, that depends on what you are using 
to display the execution results of your program.

jue






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

Date: 3 Sep 2004 03:27:25 -0700
From: "Leif Wessman" <leifwessman@hotmail.com>
Subject: Re: output becomes unicode
Message-Id: <ch9gud$7vn@odbk17.prod.google.com>


J=FCrgen Exner wrote:
> Leif Wessman wrote:
> > Sorry for this silly question. I've seeked for answer but haven't
> > found anything.
> >
> > This simple program:
> >
> > --
> > #!/usr/bin/perl
> > use strict;
> > use warnings;
> > print "=E5=E4=F6";
>
> [Rest of posting being snipped as signature; don't do that]
> [Manually re-attached]
>
> > prints "=C3=A5=C3=A4=C3=B6" (unicode characters)
>
> So? "=E5=E4=F6" are unicode characters, too. As are "abcdef...".
> Virtually all commonly used character sets are included in Unicode,
> therefore saying "x" is a Unicode character doesn't bear much
information.
>

Ok. Thanks for the clarification. What I mean is that the characters
"=E5=E4=F6" are UTF-8 encoded.

> > Is that a normal behaviour? I would like to see "=E5=E4=F6" instead.
Is it
> > possible to change?
>
> It seems your Perl system (or the editor you are using to type and
display
> your Perl program) and whatever you are using for display at runtime
> (xterm?) don't agree on the encoding. Did you try a simple "cat
> myperlprogram.pl"? You probably will see the same distortion.
>

Nope. I see "=E5=E4=F6". No distortion.

> Just change your display devise to the same encoding as you are using
to
> type your programs. How to do that, well, that depends on what you
are using
> to display the execution results of your program.
>
> jue

I've tried that. It's not the display devise...
Any more suggestions?

Leif



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

Date: Fri, 3 Sep 2004 11:36:29 +0100
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: output becomes unicode
Message-Id: <Pine.LNX.4.61.0409031129550.7012@ppepc56.ph.gla.ac.uk>

  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--616733697-408667611-1094207420=:7012
Content-Type: TEXT/PLAIN; CHARSET=iso-8859-1
Content-Transfer-Encoding: 8BIT
Content-ID: <Pine.LNX.4.61.0409031130291.7012@ppepc56.ph.gla.ac.uk>

On Fri, 3 Sep 2004, Leif Wessman wrote:

[...]
> prints "åäö" (unicode characters)

Well, your posting headers say:

  Content-Type: text/plain; charset="iso-8859-1"

- so what you just posted was really a string of six iso-8859-1
characters (not three "unicode" characters as you claimed).

> Is that a normal behaviour? I would like to see "åäö" instead. Is it
> possible to change?
> 
> I'm using v5.8.0.

My hunch is that you have a locale set which has utf-8 in it.

What's the OS (redhat linux 9, for example?).  Then this would be a
known[1] problem.  Either take the utf-8 out of the locale (for legacy 
behaviour), or upgrade to using utf-8 consistently (for the future).

good luck

[1] Hint: google for terms like > rh9 perl.5.8 utf-8 locale <
--616733697-408667611-1094207420=:7012--


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 6953
***************************************


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