[18818] in Perl-Users-Digest
Perl-Users Digest, Issue: 986 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 25 11:05:44 2001
Date: Fri, 25 May 2001 08:05:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <990803110-v10-i986@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 25 May 2001 Volume: 10 Number: 986
Today's topics:
Re: Converting spaces to plus signs (Abigail)
Re: Converting spaces to plus signs <a.v.a@home.nl>
Re: Converting spaces to plus signs (Anno Siegel)
Re: dbi, fork and ipc-shareable - having problems <nospam@hotmail.com>
Re: I don't want global variables ? <newspost@coppit.org>
Re: I don't want global variables ? (Anno Siegel)
Re: I don't want global variables ? <mjcarman@home.com>
Re: Installing Perl on Win NT/2000 Re: Match Parsing Gl (Malcolm Hoar)
Re: Installing Perl on Win NT/2000 Re: Match Parsing Gl (Helgi Briem)
Java in perl?? <angenent@kabelfoon.nl>
Re: Java in perl?? <peb@bms.umist.ac.uk>
Re: looping through text to get info (Gary)
Perl script error during testing <sloon@mindless.com>
Re: Permuting days of the week <abe@ztreet.demon.nl>
Re: Problem building Perl <pne-news-20010525@newton.digitalspace.net>
Re: Problem with IIS/PERL and opening files (Helgi Briem)
Re: Problem with scalar variables (Abigail)
Re: read jpg newsgroup file <N@b.COM>
Re: realpath(), abs_path() (Abigail)
Re: Recognize a number <a.v.a@home.nl>
Re: Recognize a number ctcgag@hotmail.com
Re: SET-UP (free) (John Joseph Trammell)
Re: Simple sorting problem <amith.radhakrishnan@swisscom.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 25 May 2001 13:39:17 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: Converting spaces to plus signs
Message-Id: <slrn9gso45.1ic.abigail@tsathoggua.rlyeh.net>
Ken Philbrick (kenphilbrick@mindspring.com) wrote on MMDCCCXXIV September
MCMXCIII in <URL:news:3B0DA1AC.D0B73D85@mindspring.com>:
!! I have some strings that contain spaces, but I'd like to convert all the
!! spaces into plus signs. I've tried various methods using split and
!! join, but nothing has worked. The FAQ on perl.com doesn't seem to
!! mention anything about it either. Any ideas?
y
Abigail
--
$_ = "\nrekcaH lreP rehtona tsuJ"; my $chop; $chop = sub {print chop; $chop};
$chop -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()
-> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()
------------------------------
Date: Fri, 25 May 2001 13:55:39 GMT
From: AvA <a.v.a@home.nl>
Subject: Re: Converting spaces to plus signs
Message-Id: <3B0E3C83.5013B8AD@home.nl>
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Abigail wrote:
<blockquote TYPE=CITE>Ken Philbrick (kenphilbrick@mindspring.com) wrote
on MMDCCCXXIV September
<br>MCMXCIII in <URL:<a href="news:3B0DA1AC.D0B73D85@mindspring.com">news:3B0DA1AC.D0B73D85@mindspring.com</a>>:
<br>!! I have some strings that contain spaces, but I'd like to convert
all the
<br>!! spaces into plus signs. I've tried various methods using
split and
<br>!! join, but nothing has worked. The FAQ on perl.com doesn't
seem to
<br>!! mention anything about it either. Any ideas?
<p> y
<p>Abigail
<br>--
<br>$_ = "\nrekcaH lreP rehtona tsuJ"; my $chop; $chop = sub {print chop;
$chop};
<br>$chop -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () ->
() -> ()
<br>-> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () ->
() -> ()</blockquote>
______________
<p>#!/usr/bin/perl -w
<p>use strict;
<p>my $string = "This is a line with some
spaces";
<p>$string = join"+",(split/\s/,$string);
<br>
<br>print "$string\n";
<p>______________
<br>
<br>
<br>
<br> </html>
------------------------------
Date: 25 May 2001 14:17:05 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Converting spaces to plus signs
Message-Id: <9elph1$acm$1@mamenchi.zrz.TU-Berlin.DE>
According to AvA <a.v.a@home.nl>:
> Abigail wrote:
>
> > Ken Philbrick (kenphilbrick@mindspring.com) wrote on MMDCCCXXIV September
> > MCMXCIII in <URL:news:3B0DA1AC.D0B73D85@mindspring.com>:
> > !! I have some strings that contain spaces, but I'd like to convert all the
> > !! spaces into plus signs. I've tried various methods using split and
> > !! join, but nothing has worked. The FAQ on perl.com doesn't seem to
> > !! mention anything about it either. Any ideas?
> >
> > y
[sig snipped]
Please don't quote sigs.
______________
>
> #!/usr/bin/perl -w
>
> use strict;
>
> my $string = "This is a line with some spaces";
>
> $string = join"+",(split/\s/,$string);
>
> print "$string\n";
Why do you mention that after Abigail's solution?
Anno
------------------------------
Date: Fri, 25 May 2001 08:11:16 -0500
From: Mr. SunRay <nospam@hotmail.com>
Subject: Re: dbi, fork and ipc-shareable - having problems
Message-Id: <VRsP6.19$t43.55595@news.uswest.net>
<snip>
> you should add cleanup code in an END block or exit handler to deal with
> that.
Setting the 'destroy' option to 1 worked as expected and cleared this up, but
I tried it a few times without that just to see what would happen. Heck, I
think I tried *every* option. I also learned 2 commands I never used before
(ipcs, ipcrm).
> S> my $if = IO::File->new(SQLFILE) or die "Couldn't open file: $!\n";
>
> SQLFILE is a bareword. it should be quoted.
SQLFILE is constant. Perl has yet to complain about me doing this, though
perhaps it's bad practice. But I digress...
> think about this. you are trying to share a reference from one program
> to another. think again. you can't do it. refs are based on pointers to
> a given programs' address space. that is not something that is
> guaranteed to be the same in another program space. also who knows what
> IPC::Sharable is doing to that ref such as stringifying it.
That makes sense. Yet strangely, it seems to work *sometimes* - the worst case
for a programmer trying to solve a problem. I was getting 4 array refs (later
8, then 12, etc) during some test runs. Was this luck?
> save the data instead and not array refs.
That requires storing 4 different arrays (or one huge array), as opposed to
one nested array since I've got 4 sql queries returning more than 1 row. I'd
create an "array of arrays", but as even the perl cookbook points out (p.91 to
be exact), multidimensional arrays can only be implemented as an array of
references so I can't even use that.
> another solution is to use pipes and multiplexes i/o such as Event.pm,
> IO::Select, Stem or POE. shared memory is a pain.
I've looked at other options, but none clearly explain to me (or at all) how
to pass *variables* across a filehandle, socket, pipe or whatever.
Now I can't help but think that *somebody* out there must have come up with a
faster way of running sql queries using DBI. Should I be looking at threads?
> uri
Thanks for your time Uri (and anyone else pondering this post).
Mr. Sunray
------------------------------
Date: Fri, 25 May 2001 10:18:44 -0400
From: David Coppit <newspost@coppit.org>
Subject: Re: I don't want global variables ?
Message-Id: <Pine.SUN.4.33.0105251008280.22727-100000@mamba.cs.Virginia.EDU>
On Fri, 25 May 2001, it was written:
> One answer that I have discovered is to wrap the code up in {} code block
> and hey it works. Is this the best (only) way of doing this?
"{}" introduces a scope. The "file scope" is like having {} around
your whole file. Any "my" declared variable is visible in the current
scope as well as all enclosing scopes. This is why your %in, which was
declared at the file scope level, was visible in the sub.
FWIW, I often use brackets to limit the scope of variables:
my %input;
{
my $temp;
do
{
print "Enter a number: ";
$temp = <STDIN>;
}
until ($temp =~ /^\d+\n/);
$input{'number'} = $temp;
}
The scoping is a promise to you that you don't have to think about how $temp relates to the rest of the code.
This is also why I prefer this syntax:
if ($test)
{
# blah
}
else
{
# blah
}
over:
if ($test) {
# blah
} else {
# blah
}
--
David
------------------------------
Date: 25 May 2001 14:29:53 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: I don't want global variables ?
Message-Id: <9elq91$acm$2@mamenchi.zrz.TU-Berlin.DE>
According to David Coppit <newspost@coppit.org>:
> On Fri, 25 May 2001, it was written:
>
> > One answer that I have discovered is to wrap the code up in {} code block
> > and hey it works. Is this the best (only) way of doing this?
>
> "{}" introduces a scope. The "file scope" is like having {} around
> your whole file. Any "my" declared variable is visible in the current
> scope as well as all enclosing scopes. This is why your %in, which was
^^^
ITYM enclosed.
[snip]
Anno
------------------------------
Date: Fri, 25 May 2001 08:59:25 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: I don't want global variables ?
Message-Id: <3B0E653D.AA6F183D@home.com>
Kevin Hancock wrote:
>
>
> I have looked everywhere and cannot resolve this issue I do not
> want to deal with any global variables
Then don't use any. :)
> and am trying to declare a scope for all variables I use.
You want my() variables. A my() variable is visible only within the
enclosing block (or file if there isn't an enclosing block). Note that
this still isn't a global variable -- it's a file-scoped lexical. This
might seem like I'm arguing semantics with you, but there is a
difference, and it's important to ask the right question if you want the
right answer.
A file-scoped lexical variable is visible throughout the entire file,
but *only* throughout that file. A global variable would be visible
inside other files as well. (i.e. if you had a script divided up into
several modules.)
Now that we have the vocabulary straightened out, we can see that your
question has nothing to do with global variables, it has to do with
scoping.
> The following code as far as I can tell declares the hash
> %in as local to the procedure it is called from.
Nope, it's a file-scoped lexical.
> I pass it by reference to ReadParse and ReadParse populates it.
Correct.
> What I do not understand is how come sub test can change the
> values of %in?
Because %in is in scope within test(). The body of the test() function
is a block within the scope of your file, and therefore %in is visible
within test().
> Does my() declare a variable local to all lower procedures
You're thinking vertically. How should Perl know that you want %in to
dissappear after the call to ReadParse()? (And if it did, you couldn't
use it in your for loop.) my() declares a variable to be visible within
the enclosing block, and that includes any other blocks that may be
contained withing that block. Maybe a piece of sample code will show it
best:
{
my $foo = 1;
# $foo is visible here
{
my $bar = 2;
# $foo and $bar are both visible here
}
# $foo is visible here, but $bar isn't
}
> [H]ow do I prevent %in from being accesable to lower
> procedures unless passed explicitely in to the procedure?
You could move test() into a seperate module.
Another option is to wrap the whole range of code in which %in should be
visible in its own block. That's fine for your example, but could get
problematic if you have several variables with overlapping ranges.
The simplest (and recommended) method is to force yourself (as the
programmer) to have some standards. Only use variables in your subs that
you have declared within them. Unless, of course, you want to have that
sort of effect on things. While occasionally useful, it's generally
considered bad practice, so use your judgement to decide what's
appropriate for each situation.
-mjc
------------------------------
Date: Fri, 25 May 2001 13:53:30 GMT
From: malch@malch.com (Malcolm Hoar)
Subject: Re: Installing Perl on Win NT/2000 Re: Match Parsing Glitch
Message-Id: <9elo4p$1mgn$1@nntp1.ba.best.com>
In article <3b0e41df.3872945721@news.isholf.is>, helgi@NOSPAMdecode.is wrote:
>>Apparently, ActiveState has never heard of the tried & true ".exe"
>>self-executable format use by most on the planet????
>>
>Yes, they have. But new Microsoft OS's include an excellent
>Microsoft Installer utility which uses .msi scripts.
That's funny.
>Anyway, to cut a long story short, you need Microsoft
>Installer. This comes standard with Win2K and Me,
>but also be downloaded from
>http://download.microsoft.com/download/platformsdk/wininst/1.0/WIN98/EN-US/Inte
>lSDK.msi
Ummm, that's an MSI file which might be kind of hard to install
if you don't already have MSI. It's also an outdated version.
It may be more productive to start here:
http://aspn.activestate.com/ASPN/Downloads/ActivePerl/Requirements#windows
--
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
| Malcolm Hoar "The more I practice, the luckier I get". |
| malch@malch.com Gary Player. |
| http://www.malch.com/ Shpx gur PQN. |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------
Date: Fri, 25 May 2001 14:40:46 GMT
From: helgi@NOSPAMdecode.is (Helgi Briem)
Subject: Re: Installing Perl on Win NT/2000 Re: Match Parsing Glitch
Message-Id: <3b0e6ec6.3884442533@news.isholf.is>
On Fri, 25 May 2001 11:35:20 GMT, helgi@NOSPAMdecode.is
(Helgi Briem) wrote:
>Anyway, to cut a long story short, you need Microsoft
>Installer. This comes standard with Win2K and Me,
>but also be downloaded from
>http://download.microsoft.com/download/platformsdk/wininst/1.0/WIN98/EN-US/IntelSDK.msi
>
Sorry, wrong url. It is:
http://download.microsoft.com/download/platformsdk/wininst/1.1/NT4/EN-US/InstMsi.exe
Regards,
Helgi Briem
------------------------------
Date: Fri, 25 May 2001 15:19:52 -0700
From: "GOGAR" <angenent@kabelfoon.nl>
Subject: Java in perl??
Message-Id: <9elm5n$2jcs$1@news.kabelfoon.nl>
Anybody knows how to run a java applet in perl instead of a browser?
------------------------------
Date: Fri, 25 May 2001 15:43:32 +0100
From: Paul Boardman <peb@bms.umist.ac.uk>
Subject: Re: Java in perl??
Message-Id: <3B0E6F94.12C7E5BB@bms.umist.ac.uk>
> Anybody knows how to run a java applet in perl instead of a browser?
Why?
Paul
------------------------------
Date: 25 May 2001 07:30:48 -0700
From: grobitaille@mail.com (Gary)
Subject: Re: looping through text to get info
Message-Id: <a2051d6.0105250630.628e703d@posting.google.com>
"Godzilla!" <godzilla@stomp.stomp.tokyo> wrote in message news:<3B0DEA2A.C52426EC@stomp.stomp.tokyo>...
> Gary wrote:
>
> > Godzilla! wrote:
> > > Gary wrote:
>
> > > > I have a text file that looks like this:
>
> > > > Database Name : database1
>
> > > (snipped)
>
> > > I am curious to know what software produces
> > > this database.
>
> > The database is SYBASE and the textfile is output from a DBCC command
>
> I suspected this software is not top quality commercial
> binary but rather allows user tampering beyond what would
> be considered safe.
>
> Look at your data structure. It is exceptionally illogical.
> I have snipped out most leaving only that which is
> of importance.
>
>
> Database Name : database1
> Type Code: 100030; Hard fault
>
> Type Code: 100030; Hard fault
>
>
> Database Name : database2
> Type Code: 100030; Hard fault
>
> Type Code: 100030; Hard fault
>
>
> Your first record is labeled database1 and, the following
> record is not, although it references database1 per your
> stated parameters.
>
> Same is true for your third and fourth record.
>
> Why is this?
>
>
> You ask how to sort your records by database number
> yet structure your data with no database number
> references for all records. This makes little sense.
>
> This makes even less sense when adding new records
> to your database. Clearly your program, whatever
> program you are actually using, must differeniate
> between databases, one and two. Why does your program
> not print a database reference number for each and
> every entry? Your database structure directly indicates
> a first record is labeled but subsequent records are
> not labeled. Otherwords, your software deliberately
> removes database references for any records subsequent
> to an initial first record.
>
> To add a new record, your program must first find
> an initial first record with a database reference,
> move through records until it encounters an initial
> first record with a different reference, then has to
> backtrack to add a record in the right place.
>
> Your software knows which database it is working
> with. Why does it remove database numerical references?
>
> Even more senseless, why have you programmed your
> software to do this?
>
> Equally illogical is having to search a database
> with records missing database references. Your
> program must find an initial first record to
> differentiate databases, then search records
> until it encounters an initial first record
> with a different database reference, then
> backtrack just like it would to add a record.
>
> Why are you not simply appending records each
> with a clear database reference?
>
> database3 - record
> database1 - record
> database4 - record
> database2 - record
> database1 - record
> database4 - record
>
> This above structure makes sense. Easy to search,
> no need for backtracking, fast appending of records
> and very easy to sort by criteria indexing.
>
> What you display.. well.. hmm..
>
> database1 - record
> -record
> -record
>
> database2 - record
> -record
> -record
>
> database3 - record
> -record
> -record
>
> Do you see what is missing? What is missing is logic.
>
> Give consideration to reworking your database into a
> logically structured and easily managed database rather
> than asking how to write code to deal with a poorly
> structured database.
>
> Godzilla!
It is not a poorly structured adatabase at all. I am parsing the
output from a dbcc command which checks the database consistency. The
information in the text file that I am parsing has nothing to do with
the database design or the data in the database itself. The file is
simply the result of how sybase chose to write out the results from
the check. I do not have the control to modify how the output looks I
can only try and parse it the best way I can. Right now I have to look
at the output file manually and see how many and what kinds of errors
they are( Hard or Soft) The problem is that I have 15 servers all with
these output files and these checks are performed multiple times per
week. The output is fairly logically laid out but I posted a snipet
the first time around.
A more accurate description of the whole file is something like this:
Reporting configuration information of database master.
Parameter Name Value Size
database name master 33792K
dbcc named cache default data cache 131072K
scan workspace data_workspace (id = 944006394) 614400K
text workspace text_workspace (id = 976006508) 204800K
OAM count threshold 5%
IO error abort 3
linkage error abort 8
max worker processes 1
operation sequence number 13
(return status = 0)
Sun May 20 02:10:25 MDT 2001
DBCC execution completed. If DBCC printed error messages, contact a
user with System Administrator (SA) role.
Checking master
Storage checks for 'master' are complete. DBCC is now recording the
results in the dbccdb database.
DBCC CHECKSTORAGE for database 'master' sequence 14 completed at May
20 2001 2:10AM. 2 faults and 0 suspect conditions were located. 0
checks were aborted. You should investigate the recorded faults, and
plan a course of action that will correct them.
Verifying faults for 'master'.
DBCC CHECKVERIFY for database 'master' sequence 14 completed at May 20
2001 2:10AM. 0 suspect conditions were resolved as faults, and 0
suspect conditions were resolved as harmless. 0 objects could not be
checked.
DBCC execution completed. If DBCC printed error messages, contact a
user with System Administrator (SA) role.
Sun May 20 02:10:59 MDT 2001
Database Name : master
Table Name Index Type Code Description
Page Number
------------------------------ ------ -----------
----------------------------------------------
---- -----------
syscharsets 255 100030 page format error
621
syscharsets 255 100030 page format error
1552
(return status = 0)
Generating 'Fault Report' for object syscharsets in database master.
Type Code: 100030; Hard fault
Page format errors on OAM or text pages.
page id: 621
page header: 0x0000026D00000000000000000000002D000000020020FDFF000005254030
Header for 621, next 0, previous 0, id = 45:255
time stamp = 0x000000000002, next row = 32, level = 253
free offset = 1317, minlen = 0, status = 16432(0x4030)
Type Code: 100030; Hard fault
Page format errors on OAM or text pages.
page id: 1552
page header: 0x0000061000000000000000000000002D000000010020FDFF000000224030
Header for 1552, next 0, previous 0, id = 45:255
time stamp = 0x000000000001, next row = 32, level = 253
free offset = 34, minlen = 0, status = 16432(0x4030)
This pattern repeats many times as we have many many databases on a
given server as well as I mentioned before 15 servers
I hope this snipet sheds some light
------------------------------
Date: Fri, 25 May 2001 14:46:41 GMT
From: sloon <sloon@mindless.com>
Subject: Perl script error during testing
Message-Id: <tkrsgtsvjjlb49mev4i1q63djn6bn11c5d@4ax.com>
Hi all,
Very often, when I'm developing a perl script, I will make slight
modifications to the script and upload it to the intended server to
test the modifications. I might do this 30 or 40 times and it seems
that after a while, I get an error that the script cannot be run. Even
if I refresh it, reload it..etc.
THEN, if I shut down my computer and start it again, the script will
run correctly.
I'm usually using IE 5.
My question is:
Is this due to IE getting tired of opening the same script and
refusing to do it anymore or is it something server-side, the server
stops any more requests to the particular script that I'm requesting?
Even if I just rename a working script to the name of the script that
now gives an error, I still get the error unless I shut down and start
again. I've got IE set to always get a new version of the page.
I'm slightly bamboozled.
Rob
------------------------------
Date: Fri, 25 May 2001 16:36:13 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Permuting days of the week
Message-Id: <n0rsgtsgcdcm1hac6h80s9avnrij7sno90@4ax.com>
On Tue, 22 May 2001 18:17:23 GMT, chadbour@wwa.com (James Weisberg)
wrote:
>
> Here's a simple challenge.
>
> Given the days of the week: Sun, Mon, Tue, Wed, Thu, Fri, Sat
> I would like to take various permuations and sequences of those strings
> and fill the days in between. Examples:
>
> Sun-Sat = "Sun,Mon,Tue,Wed,Thu,Fri,Sat"
> Mon-Sun = "Mon,Tue,Wed,Thu,Fri,Sat,Sun"
> Wed-Tue = "Wed,Thu,Fri,Sat,Sun,Mon,Tue"
> etc, and sub-sequences:
> Sun-Tue = "Sun,Mon,Tue"
> Fri-Sun = "Fri,Sat,Sun"
> etc.
>
> So a function like fill($from, $to) would fill up to seven days
> $from - $to and $from != $to so Mon-Mon, for example, is invalid.
#!/usr/bin/perl -wl
use strict;
my @days = qw( Sun Mon Tue Wed Thu Fri Sat );
my %nday = map { $days[$_] => $days[ ($_+1) % @days ] } 0..$#days;
sub fill {
my( $from => $to ) = @_;
return $to if $from eq $to;
return join ',' => $from, fill( $nday{ $from } => $to )
}
print fill @ARGV;
--
Good luck, Abe
Amsterdam Perl Mongers http://amsterdam.pm.org
perl -e '$_=sub{split//,pop;print pop while@_};&$_("rekcah lreP rehtona tsuJ")'
------------------------------
Date: Fri, 25 May 2001 16:47:53 +0200
From: Philip Newton <pne-news-20010525@newton.digitalspace.net>
Subject: Re: Problem building Perl
Message-Id: <egksgtksn7476qpfvrbuqp0pjq6890ilaf@4ax.com>
On Fri, 25 May 2001 00:25:07 +0100, "Andrew Wood"
<andy@wood7.fsbusiness.co.uk> top-posted full-quoted:
> Try Activestate's version of Perl for Windows - it's easy
>
> www.activestate.com
It's easy to install, but it doesn't provide threads. So how is this
going to solve the original poster's problem?
> > i need threads in my perl on win98se.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Fri, 25 May 2001 13:48:05 GMT
From: helgi@NOSPAMdecode.is (Helgi Briem)
Subject: Re: Problem with IIS/PERL and opening files
Message-Id: <3b0e6174.3881031368@news.isholf.is>
On Fri, 25 May 2001 12:52:23 GMT, bbeatty@ireland.com wrote:
>Has anybody out there ever experienced a problem like this. It is most
>frustrating ....
>
>I am testing on NT4.0 IIS 4.0 or 2000 with IIS 5.0 and the problem
>exists on both.
>
>I have a Perl script that needs to read and extract information from a
>file. If the file is on the local machine it works fine, however if
>the script is on a shared drive on the network it comes back and says
>
>Cannot open "name of file" : Permission Denied.
>
>The scripts were designed to be run on the intranet, I am allowing
>anonymous access and the users have correct permissions for the files.
>
You probably haven't though.
>I have Microsoft proxy server running and am starting to think it has
>something to do with that. All users access the web through Proxy
>server.
Also the intranet? That's strange.
Whatever it is, the problem has nothing whatsover to do with
Perl.
Presumably you are talking about a CGI script,
in which case you need to set the permissions
for IUSR_machinename and not the user himself.
All http is run through this anonymous user,
similiar to the httpd user on Unix systems.
Regards,
Helgi Briem.
------------------------------
Date: Fri, 25 May 2001 13:38:12 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: Problem with scalar variables
Message-Id: <slrn9gso24.1ic.abigail@tsathoggua.rlyeh.net>
Scott DiNitto (usenet@infracore.dyndns.org) wrote on MMDCCCXXIV September
MCMXCIII in <URL:news:3b0e3611.20976613@news-server.san.rr.com>:
""
"" >and it will break too. will you fix his bugs later for him as well?
"" >
"" > SD> $variable = 3;
"" >
"" > SD> eval ("\@array$variable \= \("contents\"\);");
"" >
"" >if that is a sample of your code, i think your wit is better.
"" >
""
"" you can say it will break it. Show me how and I will believe you. your
"" all talk RESULTS.. that's what matters, and eval will produce them..
$ perl -w
eval ("\@array$variable \= \("contents\"\);");
Bareword found where operator expected at - line 1, near ""\@array$variable \= \("contents"
(Missing operator before contents?)
Unquoted string "contents" may clash with future reserved word at - line 1.
Backslash found where operator expected at - line 1, near "contents\"
Abigail
--
perl -swleprint -- -_='Just another Perl Hacker'
------------------------------
Date: Fri, 25 May 2001 14:21:40 GMT
From: "mk" <N@b.COM>
Subject: Re: read jpg newsgroup file
Message-Id: <UTtP6.6777$%X5.2324090@typhoon1.ba-dsg.net>
Thanks you so much. works like a charm.
-Mike
"Gerard Lanois" <gerard@NOSPAMlanois.com> wrote in message
news:u66eqy9qx.fsf@NOSPAMlanois.com...
> "mk" <N@b.COM> writes:
>
> > I am trying to use perl to download jpgs from usenet. I've been using
> > Net::NNTP on a W32 machine and have hit a snag. most of these messages
seem
> > to be in the format:
> >
> > BEGIN picturename.jpg
> > ...many lines of junk that Outlook automatically translates into
image...
> > END
> >
> > Any help would be greatly appreciated. Thanks in advance. I assure you
> > that I am using this for good.
> >
> > -Mike
>
> Been there, done that.
>
> http://ubh.sourceforge.net/
>
> -Gerard
> http://www.lanois.com/perl/
------------------------------
Date: Fri, 25 May 2001 14:33:42 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: realpath(), abs_path()
Message-Id: <slrn9gsra6.32i.abigail@tsathoggua.rlyeh.net>
/dev/null (postmaster@god.edu) wrote on MMDCCCXXIII September MCMXCIII in
<URL:news:3B0D5686.F27F5376@god.edu>:
][
][ What I want to use it for is to determine whether or not two
][ different paths refer to the same file or directory. One option is
][ to compare the filesystem and inode of each candidate. Another is to
][ determine the absolute canonicalized paths of each and see if they
][ are the same.
No, that will not do.
$ touch /tmp/foo
$ ln /tmp/foo /tmp/bar
/tmp/foo and /tmp/bar are the same file. However, both /tmp/foo and /tmp/bar
are "absolute canonicalized path"s. But "/tmp/foo" ne "/tmp/bar".
Abigail
--
$_ = "\nrekcaH lreP rehtona tsuJ"; my $chop; $chop = sub {print chop; $chop};
$chop -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()
-> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()
------------------------------
Date: Fri, 25 May 2001 13:23:41 GMT
From: AvA <a.v.a@home.nl>
Subject: Re: Recognize a number
Message-Id: <3B0E3504.ECB18553@home.nl>
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Philip Newton wrote:
<blockquote TYPE=CITE>On Thu, 24 May 2001 20:50:09 +0200, GianFranco Bozzetti
<br><gfbozzetti@interfree.it> wrote:
<p>> $str="-123a";
<br>> print "$str is Not a number\n" if ($str =~ m/[^0-9+-]+/);
<p>Er, why do you say "is not a number" if it matches this regex, but say
<br>"is a number" in the other two cases if it matches the identical regex?
<br>(Oh, and have you ever heard of "anchors" in regexes?)
<br> </blockquote>
Try this:
<br>_______________________________________
<p>#!/usr/bin/perl -w
<p>use strict;
<p>chomp(my $number = <>);
<p>if ($number =~ /^([-+]?[0-9]+)$/){
<br> print "It's a number: $number\n";
<br>} else {
<br> print "Not a number: $number\n";
<br>}
<br>______________________________________
<p>Worked for me.</html>
------------------------------
Date: 25 May 2001 14:28:07 GMT
From: ctcgag@hotmail.com
Subject: Re: Recognize a number
Message-Id: <20010525102807.062$WP@newsreader.com>
"Philip 'Yes, that's my address' Newton" <nospam.newton@gmx.li> wrote:
> On Thu, 24 May 2001 20:50:09 +0200, GianFranco Bozzetti
> <gfbozzetti@interfree.it> wrote:
>
> > $str="-123a";
> > print "$str is Not a number\n" if ($str =~ m/[^0-9+-]+/);
>
> Er, why do you say "is not a number" if it matches this regex, but say
> "is a number" in the other two cases if it matches the identical regex?
They're not identical. Notice the ^ in that regex which isn't in the
others.
[+-]?[0-9]+ should do it. More interesting is trying to recognize reals.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet for the Web
------------------------------
Date: Fri, 25 May 2001 14:21:29 GMT
From: trammell@bayazid.hypersloth.invalid (John Joseph Trammell)
Subject: Re: SET-UP (free)
Message-Id: <slrn9gso56.ppd.trammell@bayazid.hypersloth.net>
On Fri, 25 May 2001 04:10:05 GMT, Uri Guttman <uri@sysarch.com> wrote:
> >>>>> "BM" == Bob Moose <yogibearxx@bobmoose.com> writes:
> >> >>>>> "BM" == Bob Moose <yogibearxx@bobmoose.com> writes:
> BM> Well, I'll ask again. Can somebody?
> >> >> i will (for my definition of free which may not be yours. :)
> BM> And what's your defenition of free?
> >> not yours.
> >> uri
> BM> WHAT IS IT
> you tell me your definition first.
>
> uri
Would you two get a room or something? Furrfu.
--
IAAMOAC.
------------------------------
Date: Fri, 25 May 2001 14:26:04 +0000 (UTC)
From: "Amith Radhakrishnan" <amith.radhakrishnan@swisscom.com>
Subject: Re: Simple sorting problem
Message-Id: <01c0e526$a24ae870$cb8e240a@u55648>
Hi ,
Try the following ...Extract the numbers & alphabets into two arrays and
then compare them and join them together for final output .
Ex:
#!/usr/bin/perl -w
@before_sort=@str=();
@before_sort=("1","10","F","B","3","4","5","6","7","8","A","14","15");
@before_sort_numbers=@before_sort_alphabet=();
foreach $element (@before_sort) {
if ($element =~ /(\d+)/g ) {
push(@before_sort_numbers,$element);
}
elsif ( $element =~ /(\w+)/g ) {
push(@before_sort_alphabet,$element);
}
}
@str_num= sort {($a) <=> ($b) } @before_sort_numbers ;
@str_alp= sort {($a) cmp ($b) } @before_sort_alphabet ;
@str= (@str_num,@str_alp);
print "The numbers in the array before sorting :
@before_sort_numbers\n";
print "The numbers in the array after sorting : @str_num\n";
print "The characters in the array before sorting :
@before_sort_alphabet\n";
print "The characters in the array after sorting : @str_alp\n";
print "Before sorting the entire array : @before_sort\n";
print "After sorting the entire array : @str\n";
Regards,
Amith
Uri Guttman <uri@sysarch.com> schrieb im Beitrag
<x7bsok681o.fsf@home.sysarch.com>...
> >>>>> "AT" == Abe Timmerman <abe@ztreet.demon.nl> writes:
>
> AT> On Wed, 16 May 2001 15:26:35 -0400, Young Chi-Yeung Fan
> AT> <yf32@cornell.edu> wrote:
>
> >> 1, 2, 3, ..., 14, 15, 16, A, B
> >>
> >> I get this sorted result:
> >> B, A, 1, 2, ..., 15, 16
>
> >> What I want is this:
> >> 1, 2, 3, ..., 14, 15, 16, A, B
>
> AT> So, my first thought was to use GRT to sort the keys for the
general
> AT> case where (natural) numbers come before (other) strings.
>
> AT> This was the point where I went back to reading appendix B of "A
Fresh
> AT> Look at Efficient Perl Sorting"[1] and usually find an answer as to
> AT> how-to pack/unpack the data for GRT.
>
> AT> Although I found a solution for this example data, I didn't find a
> AT> answer for the general case I stated above.
>
> i contacted my co-author, larry rosler (who doesn't hang out here
> anymore) and he came up with this solution:
>
> ------------------
> my @s_keys = map { substr $_, 4 } sort
> map { pack( 'N' => /^(\d+)$/ ? $1 : -1 ) . $_ }
> keys %data;
>
> The idea of the solution is essentially correct, though encoded
> inefficiently (unnecessary copying of the alphanumeric strings). The
> main point is that -1 packed 'N' produces the *largest* value
> ("\xFFFF"), so the alphabetics sort themselves high relative to the
> sorted numerics.
> ------------------
>
> uri
>
> --
> Uri Guttman --------- uri@sysarch.com ----------
http://www.sysarch.com
> SYStems ARCHitecture and Stem Development ------
http://www.stemsystems.com
> Learn Advanced Object Oriented Perl from Damian Conway - Boston, July
10-11
> Class and Registration info:
http://www.sysarch.com/perl/OOP_class.html
>
------------------------------
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 986
**************************************