[16056] in Perl-Users-Digest
Perl-Users Digest, Issue: 3468 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 23 18:15:39 2000
Date: Fri, 23 Jun 2000 15:15:26 -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: <961798526-v9-i3468@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 23 Jun 2000 Volume: 9 Number: 3468
Today's topics:
rand and redirect functions <csorensen@uptimeresources.net>
Re: rand and redirect functions <care227@attglobal.net>
Re: rand and redirect functions <csorensen@uptimeresources.net>
Re: rand and redirect functions <sariq@texas.net>
Re: rand and redirect functions <flavell@mail.cern.ch>
Re: rand and redirect functions <csorensen@uptimeresources.net>
Re: rand and redirect functions <csorensen@uptimeresources.net>
Re: rand and redirect functions (Craig Berry)
Re: Random number lepew@my-deja.com
Re: Random number <rootbeer@redcat.com>
Re: regex engin's undocumented behaviour? (Bart Lateur)
Simple regular expression question <kennylim@techie.com>
SSL Post Method <tulit.nospam@nospam-rzsoft.com>
SSL session variable robb4444@my-deja.com
Re: SSL session variable <tony_curtis32@yahoo.com>
Unable to access an array from within a class <scott.christensen@dot.state.wi.us>
Re: Unable to access an array from within a class (Eric Bohlman)
Re: Unable to access an array from within a class <billy@arnis-bsl.com>
Re: uncoupling SQL from object classes bsmith@webnetint.com
unlink on NT <Sly_Dur@hotmail.com>
Re: unlink on NT <rootbeer@redcat.com>
Re: Urgent: Perl Access to MySql wihout DBI.pm possible <gellyfish@gellyfish.com>
Re: use of eval and strict does not correctly set $@ <adamsch1NOadSPAM@yahoo.com.invalid>
Re: Use of split and join with special character (Tad McClellan)
Re: Using link checking scripts with Dynamo server (new <bellamy_walton@my-deja.com>
Re: Using link checking scripts with Dynamo server (new <flavell@mail.cern.ch>
Re: What's the difference between a hash and an array? (Abigail)
Re: Who is the Perl Princess ? <jboes@eoexchange.com>
Re: Why cant a cgi and module use the same library? (Bart Lateur)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 23 Jun 2000 14:13:17 EDT
From: Chris Sorensen <csorensen@uptimeresources.net>
Subject: rand and redirect functions
Message-Id: <3953A8B0.40B79D5D@uptimeresources.net>
Here's a simple script which is supposed to randomly select a url from
an array and redirect the browser to that url.
the error is in the redirect() statement. I'm just not sure what the
error is .. any ideas ?
----------------------------------------------------------
#!/usr/bin/perl
use CGI;
# create an array of links
@links = ('http://www.uptimeresources.net/', 'http://www.art.com/',
'http://www.cgi-resources.com/');
# generate a random number
$pick = int(rand 3);
print redirect("$links[$pick]");
--------------------------------------------------
------------------------------
Date: Fri, 23 Jun 2000 14:13:52 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: rand and redirect functions
Message-Id: <3953A8E0.8EF8630B@attglobal.net>
Chris Sorensen wrote:
>
> Here's a simple script which is supposed to randomly select a url from
> an array and redirect the browser to that url.
>
> the error is in the redirect() statement. I'm just not sure what the
> error is .. any ideas ?
Not really as much a Perl error as it is a CGI/HTTP problem.
You'll probably get a much better response in:
comp.infosystems.www.authoring.cgi
------------------------------
Date: 23 Jun 2000 14:23:33 EDT
From: Chris Sorensen <csorensen@uptimeresources.net>
Subject: Re: rand and redirect functions
Message-Id: <3953AB19.3040AD81@uptimeresources.net>
solved it ..
don't need cgi.pm at all
instead of redirect I should - print "Location: $redirect \n\n";
Drew Simonis wrote:
>
> Chris Sorensen wrote:
> >
> > Here's a simple script which is supposed to randomly select a url from
> > an array and redirect the browser to that url.
> >
> > the error is in the redirect() statement. I'm just not sure what the
> > error is .. any ideas ?
>
> Not really as much a Perl error as it is a CGI/HTTP problem.
> You'll probably get a much better response in:
>
> comp.infosystems.www.authoring.cgi
------------------------------
Date: Fri, 23 Jun 2000 13:24:04 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: rand and redirect functions
Message-Id: <3953AB44.787A12D@texas.net>
Chris Sorensen wrote:
>
> #!/usr/bin/perl
You should be using the -w switch and the strict pragma. They'll catch
lots of errors for you.
> use CGI;
>
> # create an array of links
> @links = ('http://www.uptimeresources.net/', 'http://www.art.com/',
> 'http://www.cgi-resources.com/');
>
> # generate a random number
> $pick = int(rand 3);
>
> print redirect("$links[$pick]");
You need to include the package name, and the quotes are superfluous.
print CGI::redirect($links[$pick]);
- Tom
------------------------------
Date: Fri, 23 Jun 2000 20:37:14 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: rand and redirect functions
Message-Id: <Pine.GHP.4.21.0006232027380.13079-100000@hpplus03.cern.ch>
On 23 Jun 2000, Chris Sorensen wrote:
> the error is in the redirect() statement. I'm just not sure what the
> error is .. any ideas ?
Yes, AS SO OFTEN HERE, you failed to use the ability of Perl to help
you. As such, the time that you wasted wasn't only your own.
> #!/usr/bin/perl
Use the -w flag at least (-wT is often advisable in the CGI
context), and use strict;
> use CGI;
But you've chosen to use procedure calls rather than object-style.
That means you'll either need to import the procedure names, or
specify the package name explicitly. Perl could have told you that,
but you didn't ask it to.
use CGI qw(:standard); # is the usual choice here
A useful addition to CGIs as a matter of course may be
use CGI::Carp qw(fatalsToBrowser);
> # generate a random number
> $pick = int(rand 3);
Better to declare this new variable with my ...
> print redirect("$links[$pick]");
No need for the quotes here.
good luck.
------------------------------
Date: 23 Jun 2000 15:32:50 EDT
From: Chris Sorensen <csorensen@uptimeresources.net>
Subject: Re: rand and redirect functions
Message-Id: <3953BB55.910FFA3C@uptimeresources.net>
"Alan J. Flavell" wrote:
>
> Yes, AS SO OFTEN HERE, you failed to use the ability of Perl to help
> you. As such, the time that you wasted wasn't only your own.
>
> > #!/usr/bin/perl
>
> Use the -w flag at least (-wT is often advisable in the CGI
> context), and use strict;
I ran with the -w flag before I posted .. it didn't catch anything .. it
turns out that I didn't need CGI or redirect at all ..
the correct line was - print "Location: $links[$pick] \n\n";
------------------------------
Date: 23 Jun 2000 15:33:58 EDT
From: Chris Sorensen <csorensen@uptimeresources.net>
Subject: Re: rand and redirect functions
Message-Id: <3953BB9A.971E3E35@uptimeresources.net>
Thanks tom .. I tired that and it worked .. apparently if I'm going to
insist on using cgi I need to include the package name (oops!) ...
>
> You need to include the package name, and the quotes are superfluous.
>
> print CGI::redirect($links[$pick]);
>
> - Tom
------------------------------
Date: Fri, 23 Jun 2000 20:45:08 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: rand and redirect functions
Message-Id: <sl7j2kuqe7f93@corp.supernews.com>
Chris Sorensen (csorensen@uptimeresources.net) wrote:
: Here's a simple script which is supposed to randomly select a url from
: an array and redirect the browser to that url.
:
: the error is in the redirect() statement. I'm just not sure what the
: error is .. any ideas ?
What error did you see? When I ran this, I was told that the function
main::redirect() doesn't exist, which should be a clue. CGI.pm doesn't
export its functions into the main namespace by default; you can make it
do so by using the :all qualifier on the use, or by calling
CGI::redirect() instead.
Other comments...
: #!/usr/bin/perl
Always use -w, and strongly consider 'use strict' as well.
: use CGI;
(This is where you'd add 'qw(:all)'.)
: # create an array of links
: @links = ('http://www.uptimeresources.net/', 'http://www.art.com/',
: 'http://www.cgi-resources.com/');
I'd be tempted to clean this up like so:
my @domains = qw( www.uptimeresources.net
www.art.com
www.cgi-resources.com );
my @links = map { "http://$_/" } @domains;
which makes your domains list a little easier to read and edit.
All of this...
: # generate a random number
: $pick = int(rand 3);
: print redirect("$links[$pick]");
...can be replaced with:
print redirect($links[rand @links]);
Note the use of @links in a scalar context to get the array size,
replacing your hard-coded 3. Note also that the double-quoting of the
argument in your version is entirely superfluous.
--
| Craig Berry - http://www.cinenet.net/users/cberry/home.html
--*-- "Beauty and strength, leaping laughter and delicious
| languor, force and fire, are of us." - Liber AL II:20
------------------------------
Date: Fri, 23 Jun 2000 18:32:47 GMT
From: lepew@my-deja.com
Subject: Re: Random number
Message-Id: <8j0agf$dgm$1@nnrp1.deja.com>
But isn't this suppose to generate numbers between 1 and 7?
In article <394BF21E.83277511@sti.com.br>,
Fabio Niski <fabion@sti.com.br> wrote:
> Use it like larry wall uses it =)
>
> This is a dice roll, the max number is 6, the min is 1
>
> $roll = int(rand 6) + 1;
>
> Chello wrote:
>
> > Hi all,
> >
> > I have a little problem I have to generate a random number with two
limits
> > (upper limit and down limit) for example 1 and 4. When I call the
script
> > this script would have to display "1" or "2" or "3" or "4". Does
somebody
> > knows how to do it? Do you have an example?
> >
> > Thanks a lot
> >
> > Stéphane
>
> --
> Fabio Niski - UIN# 2587619 - www.niski.com
>
> "Life would be so much easier if we could just look at the source
code."
> -- Unknown
>
>
--
- lepew
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 23 Jun 2000 12:01:34 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Random number
Message-Id: <Pine.GSO.4.10.10006231200480.23149-100000@user2.teleport.com>
On Fri, 23 Jun 2000 lepew@my-deja.com wrote:
> > $roll = int(rand 6) + 1;
> But isn't this suppose to generate numbers between 1 and 7?
Nope. See the docs. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 23 Jun 2000 20:41:32 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: regex engin's undocumented behaviour?
Message-Id: <3955c5de.1976201@news.skynet.be>
victor@catchacorp.com wrote:
>$_=aabbaa;
>/^(aa(bb)?)+$/;
>print $1; # you will get 'aa'
>print $2; # should output 'bb'?? but is empty
>
>i think perl is somewhat confused by the combination of '?' and '+'. my
>solution
No...
It is the annoying behaviour of perl, to keep only the last match.
Look at this:
$_ = "eeny meeny myny moo!";
/((?:(\w+) *)+)/;
print "1:<$1>\n2:<$2>\n";
-->
1:<eeny meeny myny moo>
2:<moo>
Although the whole regex matched all words with intervening spaces, of
all the matched words (the inner parentheses), only the last match is
kepts and stored.
Look again at yours.
$_= 'aabbaa';
/^(aa(bb)?)+$/;
What will this match? The whole string. The first tilme through it all,
it will match "aabb", the second and last time, only "aa". Therefore,
what is stored in the special variables is indeed "aa", and the optional
"bb" is not matched. That explains entirely what your described.
--
Bart.
------------------------------
Date: Fri, 23 Jun 2000 01:46:26 GMT
From: "Kenny Lim" <kennylim@techie.com>
Subject: Simple regular expression question
Message-Id: <SJZ45.22375$DS.644555@NEWSREAD2.PROD.ITD.EARTHLINK.NET>
Hi All,
I have a simple question here :
I have the following id's that are stored in result.txt files.
{B2165B0A-9D18-11d3-BA27-006008AF680E}|{BBBDDE80-488B-11D4-85D7-00105AE3A355
}
{B2165B09-9D18-11d3-BA27-006008AF680E}|{BB9623A0-488B-11D4-85D7-00105AE3A355
}
{308C177E-9BAA-11d3-9465-005004D9BC31}|{BB9C4060-488B-11D4-85D7-00105AE3A355
}
{B2B98458-9D15-11d3-9466-005004D9BC31}|{BBAD0F70-488B-11D4-85D7-00105AE3A355
}
{B2165B0A-9D18-11d3-BA27-006008AF680E}|{BBBDDE80-488B-11D4-85D7-00105AE3A355
}
My objective here is to be able to separate and parsed both the contents in
{a..} | {b..} to the following :
ie.
{B2165B0A-9D18-11d3-BA27-006008AF680E}|{BBBDDE80-488B-11D4-85D7-00105AE3A355
}
$search = {B2165B0A-9D18-11d3-BA27-006008AF680E}
$replace = {BBBDDE80-488B-11D4-85D7-00105AE3A355}
So far, I am only able to retrieve the 1st category of the id contents and
not the second.
Snippets of my code enclosed :
#=========================================================================
open (INIT, "<report.txt") or die "Could not open $orig: $!";
while (<INIT>)
{
if
(m/{([\w]{8})+\-([\w]{4})+\-([\w]{4})+\-([\w]{4})+\-([\w]{12})}|{([\w]{8})+\
-([\w]{4})+\-([\w]{4})+\-([\w]{4})+\-([\w]{12})}/ig)
{
#print "$_\n";
$search = "{$1-$2-$3-$4-$5}";
print "$search\n";
$replace = "{$6-$7-$8-$9-$10}";
print "$replace\n";
}
};
#==========================================================================
The output of my results are the following :
$ perl e3.pl
{B2165B09-9D18-11d3-BA27-006008AF680E}
{----}
{308C177E-9BAA-11d3-9465-005004D9BC31}
{----}
{B2B98458-9D15-11d3-9466-005004D9BC31}
{----}
{B2165B0A-9D18-11d3-BA27-006008AF680E}
{----}
Can anyone provide me a pointer as to how I can retrieve the second category
of the id contents ?
Any advise would be greatly appreciated. Thanks.
Kenny-
------------------------------
Date: Fri, 23 Jun 2000 03:37:17 GMT
From: "Tarun Tuli" <tulit.nospam@nospam-rzsoft.com>
Subject: SSL Post Method
Message-Id: <NXA45.22328$EF6.287332@NEWS1.RDC1.AB.HOME.COM>
Hi, I was wondering if anyone knew how I could possibly post a form
(automatically) using perl. The form that I am posting to only supports a
POST method. As an added twist, it also only allows SSL connections.
Any advice on how to tackle this one would be greatly appriciated.
Thanks.
------------------------------
Date: Mon, 19 Jun 2000 14:16:30 GMT
From: robb4444@my-deja.com
Subject: SSL session variable
Message-Id: <8IL9VJ$IUO$1@NNRP1.DEJA.COM>
Is there a session variable that you need to 'reset' after logging out
of a ssl/https website?
Thanks,
Robb Samuell
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 20 Jun 2000 13:15:55 GMT
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: SSL session variable
Message-Id: <87HFAPU4H5.FSF@LIMEY.HPCC.UH.EDU>
>> On Mon, 19 Jun 2000 14:16:30 GMT,
>> robb4444@my-deja.com said:
> Is there a session variable that you need to 'reset'
> after logging out of a ssl/https website?
What on earth does this have to do with perl?
--
"Trying is the first step towards failure"
Homer Simpson
------------------------------
Date: Fri, 23 Jun 2000 19:05:44 GMT
From: Scott Christensen <scott.christensen@dot.state.wi.us>
Subject: Unable to access an array from within a class
Message-Id: <8j0cdt$eut$1@nnrp1.deja.com>
I am a fairly new PERL programmer and am trying to create a class. If
I have a reference variable array in the hash for the class, how do I
access and set the sub elements in the array. For example, I have
sub new {
... some code ...
bless {
"arrayRef" => @array
... etc ...
}, $class
}
I would assume that I should be able to get access to the array by
doing something like:
$self->{"arrayRef"}[x]
but this isn't working. So, I realize this is probably a very simple
question, but I can't find the answer to save my life. How can I
access the array from inside my class.
Thanks for your help,
Scott Christensen
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 23 Jun 2000 19:29:18 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Unable to access an array from within a class
Message-Id: <8j0dqe$gd3$4@slb6.atl.mindspring.net>
Scott Christensen (scott.christensen@dot.state.wi.us) wrote:
: I am a fairly new PERL programmer and am trying to create a class. If
: I have a reference variable array in the hash for the class, how do I
: access and set the sub elements in the array. For example, I have
:
: sub new {
: ... some code ...
:
: bless {
: "arrayRef" => @array
You want a reference to the array there (or a reference to an anonymous
copy of it). Instead, you're flattening the array out into a list,
effectively making your object a reference to a hash where the first key
is "arrayRef" with a value of the first element of the array, the second
key is the second element of the array with value the third element of
the array, etc.
: ... etc ...
: }, $class
: }
:
: I would assume that I should be able to get access to the array by
: doing something like:
:
: $self->{"arrayRef"}[x]
That won't work because the way you did things, $self->{arrayRef} is a
plain scalar, not an array reference.
------------------------------
Date: Fri, 23 Jun 2000 19:53:59 GMT
From: Ilja Tabachnik <billy@arnis-bsl.com>
Subject: Re: Unable to access an array from within a class
Message-Id: <8j0f8d$h8f$1@nnrp1.deja.com>
In article <8j0cdt$eut$1@nnrp1.deja.com>,
Scott Christensen <scott.christensen@dot.state.wi.us> wrote:
> I am a fairly new PERL programmer and am trying to create a class. If
> I have a reference variable array in the hash for the class, how do I
> access and set the sub elements in the array. For example, I have
>
> sub new {
> ... some code ...
>
> bless {
> "arrayRef" => @array
> ... etc ...
> }, $class
> }
>
> I would assume that I should be able to get access to the array by
> doing something like:
>
> $self->{"arrayRef"}[x]
>
> but this isn't working. So, I realize this is probably a very simple
> question, but I can't find the answer to save my life. How can I
> access the array from inside my class.
>
If I guess right, you want your blessed reference
to be actually a hash reference, and one of the hash
elements ($self->{arrayRef}) should be an array reference.
But you do _not_ create an array reference in your code.
Try the following:
bless { arrayRef => [ @array ], ...etc... }, $class;
Hope this helps.
Ilja.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 23 Jun 2000 20:46:39 GMT
From: bsmith@webnetint.com
Subject: Re: uncoupling SQL from object classes
Message-Id: <8j0iba$jk3$1@nnrp1.deja.com>
I think I understand what you are doing, though due to my inexperience
with OO terms, I'm not sure how to apply this to me situation. For
example, I have a Person class with attributes like person_id,lastname,
firstname, ssn, etc.
I want a "save" method that 1. inserts data into db if the person
doesn't exists (the person_id attribute doesn't exist) or 2. updates
the data if the person_id exists.
Right now, I have the sql embedded in the save method, so I pass the
method a db connection ref and do the work.
I'm trying to
1. not have to always pass the methods a db handle
2. store the sql globally somehow so I can easily modify the database
structure if necessary without to much work on the class module.
Can I apply your concept somehow? Would I just instantiate the
UserDatabase and pass the correct statement handle to my class?
If I declare and create my db handle and statement handle in a script
that "uses" my Person module at its beginning, can the Person object's
methods "see" my $dh and $sth variables?
Thanks again for your help.
Brian
In article <MPG.13bcc2c781b68c4998974e@news>,
elephant@squirrelgroup.com (jason) wrote:
> bsmith@webnetint.com writes ..
> >In beginning to employ OO techniques in my Perl CGI programs, I find
> >that it would be wonderful if I could somehow move all my SQL
reuquired
> >to manipulate my object data from the class methods themselves to
some
> >"higher" application layer. I would like for each CGI program to
grab a
> >db connection and provide access to all the object classes, and I
would
> >like my SQL statements in some sort of configuration area where they
can
> >be modified to fit different databases/structure with little or no
> >changes to the object class definitions.
> >
> >Can someone lend some guidance as to what practices are employed with
> >using OO techniques with relational databases systems, MySql in
> >particular?
>
> I don't know what "practices are employed" .. but I have a collection
> class that provides fairly standard collection methods applicable to a
> range of different data
>
> get
> update
> delete
> add
> getNext
> getPrev
> getAll
>
> the item classes that make up the collections will change depending on
> the data .. but the collection classes change very little (and the
item
> classes really only change their blessed hash - and their accessor
> methods - if you're in to those)
>
> then there are a few database classes .. essentially I split them up
for
> ease of maintenance .. the admin stuff will all be in one module - the
> user stuff in another
>
> they're singletons because I only want one database connection across
> any and all modules that use the respective functions .. excuse the
> formatting - trying to fit within 80 chars .. they look something like
> this
>
> package UserDatabase;
> require 5.005;
>
> $UserDatabase::VERSION = '1.0';
>
> use DBI;
>
> use Constants qw/DSN USERNAME PASSWORD LAST_ID_FUNCTION/;
>
> my $self = undef;
>
> sub single
> {
> my $class = shift;
> die "Incorrect number of parameters passed to DatabaseHandle::new\n"
> unless @_ == 0;
>
> unless ( defined $self )
> {
> my $dbh = DBI->connect( DSN, USERNAME, PASSWORD);
>
> $self
> = bless { dbh => $dbh
> , id => $dbh->prepare( 'SELECT '. LAST_ID_FUNCTION )
> , table_sth => $dbh->prepare( 'SELECT * FROM table '
> . 'WHERE id = ?'
> )
>
> # ...
> # imagine as many prepared statements as you need here
> # ...
>
> } => $class;
> }
> $self;
> }
>
> sub DESTROY
> {
> $dbh->disconnect;
> }
>
> 1;
>
> from the collection classes you use it something like this
>
> # attach to the singleton
> my $dh = single UserDatabase;
>
> # grab a statement handle to the statement we're interested in
> my $sth = $dh->{table_sth};
>
> # execute that statement
> my $ret = $sth->execute;
>
> # then use one of the $sth->fetchrow_ functions .. QED
>
> btw .. excuse me if the code above doesn't run - I culled a few things
> from it that are specific to my setup and can't really test the
generic
> version of it
>
> --
> jason - elephant@squirrelgroup.com -
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 23 Jun 2000 13:51:14 -0500
From: "SlyDur" <Sly_Dur@hotmail.com>
Subject: unlink on NT
Message-Id: <8j0bj5$6j2$1@nntp9.atl.mindspring.net>
Hello,
I have a script that did work fine but qui all of a sudden and for the life
of me I can't figure why? I think this is a permissions issue.
Here is the deal.. I have a formmail type script that runs on NT using
ActiveState Perl (The latest). It creates a temporary file, emails that file
out and then unlinks that temp file. Problem is the unlinking or deleting of
these temporary files just quit working. SO I am geeting a directory full of
temp files. The directory these temp files live in have read, write, delete
access fro the IUSR account. Problem is when the temp fiels are created by
my script they are created with only read execute permissions. I figured
this is why I can't unlink them because they are created with only read x
permissions.. Is this true? Is there a way to create the temp files and
specify what permissions they should have when they are created?
Thanks,
Todd
------------------------------
Date: Fri, 23 Jun 2000 12:03:45 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: unlink on NT
Message-Id: <Pine.GSO.4.10.10006231202180.23149-100000@user2.teleport.com>
On Fri, 23 Jun 2000, SlyDur wrote:
> Problem is the unlinking or deleting of
> these temporary files just quit working.
Are you checking the return value from unlink()?
unlink $file or warn "Can't unlink '$file': $!";
> Is there a way to create the temp files and specify what permissions
> they should have when they are created?
You probably want umask(). But I don't know what effect, if any, that has
on NT.
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 23 Jun 2000 22:40:39 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Urgent: Perl Access to MySql wihout DBI.pm possible ???
Message-Id: <8j0lgn$atc$1@orpheus.gellyfish.com>
On Fri, 23 Jun 2000 07:24:34 -0700 Michael Budash wrote:
> In article <961747156.4128.0.nnrp-09.c3ad6973@news.demon.co.uk>, "W Kemp"
> <bill.kemp@wire2.com> wrote:
>
>> >But how can i have access to MySql from a Perl-Script without the DBI
>> Module
>> >?????
>>
>>
>> (1) by writing a huge and complex piece of code that will take years and
>> years to do
>> (2) Change the name of the module, and tell the system administrator that it
>> isn't DBI
>
> or go to cpan and get the [now deprecated] Mysql.pm module...
>
Except the MySQL module is now implemented as a wrapper over DBD::Mysql
:)
/J\
--
** This space reserved for venue sponsor for yapc::Europe **
<http://www.yapc.org/Europe/>
------------------------------
Date: Fri, 23 Jun 2000 11:27:57 -0700
From: dfdf <adamsch1NOadSPAM@yahoo.com.invalid>
Subject: Re: use of eval and strict does not correctly set $@
Message-Id: <05dafef4.023595a3@usw-ex0103-018.remarq.com>
Thanks for all the help! I am upgrading to 5.6 and will give it
a whirl. I now have a way around it anyhow with the SIG WARN
trick which is a new one to me.
Cheers,
Shane Adams
Got questions? Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com
------------------------------
Date: Mon, 19 Jun 2000 12:43:04 GMT
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Use of split and join with special character
Message-Id: <SLRN8KS5AO.DF5.TADMC@MAGNA.METRONET.COM>
On Mon, 19 Jun 2000 13:21:22 +0200, Pablo Agirre <pagirre@ada.ucin.com> wrote:
> How could I use an special character in a split call ?
>
> I don't want to use "\\ |", because I need to use it also in a join
>expression.
>
> my $delim = '|';
>
> split (/$delim/, $line);
split (/\Q$delim/, $line); # \Q same as quotemeta()
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 23 Jun 2000 19:55:49 GMT
From: Bella <bellamy_walton@my-deja.com>
Subject: Re: Using link checking scripts with Dynamo server (newbie question)
Message-Id: <8j0fbr$hao$1@nnrp1.deja.com>
In article
<Pine.GSO.4.10.10006161511040.21108-100000@user2.teleport.com>,
Tom Phoenix <rootbeer@redcat.com> wrote:
> Why? There are plenty of them available for free. Some of them
> actually work. If Randal's most recent one doesn't work with
> minimal tweaking, let him know - he's always looking for new
> column ideas.
Gosh! Why thanks for avoiding the question completely! And helping me
find a solution ;)
> Of course, if your server doesn't follow the specs, that's another
> matter. In that case, replace the server. Cheers!
And this helps my position how?
--
Bella...
"Experience is what you get when you don't get what you want"
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 23 Jun 2000 22:39:40 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Using link checking scripts with Dynamo server (newbie question)
Message-Id: <Pine.GHP.4.21.0006232238150.13079-100000@hpplus03.cern.ch>
On Fri, 23 Jun 2000, Bella wrote:
> > Of course, if your server doesn't follow the specs, that's another
> > matter. In that case, replace the server. Cheers!
>
> And this helps my position how?
Standards conformance.
Open client-server protocols work best when the players conform to the
published rules. Tell that to Bill Gates when you next see him.
--
"Mir ist es ein Rätsel wie man mit minimalem Verstand so einen
Unfug fabrizieren kann." - Adrian Knoth
------------------------------
Date: Tue, 20 Jun 2000 10:50:33 GMT
From: abigail@delanet.com (Abigail)
Subject: Re: What's the difference between a hash and an array?
Message-Id: <SLRN8KRFT5.3A7.ABIGAIL@ALEXANDRA.DELANET.COM>
David Bell (db7654321@aol.comspamsux) wrote on MMCDLXXXIV September
MCMXCIII in <URL:news:20000619020650.02964.00001095@ng-ch1.aol.com>:
\\
\\ About the lack of file locks...
\\ What *would* happen if two people ran the script at the same time?
Data corruption. Loss of information.
Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
------------------------------
Date: Fri, 23 Jun 2000 16:58:46 -0400
From: Jeff Boes <jboes@eoexchange.com>
Subject: Re: Who is the Perl Princess ?
Message-Id: <3953cfd1$0$1498$44a10c7e@news.net-link.net>
Jonathan Stowe wrote:
>
> On Thu, 22 Jun 2000 17:26:32 GMT martinagoo@my-deja.com wrote:
> > Find out about this web phenom at
> > http://oozinggoo.com/perlprincess
> > She's sweeping the web!
> > How did this all start?!?!
> >
>
> You think I'm stupid enough to look ?
>
Oh, go ahead. No harm in it... fairly amusing in a "America's Stupidest
Criminals" sort of way.
--
Jeff Boes |perl -e 'print map(substr("
|jboes@eoexchange.com
Sr. S/W Engineer |acehjklnoprstu,\n",$i+=$_,1),(5,9, |616-381-9889 ext
18
Change Technology|-2,1,-13,1,7,1,4,-9,-1,8,-11,10,-7 |616-381-4823 fax
EoExchange, Inc. |,8,-4,-7,4,-3,1,4,-3,8,4,1));'
|www.eoexchange.com
------------------------------
Date: Fri, 23 Jun 2000 19:51:13 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Why cant a cgi and module use the same library?
Message-Id: <395654c8.3141874@news.skynet.be>
glchy wrote:
>Bart, could you provide me with some sample code based on your
>solution (if tts not too much asking!). Im a bit confused as to
>the changes you proposed in A.cgi or/and mod.pm.
Or in "lib.pl". It's probably a lot easier.
Put this at the start of "lib.pl":
package main;
Now al definitions will be in package main, no matter where you first
load it from. You can access a variable from it as
$main::var
or as
$::var
and a sub as
main::func()
or
::func()
when called from code not in main, e.g. in the module package(s).
Sample script:
package main;
sub test {
print "ok!\n";
}
$var = 'boo';
package Foo::Bar;
::test();
print $::var;
Alternatively, put your library in another package, and call those with
fully qualified names. A bit more typing, but very clear.
lib.pl:
package Custom;
$var = "something";
sub action {
print "\$var = \"$var\"\n";
}
A.cgi and mod.pm:
print $Custom::var;
Custom::action();
--
Bart.
------------------------------
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 3468
**************************************