[11223] in Perl-Users-Digest
Perl-Users Digest, Issue: 4823 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 4 09:07:19 1999
Date: Thu, 4 Feb 99 06:00:24 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 4 Feb 1999 Volume: 8 Number: 4823
Today's topics:
$reponse->content(); <mwatkins@promotion4free.com>
$SIG{'__DIE__'} and filecopying <neil@mve.com>
Re: alternative perl NG for newbies? (Tad McClellan)
Re: Are sub-second timers possible in Perl? (Tad McClellan)
DB_File untie gotcha bit me! (Bob Wilkinson)
DBI + ODBC + MS Access <andrewf@beausys.demon.co.uk>
Re: free PERL (Bart Lateur)
Generating Web graphics files using PERL? (Henry Penninkilampi)
libwww-perl and use strict (Marcus Tettmar)
Re: locking/linking files - HELP (Randal L. Schwartz)
mkdir problems <einar.gudmundsson@realtime.co.uk>
Re: mkdir problems <mwatkins@promotion4free.com>
my $response = $ua->request ($req); <mwatkins@promotion4free.com>
Net::Telnet won't launch script <stackhou@sgi.com>
Perl programmers wanted (John Day)
Perl search string problem lamj@softhome.net
Re: Perl search string problem (brian d foy)
Re: Perl search string problem (Bart Lateur)
perl/access/unix help <annao@cancerbacup.org>
PerlCtrl Syntax Errors <gleman@metagenix.com>
Re: Seek to the end of file with Fcntl? <jhi@alpha.hut.fi>
sending an attached file with Sendmail? <r2-d2@REMOVEbigfoot.com>
Simple sort required. bazza2000@yahoo.com
Re: Sorting with Matts simple search script? (Tad McClellan)
SPARC SOLARIS 2.5.1 PERL executables <leo.alexandropoulos@ericsson.com>
Statistics & Perl <rjardin@golfway.com>
Re: testing for scalar/list/array (Randal L. Schwartz)
Re: testing for scalar/list/array (Bart Lateur)
Re: Timer (Tad McClellan)
Re: Unlink Symlink <r2-d2@REMOVEbigfoot.com>
Windoze Dial up networking with PERL <gary@altmedia.freeserve.co.uk>
Re: Windoze Dial up networking with PERL ursa@ici.net
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 4 Feb 1999 12:14:24 -0000
From: "Mike Watkins" <mwatkins@promotion4free.com>
Subject: $reponse->content();
Message-Id: <uXNWcgDU#GA.218@nih2naac.prod2.compuserve.com>
Hi there,
I'm building a URL submission script. The actual submission works fine, but
I'm having a little trouble verifying the submission. Here's the 5 lines of
code I use:
my $req = new HTTP::Request POST => $action;
$req->content_type('application/x-www-form-urlencoded');
$req->content($query);
my $response = $ua->request ($req);
$HTML = $response->content();
$scode = $response->code();
Like I said before, the actual submission works perfectly. However, the
response I get isn't what I want. For the server code ($scode), I get 302
(RC_MOVED_TEMPORARILY), and for the content ($HTML), I get a blank page.
I finally figured out this was because the FFA page doesn't give out any
actual output, instead it redirects the user. I was wondering, is there
anyway to make this work so the content ($HTML), is the page which the
script redirects the use to?
Any ideas?
Miek
------------------------------
Date: Thu, 04 Feb 1999 13:02:16 +0000
From: Neil Salter <neil@mve.com>
Subject: $SIG{'__DIE__'} and filecopying
Message-Id: <36B99A58.7CF9A300@mve.com>
Hello,
I'm a perl newbie, and would appreciate any help with a frustrating
problem I've been having. I'm trying to do something relatively
simple...
I'm trying to write a script which will assemble a directory tree.
If anything goes wrong at any point during the assembly,
I want the script to remove the half-assembled tree before it
dies.
I've set a $SIG{'__DIE__'} handler to cater for this (I've found
a lengthy thread on DejaNews discussing the problems with this
being called in non-fatal situations during eval{...}. I still can't
get it working :-( ).
I've put the 'main' code below, with the relevant subroutines.
(Please excuse any daft looking stuff, I'm new to perl...)
# If anything goes wrong during the run, we want to remove
# any (currently-incomplete) distribution that's being built.
$halfBakedDistribution=undef;
$SIG{'__DIE__'}=\&removeHalfBakedDistribution;
$SIG{'INT'}=\&removeHalfBakedDistribution;
$SIG{'QUIT'}=\&removeHalfBakedDistribution;
# Call the function to do the work
makeGenericDistribution();
sub makeGenericDistribution()
{
# mkdir relevant direcrtories, etc.
<snip>
# In case anything goes wrong...
$halfBakedDistribution=$generic_distribution_root;
# mkdir more relevant directories...
<snip>
@appdeffiles=qw(all the app def files);
foreach $appdeffile (@appdeffiles){
copyFileVerbose("app-defaults/$appdeffile","${appdefdir}",0644) || die("Could not copy file.\n");
}
<snip>
$halfBakedDistribution=undef;
}
# die/problem handler...
sub removeHalfBakedDistribution()
{
# You can arrange for a callback to be called just before the die()
# does its deed, by setting the $SIG{__DIE__} hook. The associated
# handler will be called with the error text and can change the
# error message, if it sees fit, by calling die() again. See the
# section on $SIG{expr} in the perlvar manpage for details on
# setting %SIG entries, and the section on eval BLOCK for some
# examples.
#
# Note that the $SIG{__DIE__} hook is called even inside eval()ed
# blocks/strings. If one wants the hook to do nothing in such
# situations, put
#
# die @_ if $^S;
#
# as the first line of the handler (see the section on $^S in the
# perlvar manpage).
# If we're in an eval{...}, be cool honeybunny
die @_ if $^S;
# Temp debug code...
if($^S){
print("\$^S is true\n");
}elsif(!$^S){
print("\$^S is false\n");
}else{
print("\$^S is dunno\n");
}
# ...Temp debug code
# Something's gone wrong...
if($halfBakedDistribution!=undef){
use File::Path;
print("Aborting:@_\n. Removing half-baked $halfBakedDistribution for safety...\n");
rmtree($halfBakedDistribution) || warn("*** WARNING: COULD NOT REMOVE (INCOMPLETE) $halfBakedDistribution");
}
}
The copyFileVerbose routine is in another file, and is brought
in using 'require'...
sub copyFileVerbose()
{
<snip>
$source=$_[0];
<snip>
use File::Basename;
$sourcebase=basename($source);
$destination=$_[1];
if( -d $destination ){
$destination="${destination}/${sourcebase}";
}
print("\tCopying $source to $destination\n");
use File::Copy;
if(!copy($source,$destination)){
warn("*** Copy failed");
return 0;
}
<snip>
return 1;
}
When I run the script, I find that die handler is called for every file
copied. Stack trace...
$ = main::removeHalfBakedDistribution('Not a GLOB reference at /usr/freeware/lib/perl5/FileHandle.pm line 256.^J') called from file `/usr/freeware/lib/perl5/FileHandle.pm' line 256
$ = FileHandle::DESTROY('FileHandle=FILEHANDLE(0x100fe898)') called from file `/usr/freeware/lib/perl5/perl5db.pl' line 879
$ = eval {...} called from file `/usr/freeware/lib/perl5/perl5db.pl' line 879
$ = main::copyFileVerbose('app-defaults/3DMove', 'distribution/SGI.OPT/3DMovemain/app-defaults/3DMove', 420) called from file `./distribution.pl' line 78
$ = main::makeGenericDistribution() called from file `./distribution.pl' line 35
...and even though this is in an eval{}, my handler continues...
it seems that $^S is false (it prints this out).
I have 3 questions just now...
1. Why is File::Copy's copy() throwing an exception anyway?
2. Given that it's throwing an exception, which seems to be
in an eval from perl5db.pl, why is $^S not true in
the die handler?
3. When in the die handler, I can print out the value of
$halfBakedDistribution, and it's definitely not undef.
Yet, it doesn't remove the tree.
I hope I've not done anything really stupid. Am I missing something
obvious?
Any help would be much appreciated.
Thanks in advance,
Neil.
------------------------------
Date: Thu, 4 Feb 1999 05:59:43 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: alternative perl NG for newbies?
Message-Id: <f32c97.v85.ln@magna.metronet.com>
Eric The Read (emschwar@mail.uccs.edu) wrote:
: Andrew Fry <andrewf@beausys.demon.co.uk> writes:
[snip]
: Utter nonsense or no, did you really have to quote 159 lines of text to
: add that little gem of wisdom?
: Sheesh.
I noted that too.
I was actually reading his posts, because everyone deserves
their say.
But I felt compelled to plonk him after seeing his wanton disregard
for other peoples resources displayed so baldly.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 4 Feb 1999 05:48:58 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Are sub-second timers possible in Perl?
Message-Id: <af1c97.v85.ln@magna.metronet.com>
Jeffrey Davey (Jeffrey_Davey-P93404@email.mot.com) wrote:
: Can anyone out there help? I've scanned the FAQ questions, but haven't
: found much helpful info yet.
Do you mean that you didn't see the FAQ below, or that you did
see it and that it doesn't help you?
Perl FAQ, part 8:
"How can I measure time under a second?"
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 04 Feb 1999 10:16:11 +0100
From: b.wilkinson@pindar.com (Bob Wilkinson)
Subject: DB_File untie gotcha bit me!
Message-Id: <b.wilkinson-0402991016110001@193.123.165.57>
I have a problem with the following code. I've tried to abstract the
locking functionality for DBM files ((recipe 14.5 from the cookbook pp.497)
or (perldoc DB_File)) into subroutines so that I can call them from a program.
I have read perldoc perltie especially with respect to the untie gotcha,
however, I'm still being bitten by the
untie attempted while 1 inner references still exist
message when I untie the hash in the cleanupDB sub.
I guess that it may be related to the fact that I'm dup'ing the file handle?
But I don't know how to make the error disappear.
This error only appears when I tie a writable hash (using the sub tie_or_die),
and not the one when I tie a read-only hash (using read_tie_or_die).
Bob
------------------------------------------------------------------------------
package lockDB;
require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(tie_or_die read_tie_or_die cleanupDB);
#
use Fcntl qw(:DEFAULT :flock);
use DB_File;
use IO::File;
use diagnostics;
use strict;
#
sub tie_or_die {
my $HashRef = shift;
my $FileName = shift;
my $db = tie (%$HashRef, "DB_File", $FileName, O_CREAT|O_RDWR,
0644, $DB_HASH)
or die "Can't Read/Write $FileName, $!";
my $fd = $db->fd;
print STDERR "$$: db fd is $fd\n";
my $fh = new IO::File "+<&=$fd";
print STDERR "r/w: dup $!" unless ($fh);
while (!(flock ($fh, LOCK_EX | LOCK_NB))) {
print STDERR "$$: CONTENTION; must have exclusive lock!
Waiting for write lock ($!) ....";
# unless (flock (DB_FH, LOCK_EX)) { die "flock: $!" }
}
($db,$fh);
}
sub read_tie_or_die {
my $HashRef = shift;
my $FileName = shift;
my $db = tie (%$HashRef, "DB_File", $FileName, O_RDONLY, 0444, $DB_HASH)
or die "Can't Read From $FileName, $!";
my $fd = $db->fd;
print STDERR "$$: db fd is $fd\n";
my $fh = new IO::File "<&=$fd";
print STDERR "read: dup $!" unless ($fh);
while (!(flock ($fh, LOCK_SH | LOCK_NB))) {
print STDERR "$$: CONTENTION; can't read during write update!
Waiting for read lock ($!) ....";
# unless (flock (DB_FH, LOCK_SH)) { die "flock: $!" }
}
($db,$fh);
}
sub cleanupDB {
my $HashRef = shift;
my $db = shift;
my $fh = shift;
$db->sync;
# sleep 10;
flock($fh, LOCK_UN);
undef $db;
close $fh;
undef $fh;
untie %$HashRef;
undef %$HashRef;
}
--
.sig file on holiday
------------------------------
Date: Thu, 4 Feb 1999 13:19:53 +0000
From: Andrew Fry <andrewf@beausys.demon.co.uk>
Subject: DBI + ODBC + MS Access
Message-Id: <lOg3XAA55Zu2Ewlt@beausys.demon.co.uk>
I am trying to use DBI + ODBC to read a small
MS Access database (file name: afdb1.mdb).
The connect statement looks like this:
$dbh = DBI->connect($dbdatasrc,$dbusername,$dbpassword);
...where...
$dbdatasrc = "DBI:ODBC:afdb1.mdb"
$dbusername = ""
$dbpassword = ""
However, I am getting the following error:
Error connecting to DBI:ODBC:afdb1.mdb: [911]
[] "[Microsoft][ODBC Driver Manager] Data source
name not found and no default driver specified
Any suggestions as to what I might be doing wrong ?
Note:
1. This is using (ActiveState's) ActivePerl build 509
+ DBI +DBD:ODBC packages.
2. I tried the full pathname of the file - makes no
difference.
---
Andrew Fry
"Time flies like an arrow. Fruit flies like a banana". (Groucho Marx).
------------------------------
Date: Thu, 04 Feb 1999 11:59:22 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: free PERL
Message-Id: <36ba8b66.3492570@news.skynet.be>
3dsmax wrote:
>free PERL examples and free downloads
>
>http://come.to/gamewire/
Result:
>THIS ACCOUNT HAS BEEN DELETED
>
>
>You have reached this page after typing an URL
>that was in conflict with our site policy.
>The account has been disconnected.
>
>Please don't complain to us about this single account anymore.
>The account has been disconnected and we have done
>everything we could to stop the abuse.
That was quick...
Bart.
------------------------------
Date: Fri, 05 Feb 1999 00:24:25 +1030
From: htp@dove.net.au (Henry Penninkilampi)
Subject: Generating Web graphics files using PERL?
Message-Id: <htp-0502990024260001@htp5500.metropolis.net.au>
Greetings!
I have designed a simple JavaScript image editor, the output of which I
would like to be able to save as an actual graphic file by way of a CGI
script.
The nature of the images produced is such that only the 216 web-safe
colours (on a static background) are needed. Animation, masking,
transparency... are not required.
I automatically thought of GIF, but due to the legal issues surrounding
that format, I hunted around a bit more and found a number of formats, the
most promising of which was PNG. The problems with PNG are that it is
'over-the-top' as far as features go, the (relatively enormous) codebase
is in C, and Navigator for Windows doesn't support it (or didn't, the last
time I looked).
The CGI script *needs* to be in platform-independent PERL (for portability
reasons), so I can't resort to calling pre-compiled binaries to generate
the image files. Server-side Java is, for that reason, not an option.
Likewise solutions which rely on plug-ins (the image is to be stored on
the server).
My question, then, is "Does anyone know of a simple, 8-bit colour image
format, accepted by Netscape Navigator 4+ (on, at least, MacOS, Windows,
Linux), which is not under legal dispute, and who's source code is either
available in PERL, or another language which can be freely ported?"
My knowledge base in this area is far from complete, so if you know of
another approach that can be used to get the same results (client creates
image, server stores image), then I'd appreciate you letting me know.
adTHANKSvance
Henry
------------------------------
Date: Thu, 04 Feb 1999 12:07:29 GMT
From: mtettmar@mjtnet.com (Marcus Tettmar)
Subject: libwww-perl and use strict
Message-Id: <36b98c6f.98176800@news.demon.co.uk>
Hi,
I'm new to perl. I have read the newsgroup faq. Quite ironic
actually, because in the faq it says to make sure to use 'use
strict;', but this is my problem :
I'm trying to install libwww-perl. I have the correct one for my
version of perl. When I do perl Makefile.PL I get the following
errors :
syntax error in file Makefile.PL at line 5, next 2 tokens "use strict"
syntax error in file Makefile.PL at line 20, next 2 tokens "getopts("
I guessed that maybe I don't have strict installed. But although it
is mentioned in the CPAN module list it doesn't seem to be available
for download anywhere, so maybe that's not the case.
Searched the newsgroups, read the FAQ, done everything the
instructions say. Perl works ok on my server as I have other scripts
running.
Can anyone be kind enough to help !? Probably just me.
------------------------------
Date: 04 Feb 1999 03:18:05 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: locking/linking files - HELP
Message-Id: <m1679i76z6.fsf@halfdome.holdit.com>
>>>>> "UUCP" == UUCP <UUCP@p1.f3.n500.z2.hccfido.hcc.nl> writes:
UUCP> open (FH, ">$file") or die "Can't open $file: $!;
Bye bye previous file.
UUCP> flock (FH, 2); #use exclusive lock on file
Oops. No point now, you've already clobbered it. :)
UUCP> #do stuff to file
UUCP> close FH;
UUCP> Note tho that for the lock to work, other programs accessing the file
UUCP> also have to honor flock.
And you have to use it in a way that makes sense. :)
The examples in the PCB show lots of detailed flocking examples, or
you can look at some simple ones on my WebTechniques pages at
<URL:http://www.stonehenge.com/merlyn/WebTechniques/>.
print "Just another Perl hacker,"
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Thu, 04 Feb 1999 11:17:54 +0000
From: Einar Gudmundsson <einar.gudmundsson@realtime.co.uk>
Subject: mkdir problems
Message-Id: <36B981E2.970C6C0A@realtime.co.uk>
Hi,
I'm having some problms using the perl built-in 'mkdir'
function. The function works allright, but creates directories
with very stange file permissions.
Here's an example
mkdir('test',0755) # Should cretae a test directory with drwxr-xr-x
however when I do a 'ls -l test' I get this:
d-wx--s--x 2 etg etg 1024 Feb 4 11:06 test
What am I missing?
How do I create a directory with these modes:
drwxr-xr-x (0755 Octal)
drwxrwxrwx (0777 Octal)
Thanks in advance
Einar
------------------------------
Date: Thu, 4 Feb 1999 12:08:43 -0000
From: "Mike Watkins" <mwatkins@promotion4free.com>
Subject: Re: mkdir problems
Message-Id: <uHM6QdDU#GA.282@nih2naac.prod2.compuserve.com>
Just try this:
mkdir ('test', 0755);
chmod (0755, 'test');
Einar Gudmundsson wrote in message <36B981E2.970C6C0A@realtime.co.uk>...
>Hi,
>
>I'm having some problms using the perl built-in 'mkdir'
>function. The function works allright, but creates directories
>with very stange file permissions.
------------------------------
Date: Thu, 4 Feb 1999 12:10:06 -0000
From: "Mike Watkins" <mwatkins@promotion4free.com>
Subject: my $response = $ua->request ($req);
Message-Id: <O$QnCeDU#GA.346@nih2naac.prod2.compuserve.com>
Hi there,
I'm building a URL submission script. The actual submission works perfectly
fine, but I'm having a little trouble with verifying that the submission
went through. Here's the 5 lines that I use:
------------------------------
Date: Thu, 04 Feb 1999 07:24:08 -0600
From: Mark Stackhouse <stackhou@sgi.com>
Subject: Net::Telnet won't launch script
Message-Id: <36B99F78.D3115D53@sgi.com>
I'm attempting to launch a script located on another server using the
module Net::Telnet. The module has been installed locally while I'm
waiting for our system admin to install it in /usr/share/lib/perl5/.
When I attempt to open a telnet session, nothing seems to happen. I
don't get any errors but my script doesn't launch either.
This is the script I'm using to call my remote script:
#!/usr/bin/perl -w
$username = "my_usr_id";
$passwd = "my_passwd";
chdir '/local/dir/where/Telnet_pm/is/located/lib/Net' || die "Can not cd
to Net: $!\n";
require Telnet;
$t = new Net::Telnet (Timeout => 10, Prompt => '/[remote_server\-\0-9\%
]*$/');
$t->open("remote_server");
$t->login($username, $passwd);
@lines = $t->cmd("/the/dir/where/my/script/resides/perl_apps_menu.pl");
print @lines;
The prompt on the remote server looks like this:
remote_server-23%
Would someone please point out what I'm doing wrong?
Thanks,
--
Mark Stackhouse
x62921 Bay ELS STCO (room 103) Riverside Systems
x64704 Voice Mail
*********************************************************
*
* Senior Electrical-Mechanical Technician
* Homepage - http://wwwcf.cray.com/~stackhou
* E-mail - stackhou@sgi.com
*
* Off site homepage - http://www.execpc.com/~stackhou
*
* Home E-mail - stackhou@execpc.com
*
* "The best things in life aren't things"
*
*********************************************************
------------------------------
Date: Thu, 04 Feb 1999 12:10:31 GMT
From: jday@vic.bigpond.net.au (John Day)
Subject: Perl programmers wanted
Message-Id: <36b98dce.462027400@203.29.210.32>
Hi,
I hope you dont mind, but I need to find some PERL programmers for
work I am doing in Australia.
Casual work for small marketing company with a nice idea and no time
to code it! Involves database work with MySQL on FreeBSD & Apache.
Interested? Where ever you are.....
email me!!
johnday@wordsnimages.com
------------------------------
Date: Thu, 04 Feb 1999 10:14:14 GMT
From: lamj@softhome.net
Subject: Perl search string problem
Message-Id: <79brtg$6jj$1@nnrp1.dejanews.com>
I am trying to find a way to find if there are any non number characters in a
string. Can anyone tell me the way to do it.
I have tried the following but without success
if ($abc =~ tr/\D//) {}
\D suppose to be same as [^0-9], the above statement would not find any non
numeric char in $abc.
Jason Lam
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 04 Feb 1999 06:14:37 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Perl search string problem
Message-Id: <comdog-ya02408000R0402990614370001@news.panix.com>
In article <79brtg$6jj$1@nnrp1.dejanews.com>, lamj@softhome.net posted:
> I am trying to find a way to find if there are any non number characters in a
> string. Can anyone tell me the way to do it.
>
> I have tried the following but without success
>
> if ($abc =~ tr/\D//) {}
i think you wanted the match operator:
$abc =~ m/\D/;
tr/// is a little different, and doesn't use character classes.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: Thu, 04 Feb 1999 11:23:06 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Perl search string problem
Message-Id: <36bb830a.1356317@news.skynet.be>
lamj@softhome.net wrote:
>I am trying to find a way to find if there are any non number characters in a
>string. Can anyone tell me the way to do it.
>
>I have tried the following but without success
>
>if ($abc =~ tr/\D//) {}
>
>\D suppose to be same as [^0-9], the above statement would not find any non
>numeric char in $abc.
Apparently, tr/// doesn't support character class metacharacters, as m//
and s/// do. I don't know why, it would make sense. ("\d"and "\w" don't
work either.)
Anyway. Do you want to see IF a string contains non-numeric characters,
or do your really want to count them?
If you only want to see if there's ANY at all, try
if ($abc =~ /\D/) { ...
but if you really want to count them, you could do
$count = ($abc =~ tr/0-9//c);
The "c" modifier complements (inverts) the character list provided.
HTH,
Bart.
------------------------------
Date: Thu, 04 Feb 1999 12:30:37 +0000
From: Anna Ollier <annao@cancerbacup.org>
Subject: perl/access/unix help
Message-Id: <36B992ED.DD7C2512@cancerbacup.org>
We are a cancer charity with a large-ish web site currently running on 2
hosts. One UNIX host which holds all static html pages and one NT host
which holds Access databases and VB scripts. We are looking at
consolidating the lot onto a UNIX or NT platform and rewriting the
scripts in Perl. However I hear that we will run into difficulties if
we we went for the Access/perl/unix option (current favourite) because
of getting perl to talk to access on unix (I am not a programmer so
forgive basic understanding). Questions are:
Is there a way to get the access/unix/perl combo working
What are the alternatives on a Unix platform (or NT)
Could we convert access dbases into unix perl friendly database? Which
would be?
Your help is very much appreciated.
Anna Ollier, Web Manager, CancerBACUP
------------------------------
Date: Thu, 04 Feb 1999 06:01:15 -0500
From: Greg Leman <gleman@metagenix.com>
Subject: PerlCtrl Syntax Errors
Message-Id: <36B97DFB.DB428B75@metagenix.com>
A dejanews search on "Perlctrl" doesn't seem to provide the answer to
the question of "Does PerlCtrl actually work?"
I've taken the example from the PRK, but when I run PerlCtrl.exe, it
just responds that there are syntax errors. Argh!
Is there any way to find out what these syntax errors are? How about at
least a line number? Does ActiveState have any plans to make this more
than just a toy?
------------------------------
Date: 04 Feb 1999 14:53:17 +0200
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
To: mkshanx@ust.hk
Subject: Re: Seek to the end of file with Fcntl?
Message-Id: <oeevhhiwcsi.fsf@alpha.hut.fi>
I wonder what man page you have been reading because Fcntl does
not have anything to do with seeking. It has to do with opening
(sysopen), locking (flock), and controlling (ioctl) files.
Not seeking.
You said:
'Solaris 2.4 which does not seem to support the flock'
'I need some help with "seek"ing to the EOF with Fcntl'
Please be much more detailed. What did you try? Exactly the
example at flock() man page? If so, what happened? What error
messages did you see? Did you have
or die "$!";
after each call to see what Solaris thought about your attempts?
--
$jhi++; # http://www.iki.fi/jhi/
# There is this special biologist word we use for 'stable'.
# It is 'dead'. -- Jack Cohen
------------------------------
Date: Thu, 4 Feb 1999 12:19:28 -0000
From: "Artoo" <r2-d2@REMOVEbigfoot.com>
Subject: sending an attached file with Sendmail?
Message-Id: <79c3df$kqd$1@plug.news.pipex.net>
Hi All
How can you send an attached file (text file) with sendmail and Perl?
Thanks
Artoo
------------------------------
Date: Thu, 04 Feb 1999 12:05:21 GMT
From: bazza2000@yahoo.com
Subject: Simple sort required.
Message-Id: <79c2dt$bee$1@nnrp1.dejanews.com>
Can someone please help with this simple sort routine. I'm new to perl and
don't know the dynamics behind the sort function. I've checked the FAQ's, but
they seem either to brief or too complex. For example none of them tell you
what the $a and $b variables actually translate to from the input etc etc.
Anyway here the problem, I have an array of entries as follows:-
@team_scores = { "name 1", 2 , "name 2", 5, "name 3" , 6} ;
I want to get a sort function to put them back into an array on using the even
positions in the array as the sort. i.e. 2, 5 and 6 to be sorted accendingly
leaving the following array
@team_scores = { "name 3", 6 , "name 2", 5, "name 1" , 2} ;
Anyone got any ideas,
Bazza
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 4 Feb 1999 06:56:42 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Sorting with Matts simple search script?
Message-Id: <ae5c97.2e5.ln@magna.metronet.com>
el_pollo_diablo (bencas@bigfoot.com) wrote:
: I'm not much of a perl programmer
I expect that you are not any kind of perl programmer.
I think you meant Perl programmer there.
Perl FAQ, part 1:
What's the difference between "perl" and "Perl"?
: but I'm trying to make matts simple search
: script
Matt is (or was?) not much of a Perl programmer either.
: (from www.worldwidemart.com) sort the outputted titles
: alphabetically.
: The actual piece of code to display the pages is this:
: foreach $key (keys %include) {
foreach $key (sort keys %include) {
: if ($include{$key} eq 'yes') {
: print "<li><a href=\"$baseurl$key\">$titles{$key}</a>\n";
: }
: I'm pretty sure the sort command goes in here somewhere but i'm at a loss.
: Perhaps one of you clever chappies could point me in the right direction.
The right direction is to take a stab at finding your answer
in Perl's standard documentation. It is nearly always
hundreds of times faster that posting to Usenet and waiting
hours, days, or forever...
perl is shipped with _hundreds_ of pages of documentation.
All of this information is already on your hard disk somewhere!
Find out where it is, and use it.
Properly configured perls also have a program included that
will find and display parts of the manuals for you.
See if this works on your system:
perldoc -f sort
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 04 Feb 1999 02:34:29 -0800
From: Ericsson User <leo.alexandropoulos@ericsson.com>
Subject: SPARC SOLARIS 2.5.1 PERL executables
Message-Id: <36B977B5.D09606F6@ericsson.com>
Hi all!
I am looking for one of the latest releases of Perl executable(s) for
SPARC Solaris 2.5.1..
It doesn't have to be the *very* latest, but it has to be an executable
- ready to use, 'cause the Workstation I plan to install it on, doesn't
have a C compiler - neither an Assembler, Loader, "make" etc etc. It
would be very tedious to start downloading/compiling/installing,
all of the above...
Many thanks!
Leo
mailto:leo.alexandropoulos@ericsson.com
------------------------------
Date: Thu, 04 Feb 1999 14:39:48 +0100
From: Ricardo Jardin <rjardin@golfway.com>
Subject: Statistics & Perl
Message-Id: <36B9A324.3A69E33E@golfway.com>
Hello,
I have two questions for you, and hopefully someone can help me with the
answers.
I created a log of statistics for each visit using Perl, the questions
are :
1. On the log, can I tell which picture the reader " click's " on ?
2. On the log also, can I tell which banner or image with Perl Script
that the
person clicks on ?
I do not want to use SSI pages or Cookies. If someone has answer, I
would appreciate it.
------------------------------
Date: 04 Feb 1999 03:10:41 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: testing for scalar/list/array
Message-Id: <m1aeyu77bi.fsf@halfdome.holdit.com>
>>>>> "Xah" == Xah <xah@best.com> writes:
Xah> Perl quiz:
Xah> suppose f is a function, and it returns one of the following:
Xah> * scalar. e.g. sub f() {return 3;};
Xah> * a list. e.g. sub f() {return (99,28,57);};
Xah> * an array. e.g. sub f() {my @a = (99,28,57); return @a;};
Xah> but you don't know which of these it returns.
Xah> What can I do to find out?
This is a non-question.
A function always returns a scalar in a scalar context, and a list in
a list context. There is no other way it works. To have asked your
question is to have misunderstood a fundamental feature of the Perl
subroutine calling sequence.
The last expression evaluated in the subroutine is evaluted in the
context of the caller. (1,2,3) is not a "list", it's the list 1,2,3
in a list context, and the value 3 (last item) in a scalar context.
@a is not an array when evaluated... it's the contents of the @a array
in a list context, and the number of items in that same array in
a scalar context.
Just as beauty lies in the eyes of the beholder, context lies in the
calling sequence of the invoker.
print "Just another Perl soundbite generator,"
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Thu, 04 Feb 1999 12:10:34 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: testing for scalar/list/array
Message-Id: <36bb8c37.3701890@news.skynet.be>
Randal L. Schwartz wrote:
> (1,2,3) is not a "list", it's the list 1,2,3
>in a list context, and the value 3 (last item) in a scalar context.
I think it's exactly this behaviour that makes Xah make the distinction
between a "list" (which acts like this, i.e. an array in list context
and the last item in scalar context) and an "array" (which behaves
differently: an array in list context and the count of items in scalar
context). It's more a matter of terminology, I think.
Until I tested, I wasn't sure what the next will do. The result is, huh,
"perlesk".
sub test {
@three = qw(a b c d);
return (1, 2, @three);
}
print scalar test();
Bart.
------------------------------
Date: Thu, 4 Feb 1999 07:03:49 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Timer
Message-Id: <lr5c97.2e5.ln@magna.metronet.com>
Kelvin Price (kprice@cardinal.co.nz) wrote:
: dkelly@emhain.wit.ie wrote:
: >
: > I am working on a Perl script that is running on a Unix system. I want to
: > have my script run automatically at a fixed time each day.
: >
: > I am not allowed to run it by use of the CRONTAB or BATCH facilities on the
: > Unix system. I need it to run through the use of Perl code.
: The alternative is to put a loop around your script and nohup
: <scriptname> &.
If the sysadmin doesn't allow using the fully vetted 'cron' approach
on their system, it is unlikely that they will allow some one-off
to run unchecked either.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 4 Feb 1999 12:22:18 -0000
From: "Artoo" <r2-d2@REMOVEbigfoot.com>
Subject: Re: Unlink Symlink
Message-Id: <79c3is$ku0$1@plug.news.pipex.net>
HI All
I was doing if (-e "$symliked_file"){unlink ($symlinked_file);}
For somereason it doesn't think it exists, if I just do unlink
($symlinked_file); it works fine.
Thanks
Artoo
>I've tryied using unlink ($symlink_path) and it does nothing, what function
>to I need to use?
------------------------------
Date: Thu, 4 Feb 1999 11:55:23 -0000
From: "gary robson" <gary@altmedia.freeserve.co.uk>
Subject: Windoze Dial up networking with PERL
Message-Id: <79c1sh$2hm$1@news7.svr.pol.co.uk>
I have a script (using libnet) for inspecting my pop3 e-mail account and
downloading e-mail with certain subjects for processing. While Windows
automatically dials up my ISP automatically when the script I can't find any
way of closing the Dial-up connection afterwards (somthing I need because
the script will be run hourly with a scheduler). Any help or advice
(especially with a small example, I still a PERL novice) would be greatly
appreciated.
Cheers
gary@altmedia.freeserve.co.uk
------------------------------
Date: Thu, 04 Feb 1999 08:38:09 +0000
From: ursa@ici.net
To: gary robson <gary@altmedia.freeserve.co.uk>
Subject: Re: Windoze Dial up networking with PERL
Message-Id: <36B95C71.6BC677D2@ici.net>
Gary Robson wrote:
> I have a script (using libnet) for inspecting my pop3 e-mail account and
> downloading e-mail with certain subjects for processing. While Windows
> automatically dials up my ISP automatically when the script I can't find any
> way of closing the Dial-up connection afterwards (somthing I need because
> the script will be run hourly with a scheduler). Any help or advice
> (especially with a small example, I still a PERL novice) would be greatly
> appreciated.
>
> Cheers
> gary@altmedia.freeserve.co.uk
Hi Gary,
No solution here but I seek the same little code snipplet!
I would really like to work the dial-up process and start, monitor AND
disconnect from my perl program. Maybee a post to a Visual Basic newsgroup would
help?
- Ursa
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 4823
**************************************