[17735] in Perl-Users-Digest
Perl-Users Digest, Issue: 5155 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 20 00:05:44 2000
Date: Tue, 19 Dec 2000 21:05:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <977288708-v9-i5155@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 19 Dec 2000 Volume: 9 Number: 5155
Today's topics:
Re: .pl or .plx? <kevin@vailstar.com>
Re: access a shared drive <carvdawg@patriot.net>
Re: access a shared drive <jhelman@wsb.com>
Re: Anything wrong with this code? <mcnuttj@nin.iats.missouri.edu>
Re: Help me for "DBI->connect failed: Sorry, too many c <jhelman@wsb.com>
Re: how do I reboot NT from within perl <jhelman@wsb.com>
is this bad perl programming habit? <alex@hoopsie2.com>
Re: Language evolution C->Perl->C++->Java->Python (Is P <kenny@kennypearce.net>
Re: local $| (Was: Getting around named pipe blocking?) (Charles DeRykus)
mod_perl make test problem with 1.24_01 <mtools@mindspring.com>
opening files <alex@hoopsie2.com>
Re: Perl to TCP/IP Connection & Overall Direction Neede <uri@sysarch.com>
Re: possibly st00pid question regarding 'require' <nospam@nospam.com>
Re: possibly st00pid question regarding 'require' (Tad McClellan)
Re: problems with "sort" in NT <harrisr@bignet.net>
Re: Remote system monitoring (Garry Williams)
what's more efficient in turning an array into a list? <alex@hoopsie2.com>
Re: what's more efficient in turning an array into a li (Tad McClellan)
Where can I get CRYPT for DOS/WIN? <virtualvat@yahoo.com>
Which frame? u0107@cheerful.com
Re: Which frame? <jhelman@wsb.com>
Re: Which frame? <tony_curtis32@yahoo.com>
Re: Which frame? <jschauma@netmeister.org>
yet another question: is ' more efficient than "? <alex@hoopsie2.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 19 Dec 2000 22:33:39 -0500
From: Kevin Michael Vail <kevin@vailstar.com>
Subject: Re: .pl or .plx?
Message-Id: <191220002233399373%kevin@vailstar.com>
In article <slrn93t2l5.j5f.mgjv@verbruggen.comdyn.com.au>, Martien
Verbruggen <mgjv@tradingpost.com.au> wrote:
> It's just a file extension. The execution bits and/or first line of
> the file are more important.
On rational operating systems, that's true. But I think the original
poster is using Windows.
Personally, I don't put any extensions on scripts to be executed on
Unix because I don't care (and my users shouldn't have to know, just to
use it) what language the script is in. But on Windows, extensionless
files are like orphans, and Explorer seems vaguely uncomfortable with
them. So I end them with .pl there, and associate that with wperl.exe
so that I can run them just by double-clicking them (virtually all of
them are Perl/Tk applications).
--
Kevin Michael Vail
kevin@vaildc.net
------------------------------
Date: Tue, 19 Dec 2000 21:33:04 -0500
From: H C <carvdawg@patriot.net>
Subject: Re: access a shared drive
Message-Id: <3A401A60.48D80932@patriot.net>
This is relatively easy to accomplish in Perl, using the Win32::Lanman
module.
If you go to http://www.forixnt.com/tools.html, there is a script there
called "null.pl".
It makes a null session connection to a system...minor modifications will
allow you
to map a drive or even a printer.
stong123@my-deja.com wrote:
> I have been trying to write a perl script to access a shared network
> drive. The server is a NT 4 server and the client I am going to run the
> script is a NT workstation. Both are in different domain. I tried
> opendir(DIR, $shareddir) while $shareddir = "\\server\shareddirectory";
> But I am pretty sure I can't use "\\".
>
> I am running Active Perl.
>
> TIA
>
> Sent via Deja.com
> http://www.deja.com/
--
Q: Why is Batman better than Bill Gates?
A: Batman was able to beat the Penguin.
------------------------------
Date: Wed, 20 Dec 2000 02:41:57 GMT
From: Jeff Helman <jhelman@wsb.com>
Subject: Re: access a shared drive
Message-Id: <3A401C85.298554C4@wsb.com>
stong123@my-deja.com wrote:
>
> I have been trying to write a perl script to access a shared network
> drive. The server is a NT 4 server and the client I am going to run the
> script is a NT workstation. Both are in different domain. I tried
> opendir(DIR, $shareddir) while $shareddir = "\\server\shareddirectory";
> But I am pretty sure I can't use "\\".
Try using forward slashes. Since backslashes have to be escaped (i.e.
'\\' actually is just one backslash in Perl), using them tends to make
your directories hard to read. If you have a share name like SOMESHARE
on your server SERVER, you can access the root directory of that share
by using something like:
opendir(DIR, "//SERVER/SOMESHARE/");
And to access subdirectories (or files therein) just add to it...
open(INF, "//SERVER/SOMESHARE/SomeDir/SomeOtherDir/File.txt");
In general, I've found that there are some weird bugs associated with
lower-case letters in share names across various flavors of Windows
(like Win95 doesn't like share names with lower-case letters). Thus, if
you make sure that your server name and your share name are capitalized
in all cases, everything should work all of the time.
There are various modules out there that allow you to actually map a
share to a drive and then access the share using the drive letter, but
that's really needless clutter. Just access your data using the UNC
names as described above and all should be well.
> I am running Active Perl.
>
> TIA
>
Hope this helps,
JH
------------------------------
Date: 20 Dec 2000 04:39:41 GMT
From: Justin McNutt <mcnuttj@nin.iats.missouri.edu>
Subject: Re: Anything wrong with this code?
Message-Id: <91pd6d$kh3$1@dipsy.missouri.edu>
Fryar386 <fryar386@aol.com> wrote:
> My server keeps giving me errors for this code, all it says is premature end.
> I don't see anything wrong with it, do you?
> print &PrintHeader;
> open FILE, ">> /serverfiles/test.txt"
> or die "Error, Please contact Fryar386@aol.com\n";
You need to escape the @ like this: \@
Also, the browser expects an HTML trailer. My CGIs usually do this when they
die:
print "Error message.<BR";
die "</BODY></HTML>\n";
Do this any time you need to die() in a CGI.
> flock FILE, 2
> or die "Couldn't acquire an exclusive lock on test.txt: $!\n";
Same problem here.
> print FILE <<ENDOFTEXT;
> <P>
> Username: $input{username}
> Password: $input{password}
> E-mail: $input{e-mail}
You may not be able to use the '-' here. I suggest changin the key
to either 'e-mail' (with the ticks) or to "email" (no '-'). I've had
that bite me before. I like my keys the way I like them, so I used tick
marks. :-)
> Attacks: $input{basic1}
> Main Goal: $input{main_goal}
> Planet: $planet
> AIM: $input{aim}
> Race: $input{race}
> Speed: $speed
> Defence: $defence
In American English, this is "defense" (with an s). May not apply here.
> Attack: $attack
> KI: $KI
> Health: $health
> MaxHealth: $maxhealth
> Intellegence: $intellegence
This should be "Intelligence" (American or UK english).
> Peri(money): $peri
> Power Level: $powerlevel
> ENDOFTEXT
> close FILE
> or warn "test.txt didn't close nicely: $!\n";
One other thing: If this is getting printed to a browser, you should
probably print a "<PRE>" (and a "</PRE>" near the end) to make sure that
your line feeds are interpreted properly. As you have it, I believe the
browser will run all the lines together.
Alternatively, you could end each line with <BR> for a line break.
Hope that helps!
--J
------------------------------
Date: Wed, 20 Dec 2000 03:07:25 GMT
From: Jeff Helman <jhelman@wsb.com>
Subject: Re: Help me for "DBI->connect failed: Sorry, too many clients already."
Message-Id: <3A40228A.C371D837@wsb.com>
Just a random guess, since I'm not really familiar with Postgres SQL...
Check to see if the DBI class you are using has a disconnect method in
addition to the connect method. If your database only allows one user
at a time (bad database design, there) and your initial connection does
not disconnect, the database server may have to wait until the first
connection times out before it accepts another connection.
Just a thought,
JH
9186191861@my-deja.com wrote:
>
> my cgi program is test.cgi:
> #######################
> require "./connectdb.pl";
> &connectdatabase();
> $query="select count(*) from messages";
> $sth=$dbh->prepare($query);
> $sth->execute();
> $count=$sth->fetchrow_array();
> print "Content-type: text/html\n\n";
> print <<"TAG";
> <html>
> <body>
> <h2> The count is $count. </h2>
> </body>
> </html>
> TAG
> exit 0;
> #############
> my connectdb.pl :
> sub connectdatabase {
> # my ($dbusername,$dbpassword)=@_;
> $dbusername="postgres";
> $dbpassword="lokicom";
> $dbname="mboardsony";
> use DBI;
> $dbh=DBI->connect
> ("dbi:Pg:dbname=$dbname",$dbusername,$dbpassword)
> or die "can
> not connect to $dbname\n";
> }
> 1;
> #######################
> my os is Redhat 6.2,and perl 5.005,and web
> server is Apache.
> The problem is:when I run test.cgi,it can work
> properly.But when I press F5
> to refresh the web page for sever minutes,the
> Apache will have error message:
> "DBI->connect failed: Sorry, too many clients
> already."
> Who can help me?
> Thank you ahead.
>
> My email: joel_xue@hotmail.com
>
> Sent via Deja.com
> http://www.deja.com/
--
----------------------------------------------------------------
Jeff Helman Product Manager -- Internet Services
jhelman@wsb.com CCH Washington Service Bureau
----------------------------------------------------------------
99 little bugs in the code, 99 bugs in the code.
Fix one bug, compile again, 100 little bugs in the code.
100 little bugs in the code, 100 bugs in the code.
Fix one bug, compile again, 101 little bugs in the code...
----------------------------------------------------------------
------------------------------
Date: Wed, 20 Dec 2000 02:32:59 GMT
From: Jeff Helman <jhelman@wsb.com>
Subject: Re: how do I reboot NT from within perl
Message-Id: <3A401A77.8D804AC6@wsb.com>
Geoff Lart wrote:
>
> Folks,
> How do I reboot my NT4 box from within a perl script ?
> Also how do I run a perl script as soon as the box
> comes back up, without any user logging in ?
> Cheers.
> Geoff Lart.
In your script, add the following line:
use Win32;
Then, use the the function described below (taken from the Activestate
documentation, you did read that right?)
Win32::InitiateSystemShutdown(MACHINE, MESSAGE, TIMEOUT, FORCECLOSE,
REBOOT)
Shuts down the specified MACHINE, notifying users with the supplied
MESSAGE, within the specified TIMEOUT interval. Forces closing of all
documents without prompting the user if FORCECLOSE is true, and reboots
the machine if REBOOT is true. This function works only on WinNT.
As for running a script before anyone logs on, I'm not exactly sure.
There may be a hidden registry key that would do this (check in an NT
group), but as far as I know, only honest-to-god services are started at
boot time before a user logs in (if you were using Unix, this would be a
snap, but alas, you're not). There's probably a way to turn a perl
script into a service, but I have no idea how to do so. Depending on
what you're trying to do, you might just consider adding your script to
the RUN registry keys for all users so it's run during any user's login
process. That said, this has really nothing to do with Perl and you
should seek answers elsewhere.
Hope this helps.
JH
------------------------------
Date: Tue, 19 Dec 2000 22:51:15 -0600
From: AP <alex@hoopsie2.com>
Subject: is this bad perl programming habit?
Message-Id: <3A403AC3.5DEF63E2@hoopsie2.com>
I have a 'glue' module which in turn 'use's other modules depending on
parameters passed. So, my code looks something like this:
#------- begin code
package MyModules::Glue # this isn't the real name =)
sub new {
my %args = @_;
## bless and other stuff here
if ( defined $args{USE_XYZ_FUNCTIONS} ) {
use MyModules::XYZModule;
push ( @MyModules::Glue, 'MyModules::XYZModule' );
}
#------- end code
So in effect, if I am not mistaken, the subroutines from XYZModule will not
be loaded if the arg USE_XYZ_FUNCTIONS is not defined. Am I wrong?
Thanks again,
--Alex
--
--------------------------------------------------
alex@hoopsie2.com | http://alex.hoopsie.com
--------- remove the "2" from e-mail -------------
------------------------------
Date: Tue, 19 Dec 2000 19:35:16 -0800
From: Kenny Pearce <kenny@kennypearce.net>
Subject: Re: Language evolution C->Perl->C++->Java->Python (Is Python the ULTIMATE oflanguages??)
Message-Id: <3A4028F4.ED44B826@kennypearce.net>
I haven't used SmallTalk, but from this conversation it seems that the only difference
between "everything is an object" and having primitives is that the latter requires
less typing. Ex.
int x =1;
as opposed to
Integer x = new Integer(1);
I can't c y there would be any other difference...
------------------------------
Date: Wed, 20 Dec 2000 01:46:59 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: local $| (Was: Getting around named pipe blocking?)
Message-Id: <G5uFMB.nr@news.boeing.com>
In article <m3puiod16s.fsf@mumonkan.sunstarsys.com>,
Joe Schaefer <joe+usenet@sunstarsys.com> wrote:
>
>On a recent thread, Uri remarked that local on $|
>was meaningless as the value is file handle specific.
>I'm not sure I understand exactly what he meant,
>since localization of $| seems to work for me:
>
>#!/usr/bin/perl -w
>
>{
> local $| = 1;
> print "fflush called?";
>}
>...
>
Coincidence. The default filehandle is stdout so the local
flush works (perldoc -f select). But another filehandle
wouldn't have flushed in that setting:
use IO::Handle;
{ local $| = 1;
local *F;
open(F...) or die $!;
# F->autoflush(1); # uncomment to flush
print F "fflush called?" and warn -s F ? "yes" : "no";
}
hth,
--
Charles DeRykus
------------------------------
Date: Tue, 19 Dec 2000 22:12:40 -0500
From: Philip Grabowski <mtools@mindspring.com>
Subject: mod_perl make test problem with 1.24_01
Message-Id: <3A4023A7.AC497B4C@mindspring.com>
I'm having problems when make test run... the t/logs/error_log reports
error 115, (22) Invalid argument: fcntl: F_SETLKW: Error getting
accept lock, exiting! Perhaps you need to use the LockFile directive to
place your lock file on a local disk!
I'm using mod_perl 1.24_01 with perl 5.6 and apache 1.3.14 on RH linux
7.0. The LockFile directive is set in the conf file for the server.
Any ideas?
--
Philip Grabowski
Mountain Toolsmiths, Inc.
------------------------------
Date: Tue, 19 Dec 2000 22:42:25 -0600
From: AP <alex@hoopsie2.com>
Subject: opening files
Message-Id: <3A4038B1.4954DF88@hoopsie2.com>
is the overhead for opening and reading the contents of a text file ( < 1K )
significant enough to instead embed the contents in the perl program?
I'm basically wondering because I have a script that uses 1 HTML template
and I may not need to change it very often, so I'm debating on whether or
not to embed the template in the script.
Thanks,
--Alex
--
--------------------------------------------------
alex@hoopsie2.com | http://alex.hoopsie.com
--------- remove the "2" from e-mail -------------
------------------------------
Date: Wed, 20 Dec 2000 04:36:13 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Perl to TCP/IP Connection & Overall Direction Needed
Message-Id: <x7n1dremkj.fsf@home.sysarch.com>
>>>>> "EH" == Eric Hilding <eric@hilding.com> writes:
EH> Umh, I've done many of these and plan to modify one of my existing
EH> scripts. Perhaps I *should* have said: "I have ALREADY done this
EH> before, and should be able to simply modify one of my existing
EH> VERY DETAILED scripts.
then you should have said that. PSI::ESP is not very reliable.
>> | EH> Hmmm... I THINK I CAN DO THIS.
>> | think harder.
EH> Well, you certainly do have a way with words, Uri. You must be
EH> one, lean, mean, super Perl programming stud wherever you are on
EH> the planet. With that kind of "Customer Service" attitude, you
EH> must be raking in the dough from consulting or something. I do
EH> not every recall seeing such "arrogance" on this newsgroup
EH> before...but all things change, I guess over the years.
no, it has been this way for years. you just have not been following
it. we get posts all the time asking for more than what could and should
be delivered here. your request mostly falls into that category.
>> |
>> | EH> 7. Log Off the remote database when all searches are done. I CAN
>> | DO
>> | EH> THIS !!!
EH> You apparently do NOT have a sense of humour. I encourage you to find
EH> one...
EH> someplace!
>> | exit() ;
huh? that is a very humorous response to a ridiculous comment. if you
can do it then why do you even mention here?
and in general your requests were very non-specific without any detail
on what you have done or what code you have. you expect us to be able to
figure out what you want from comments like I THINK I CAN DO THIS? if
you can do it fine. if you can't, fine. but thinking you can do it has
no bearing in this group. just code it or not. if you have perl related
problems you can post them here. but musing on your perl skills or lack
thereof in public is not useful to anyone.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: 20 Dec 2000 03:29:53 GMT
From: The WebDragon <nospam@nospam.com>
Subject: Re: possibly st00pid question regarding 'require'
Message-Id: <91p93h$hql$0@216.155.33.153>
In article <slrn93univ.9hk.tadmc@magna.metronet.com>,
tadmc@metronet.com (Tad McClellan) wrote:
| The WebDragon <nospam@nospam.com> wrote:
[snip]
| > | Is the "similar stuff" by chance global variables?
| > |
| > | Let's hope not...
| >
| >*chuckle* well.. basically there is one rather large HOHOL (that gets
| >populated from a datafile, and a few associated data items along with
| >it
| ^^^^^
| That's good.
ok.
| >in other hashes or scalars. they technically ARE global to all 5 of
| >the scripts involved, but I just have the data reading in
| >separately in each one.. if I change the data structure any, I'll
| >need to re-do this in each script.
|
| So you need to import a "data reading" subroutine, along with
| the data structure for it to populate.
basically, yes. :)
| >Separating out the import process would greatly simplify things,
| >particularly in light of the fact that I want to move away from the
| >flat-file DB format and into something DBI oriented as I learn the Perl
| >DBI...
[snip]
| > | Having lots of global variables is bad. If that is what you
| > | are talking about, then you should not use require to import
| > | them. You should not have them in your main program either.
| >
| >well how many is 'lots' ?
|
| It depends. That's why I left it nebulous. heh.
|
| Whatever you are comfortable with. If the program is "short"
| (50, or perhaps 100 lines), it matters hardly at all. For
| more ambitious programs, _I_ start getting uncomfortable
| at around 10 global variables.
ok, now why is that? Can you detail me some specific reasons why you
feel this way? (God, I feel like Eliza :) I'm seriously curious.
[snip]
| > | The "best" (most scalable) way would be to use packages and
| > | modules to provide the common variables (with "use" instead
| > | of "require").
| >
| >I'll have to ponder this ..
| >
| >Can I have the 'used' file do all the importing of the data into the
| >hash for me and supply this into a variable readable by the various
| >scripts?
|
|
| Now that I know more about what you are doing, I would not
| recommend importing the global BoH (Big ole Hash) at all.
|
| Seems to me that the common thing to factor out is the populating
| of the BoH. I would import only the read_and_load() subroutine
| and pass it a ref to the hash to be filled up.
|
|
| package main;
| my %BoH;
| read_and_load( 'filename', \%BoH );
|
| package BoH_loader;
| sub read_and_load {
| my($fname, $href) = @_;
|
| # ...
| $href->{somekey}[$someindex] = 'some data';
| # ...
| }
hmmmmmm.. ooooooooookay.. I think I see what you're getting at.
the hash structure looks like this in practice, when I re-import the
data from the flat-file created by my update script currently:
$master_maps_list{ $gametype }{ $coerced_filename_key_for_sorting } =
[ $filename, $title, $size, $review, $rating ];
so what you're saying is, I should pass the subroutine a *reference* to
the \%master_maps_list hash along with the file name to import from in
order to populate it, instead of aquiring the populated hash FROM the
other package..
correct?
as I read what I just typed, it re-occurs to me that the reason I wanted
to do this in the first place was so that I could offload the entire
process by which this is done, so that ultimately I could substitute a
different package that would import this data via DBI instead of a
massive <> on the file.
What I'm attempting to do here is keep the *main* program the same,
while being able to swap the input process around while I play with
things, without breaking the script or having to re-write it overmuch.
Is this somewhat clearer now, and still feasable?
or are you saying I should simply use a different 'read and load'
subroutine for that, and still keep things the way that you recommended?
Hey, wow, my brain works. cool. :)
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: Tue, 19 Dec 2000 22:30:35 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: possibly st00pid question regarding 'require'
Message-Id: <slrn9409ur.17d.tadmc@magna.metronet.com>
The WebDragon <nospam@nospam.com> wrote:
>In article <slrn93univ.9hk.tadmc@magna.metronet.com>,
>tadmc@metronet.com (Tad McClellan) wrote:
>
> | The WebDragon <nospam@nospam.com> wrote:
> | So you need to import a "data reading" subroutine, along with
> | the data structure for it to populate.
>
>basically, yes. :)
>
> | > | Having lots of global variables is bad.
> | >well how many is 'lots' ?
> |
> | It depends. That's why I left it nebulous. heh.
> |
> | Whatever you are comfortable with. If the program is "short"
> | (50, or perhaps 100 lines), it matters hardly at all. For
> | more ambitious programs, _I_ start getting uncomfortable
> | at around 10 global variables.
>
>ok, now why is that? Can you detail me some specific reasons why you
>feel this way? (God, I feel like Eliza :) I'm seriously curious.
This (globals are bad) is standard computer science fare.
The reason is because global variable are one way that can
lead to "action at a distance", where you change something
in one place, and it breaks something "far away".
Doesn't matter much in tiny programs because they don't _have_
any "far away" :-)
Basic principles of design (coupling, cohesion, etc...) become
more important the larger the program becomes.
> | Now that I know more about what you are doing, I would not
> | recommend importing the global BoH (Big ole Hash) at all.
> |
> | Seems to me that the common thing to factor out is the populating
> | of the BoH.
>hmmmmmm.. ooooooooookay.. I think I see what you're getting at.
>
>the hash structure looks like this in practice, when I re-import the
^^^^^^^^^
>data from the flat-file created by my update script currently:
There are modules for saving and restoring Perl data structures,
such as FreezeThaw.pm.
>
>$master_maps_list{ $gametype }{ $coerced_filename_key_for_sorting } =
> [ $filename, $title, $size, $review, $rating ];
>
>so what you're saying is, I should pass the subroutine a *reference* to
>the \%master_maps_list hash along with the file name to import from in
>order to populate it, instead of aquiring the populated hash FROM the
>other package..
>
>correct?
Right.
>as I read what I just typed, it re-occurs to me that the reason I wanted
>to do this in the first place was so that I could offload the entire
>process by which this is done, so that ultimately I could substitute a
>different package that would import this data via DBI instead of a
>massive <> on the file.
Tah dah!
>What I'm attempting to do here is keep the *main* program the same,
>while being able to swap the input process around while I play with
>things, without breaking the script or having to re-write it overmuch.
>Is this somewhat clearer now, and still feasable?
>
>or are you saying I should simply use a different 'read and load'
>subroutine for that, and still keep things the way that you recommended?
^^^^^^
We usually call it the "API" or the subroutine's "signature". That is,
the arguments to the function are the same in your program, you just
change out _which_ function it is that gets called.
>Hey, wow, my brain works. cool. :)
Today you
require 'read_and_load_flat';
Tomorrow you
require 'read_and_load_DB';
and your main code does not change at all.
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 19 Dec 2000 21:39:14 -0500
From: "Randy Harris" <harrisr@bignet.net>
Subject: Re: problems with "sort" in NT
Message-Id: <t406tfusdrn4b@corp.supernews.com>
<estelnet@my-deja.com> wrote in message
news:91okiq$jbu$1@nnrp1.deja.com...
> Hi...
>
> First, sorry, but my english is very poor.
>
> Could somebody help me?
> I need to translate this code line for run in NT.
>
> system "sort", "$dircgi/archive.dat", "-n", "-
> o", "$dircgi/archive2.dat";
>
> In Unix, it works... but in NT no...whats the porblem?
>
> Thanks
>
This isn't really a Perl question. DOS sort isn't very smart. I think
that "-n" means to do a numeric sort, DOS doesn't. You might try
something like:
system "sort", "< $dircgi/archive.dat", "> $dircgi/archive2.dat";
------------------------------
Date: Wed, 20 Dec 2000 02:15:10 GMT
From: garry@zweb.zvolve.net (Garry Williams)
Subject: Re: Remote system monitoring
Message-Id: <OCU%5.442$Kk5.21482@eagle.america.net>
On 20 Dec 2000 00:48:36 GMT, Abigail <abigail@foad.org> wrote:
>Abigail
>--
>my $qr = /^.+?(;).+?\1|;Just another Perl Hacker;|;.+$/;
> $qr =~ s/$qr//g;
>print $qr, "\n";
Shouldn't that be
my $qr = qr/^.+?(;).+?\1|;Just another Perl Hacker;|;.+$/;
^^
... and it's beautifully perverse!
--
Garry Williams
------------------------------
Date: Tue, 19 Dec 2000 22:40:19 -0600
From: AP <alex@hoopsie2.com>
Subject: what's more efficient in turning an array into a list?
Message-Id: <3A403833.830BA819@hoopsie2.com>
Which of these methods is more efficient (as in the performance sense):
#------------------------
my @array = qw(foo bar);
my $str;
## this way?
foreach ( @array ) {
$str .= $_;
}
## or this way?
$str = join('',@array)
#------------------------
Thanks,
Alex
--
--------------------------------------------------
alex@hoopsie2.com | http://alex.hoopsie.com
--------- remove the "2" from e-mail -------------
------------------------------
Date: Tue, 19 Dec 2000 23:02:27 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: what's more efficient in turning an array into a list?
Message-Id: <slrn940bqj.1i6.tadmc@magna.metronet.com>
AP <alex@hoopsie2.com> wrote:
>Which of these methods is more efficient (as in the performance sense):
use Benchmark;
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 20 Dec 2000 04:02:42 +0200
From: "Vitaly Tkachenko" <virtualvat@yahoo.com>
Subject: Where can I get CRYPT for DOS/WIN?
Message-Id: <91pctq$50kt7$1@ID-19904.news.dfncis.de>
Help please!
Where can I get some CRYPT program for DOS/WIN worked such as CRYPT in UNIX?
I just develop perl programs for CGI using mod_perl for Win32 and have to
debug them in Windows 98. How can I do CRYPT here?
--
/ VirtualVAT /
------------------------------
Date: Wed, 20 Dec 2000 02:22:54 GMT
From: u0107@cheerful.com
Subject: Which frame?
Message-Id: <91p55q$129$1@nnrp1.deja.com>
Hello,
On my website, I have pages which are composed of multiple frames.
Content for each of the frames are generated on the fly using perl
programs.
I would like to know the name of the frame in which the perl program is
being run - inside the perl program.
Is there some kind of an environment variable that can do that? I have
looked at env variables and there does not seem to be anything there.
All help gratefully accepted.
Cheers!
Uttam
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Wed, 20 Dec 2000 02:52:11 GMT
From: Jeff Helman <jhelman@wsb.com>
Subject: Re: Which frame?
Message-Id: <3A401EF2.E7CAF222@wsb.com>
u0107@cheerful.com wrote:
>
> Hello,
>
> On my website, I have pages which are composed of multiple frames.
>
> Content for each of the frames are generated on the fly using perl
> programs.
>
> I would like to know the name of the frame in which the perl program is
> being run - inside the perl program.
This is only tangentally related to Perl. Frames are a construct that
is understood by web browsers. Perl scripts executed via CGI are
totally unrelated. As far as the script is concerned, it doesn't care
if it's run in a frame, a new window, from the command line or anywhere
else.
> Is there some kind of an environment variable that can do that? I have
> looked at env variables and there does not seem to be anything there.
As I mentioned above, a frame is just a markup tag, like a <B>...</B>
set or anything else. It has nothing to do with CGI. That said, you
could fake it by setting up your frames to call the scripts with an
input variable identifying the frame. Something like (and forgive me if
my recollection of frames in HTML is a bit rusty...I never use them)...
<FRAMESET ROWS="80,*">
<FRAME NAME="Header" SRC="/headercgi.pl?FRAME=Header">
<FRAME NAME="Body" SRC="/bodycgi.pl?FRAME=Body">
</FRAMESET>
> All help gratefully accepted.
>
> Cheers!
>
> Uttam
Hope this helps,
JH
------------------------------
Date: 19 Dec 2000 21:18:55 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Which frame?
Message-Id: <87vgsfzso0.fsf@limey.hpcc.uh.edu>
>> On Wed, 20 Dec 2000 02:22:54 GMT,
>> u0107@cheerful.com said:
> Hello, On my website, I have pages which are composed of multiple
> frames.
> Content for each of the frames are generated on the fly using perl
> programs.
> I would like to know the name of the frame in which the perl program
> is being run - inside the perl program.
This is meaningless. The perl program is run *on the server*.
Frames are an HTML construct.
Of course, if you have hyperlinks within HTML documents, you can tag
them (e.g. QUERY_STRING) to indicate their source. But also be
advised this is trivially easy to fake.
hth
t
--
Eih bennek, eih blavek.
------------------------------
Date: Tue, 19 Dec 2000 22:54:21 -0500
From: "Jan Schaumann" <jschauma@netmeister.org>
Subject: Re: Which frame?
Message-Id: <kgW%5.39534$gm.791643@e420r-sjo2.usenetserver.com>
* u0107@cheerful.com wrote:
> Hello,
>
> On my website, I have pages which are composed of multiple frames.
>
> Content for each of the frames are generated on the fly using perl
> programs.
>
> I would like to know the name of the frame in which the perl program is
> being run - inside the perl program.
Pass the name of the frame to the script.Use some javascript function to
get the name (don't know which one it is of the top of my head, something
like parent.xyz). Ask in some www.authoring.misc or some javascript NG
about how to do this in detail.
-Jan
--
Jan Schaumann <http://www.netmeister.org>
Bender to Zoidberg: "You're looking less nuts, crabby."
------------------------------
Date: Tue, 19 Dec 2000 22:53:29 -0600
From: AP <alex@hoopsie2.com>
Subject: yet another question: is ' more efficient than "?
Message-Id: <3A403B49.A748999E@hoopsie2.com>
Is using single quotes more efficent than using double?
print 'my name is joe';
vs.
print "my name is joe";
Notice that nothing is being interpolated. I would guess that it has to be
more efficient since perl doesn't have to look for anything to interpolate.
The only thing it would look for are escaped single quotes and/or forward
slashes. Am I wasting my time single quoting things?
--
--------------------------------------------------
alex@hoopsie2.com | http://alex.hoopsie.com
--------- remove the "2" from e-mail -------------
------------------------------
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 5155
**************************************