[25276] in Perl-Users-Digest
Perl-Users Digest, Issue: 7521 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 15 11:05:36 2004
Date: Wed, 15 Dec 2004 08:05:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 15 Dec 2004 Volume: 10 Number: 7521
Today's topics:
Re: (quickie) (Aliasing) Possible to get this to work i <bik.mido@tiscalinet.it>
Extracting part of strings? <_karlo_@_mosor.net_>
Re: Extracting part of strings? <jurgenex@hotmail.com>
Re: Extracting part of strings? <_karlo_@_mosor.net_>
Re: Extracting part of strings? <do-not-use@invalid.net>
Re: Extracting part of strings? <jurgenex@hotmail.com>
Re: Extracting part of strings? <do-not-use@invalid.net>
Follow-up:go to a link, save the page and email it out? <zhangd@tycoelectronics.com>
Re: having trouble with control structures <toreau@gmail.com>
Re: having trouble with control structures <toreau@gmail.com>
Re: How to do this job? <bik.mido@tiscalinet.it>
Re: How to do this job? <bik.mido@tiscalinet.it>
Re: How to do this job? <thepoet_nospam@arcor.de>
Re: OS/2 port of Perl 5.8 not adding CR to \n <tester@nospam.microrev.net>
Pattern Matching <nospam@nospam.com>
Re: Pattern Matching (Anno Siegel)
Re: Pattern Matching <nospam@nospam.com>
Re: Pattern Matching <nospam@nospam.com>
Re: Pattern Matching <fabels@yahoo.com>
Re: Pattern Matching <do-not-use@invalid.net>
Re: Pattern Matching <nospam@nospam.com>
Re: Pattern Matching <nospam@nospam.com>
Re: Pattern Matching <jurgenex@hotmail.com>
Re: Requiring perl scripts <tadmc@augustmail.com>
Re: Requiring perl scripts <shawn.corey@sympatico.ca>
Re: Restricted Subsets of Perl (Anno Siegel)
Script path (Mitchell Hulscher)
Re: Script path <nospam@nospam.com>
Re: Script path (Mitchell Hulscher)
Re: socket script dies <bik.mido@tiscalinet.it>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 15 Dec 2004 14:29:02 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: (quickie) (Aliasing) Possible to get this to work in strict?
Message-Id: <9id0s0h969n3rrijvaiabk91np4btm8lbn@4ax.com>
On Tue, 14 Dec 2004 09:54:16 +0100, "Tassilo v. Parseval"
<tassilo.von.parseval@rwth-aachen.de> wrote:
>You can circumvent that by pre-declaring $r using our() or 'use vars':
>
> use strict;
>
> our $r; # pre-5.6.0 perls: use vars qw/$r/;
> my $n = 5;
>
> *r = \$n;
> $r++;
> print "$n - $r\n";
> __END__
> 6 - 6
Speaking of which, may I ask you to give an explanation of how this
works internally? (Just curious...)
What I mean is that we all know that Perl5 has basically two
fundamentally orthogonal variable systems. And we know we can access
directly a package's symbol table, but AFAIK we can't do the same with
lexical variables, even though there "MUST" be one, and given the
orthogonality hinted to above, it is somewhat surprising that such an
aliasing can even be done. Oh, and of course on lexical scope exit it
will "downgrade" to a simple copy, won't it? (Just tried, and AFAICT
it is indeed so).
Incidentally Perl6's planned solution to the variables' nature
dichotomy by means of an inner layer of magic, namely that provided by
the MY package, IMHO is very appealing, and I wonder wether it may
eventually leak in some future Perl5 release...
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 15 Dec 2004 15:05:52 GMT
From: Karlo Lozovina <_karlo_@_mosor.net_>
Subject: Extracting part of strings?
Message-Id: <Xns95C0A3E02A508karlomosornet@130.133.1.4>
Hi folks! Perl newbie in need of assistance :). I've got array
@dir_list, with bunch of entries like "/home/something/else" and I
want to extract the last part, that is "else".
I did it like this:
for($i = 0 ; $i <= $#dir_list ; $i++) {
@tmp_fields = split /\//, "$dir_list[$i]";
$dirnames[$i] = $tmp_fields[$#tmp_fields];
}
Since I'm an extreme Perl newbie (started learning it this afternoon
:>), I'm just wondering is there a better, or more standard way of
doing stuff like this?
--
_______ Karlo Lozovina - Mosor
| | |.-----.-----.
| || _ | _ | Na osami blizu mora, dok se sunce zemlji smije
|__|_|__||_____|_____| Balun gledat, za njin letit...
------------------------------
Date: Wed, 15 Dec 2004 15:12:14 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Extracting part of strings?
Message-Id: <ivYvd.7200$E_6.6229@trnddc04>
Karlo Lozovina wrote:
> Hi folks! Perl newbie in need of assistance :). I've got array
> @dir_list, with bunch of entries like "/home/something/else" and I
> want to extract the last part, that is "else".
>
> I did it like this:
>
> for($i = 0 ; $i <= $#dir_list ; $i++) {
> @tmp_fields = split /\//, "$dir_list[$i]";
> $dirnames[$i] = $tmp_fields[$#tmp_fields];
> }
>
> Since I'm an extreme Perl newbie (started learning it this afternoon
>>> ), I'm just wondering is there a better, or more standard way of
>>> doing stuff like this?
Yep, there is. The perlish way of doing it would be to use the function
basename() from the module File::Basename. Further information see 'perldoc
File::Basename'.
jue
------------------------------
Date: 15 Dec 2004 15:27:32 GMT
From: Karlo Lozovina <_karlo_@_mosor.net_>
Subject: Re: Extracting part of strings?
Message-Id: <Xns95C0A78C5DB2karlomosornet@130.133.1.4>
"Jürgen Exner" <jurgenex@hotmail.com> wrote in
news:ivYvd.7200$E_6.6229@trnddc04:
> Yep, there is. The perlish way of doing it would be to use the
> function basename() from the module File::Basename. Further
> information see 'perldoc File::Basename'.
Wow, wish I knew that an hour ago :). Thanks a lot, this will make my
life lot easier :).
--
_______ Karlo Lozovina - Mosor
| | |.-----.-----.
| || _ | _ | Na osami blizu mora, dok se sunce zemlji smije
|__|_|__||_____|_____| Balun gledat, za njin letit...
------------------------------
Date: 15 Dec 2004 16:42:22 +0100
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: Extracting part of strings?
Message-Id: <yzdis73lg9t.fsf@invalid.net>
Karlo Lozovina <_karlo_@_mosor.net_> writes:
> "Jürgen Exner" <jurgenex@hotmail.com> wrote in
> news:ivYvd.7200$E_6.6229@trnddc04:
>
> > Yep, there is. The perlish way of doing it would be to use the
> > function basename() from the module File::Basename. Further
> > information see 'perldoc File::Basename'.
>
> Wow, wish I knew that an hour ago :). Thanks a lot, this will make my
> life lot easier :).
For doing it with only Perl primitives, look up 'map' and regular
expressions.
------------------------------
Date: Wed, 15 Dec 2004 15:57:39 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Extracting part of strings?
Message-Id: <T9Zvd.5915$mn6.85@trnddc07>
Arndt Jonasson wrote:
> Karlo Lozovina <_karlo_@_mosor.net_> writes:
>> "Jürgen Exner" <jurgenex@hotmail.com> wrote in
>> news:ivYvd.7200$E_6.6229@trnddc04:
>>
>>> Yep, there is. The perlish way of doing it would be to use the
>>> function basename() from the module File::Basename. Further
>>> information see 'perldoc File::Basename'.
>>
>> Wow, wish I knew that an hour ago :). Thanks a lot, this will make my
>> life lot easier :).
>
> For doing it with only Perl primitives, look up 'map' and regular
> expressions.
Would be interesting to see how you parse file paths in a portable way using
only REs....
jue
------------------------------
Date: 15 Dec 2004 17:04:51 +0100
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: Extracting part of strings?
Message-Id: <yzdacsflf8c.fsf@invalid.net>
"Jürgen Exner" <jurgenex@hotmail.com> writes:
> Arndt Jonasson wrote:
> > Karlo Lozovina <_karlo_@_mosor.net_> writes:
> >> "Jürgen Exner" <jurgenex@hotmail.com> wrote in
> >> news:ivYvd.7200$E_6.6229@trnddc04:
> >>
> >>> Yep, there is. The perlish way of doing it would be to use the
> >>> function basename() from the module File::Basename. Further
> >>> information see 'perldoc File::Basename'.
> >>
> >> Wow, wish I knew that an hour ago :). Thanks a lot, this will make my
> >> life lot easier :).
> >
> > For doing it with only Perl primitives, look up 'map' and regular
> > expressions.
>
> Would be interesting to see how you parse file paths in a portable way using
> only REs....
If the key word is "portable", I would probably look for an existing
implementation of pathname-handling functions. Knowing about 'map'
and regular expressions is still interesting, if you want to write any
Perl code yourself.
------------------------------
Date: 15 Dec 2004 07:30:01 -0800
From: "dale" <zhangd@tycoelectronics.com>
Subject: Follow-up:go to a link, save the page and email it out?
Message-Id: <1103124601.754502.108520@c13g2000cwb.googlegroups.com>
Based on some suggestions, I tried the simple one - HTML::Mail.
HTML::Mail works for some web sites. THe results are:
C:\Perl\scripts>mailp.pl
Error while making request [ GET
http://www.macom.com/Images/darkblue_bgcolor.gi
f]
404 Object Not Found at C:/Perl/lib/HTML/Mail.pm line 167.
C:\Perl\scripts>
However, if I use IE to open www.macom.com, I can save the page with
all images. Any suggestions?
my scripts are :
use HTML::Mail;
### initialisation
my $html_mail = HTML::Mail->new(
HTML => 'http://www.macom.com',
>From => 'dalewz@yahoo.com',
To => 'dalewz@yahoo.com, daledale66@yahoo.com',
Subject => 'Alert page');
### Send the email ("inherited" from MIME::Lite)
# $html_mail->send();
$html_mail->send('smtp','outgoing.verizon.net');
#### Remove text representation
$html_mail->set_Text();
### Rebuild the message and send
$html_mail->build->send;
### Serialise to file for later reuse
$html_mail->dump_file('c:/html_mail.data');
### Restore from file
my $restored = HTML::Mail->restore_file('c:/html_mail.data');
Thanks a lot. -Dale
------------------------------
Date: Wed, 15 Dec 2004 16:02:10 +0100
From: Tore Aursand <toreau@gmail.com>
Subject: Re: having trouble with control structures
Message-Id: <pan.2004.12.15.15.02.10.88474@gmail.com>
On Fri, 10 Dec 2004 21:07:45 +0100, M. Duijkers wrote:
> #!perl -w
> do
> {
> print "Enter filename or QUIT to stop: ";
> $filename = <STDIN>;
> chomp $filename;
> if ($filename ne "QUIT")
> {
> if (! -e $filename)
> {
> print "file does not exist\n";
> last;
> }
> if (-r $filename)
> {
> print "file is readable \n";
> }
> else
> {
> print "file is NOT readable \n";
> }
> if (-w $filename)
> {
> print "file is writeable\n";
> }
> else
> {
> print "file is NOT writeable \n";
> }
> if (-x $filename)
> {
> print "file is executable\n";
> }
> else
> {
> print "file is NOT excecuteable \n";
> }
> }
> else
> {
> exit 0;
> }
> }while ($filename ne "QUIT")
Here is my suggestion for a solution;
#!/usr/bin/perl
#
use strict;
use warnings;
while ( <DATA> ) {
chomp;
last if ( $_ eq 'QUIT' );
if ( -e ) {
my %status = ('readable' => -r,
'writeable' => -w,
'executable' => -x);
my @status = map { ( $status{$_} ) ? $_ : 'NOT ' . $_ } keys %status;
print "'$_' is " . join( ', ', @status ) . "\n";
}
else {
print "'$_' doesn't exist!\n";
}
}
--
Tore Aursand <toreau@gmail.com>
"First, God created idiots. That was just for practice. Then He created
school boards." (Mark Twain)
------------------------------
Date: Wed, 15 Dec 2004 16:16:22 +0100
From: Tore Aursand <toreau@gmail.com>
Subject: Re: having trouble with control structures
Message-Id: <pan.2004.12.15.15.16.20.850927@gmail.com>
On Wed, 15 Dec 2004 16:02:10 +0100, Tore Aursand wrote:
> while ( <DATA> ) {
Should have been <STDIN> instead of <DATA>, of course; I tested it with a
list of filenames in the __DATA__ section of my Perl script.
--
Tore Aursand <toreau@gmail.com>
"Writing is a lot like sex. At first you do it because you like it.
Then you find yourself doing it for a few close friends and people you
like. But if you're any good at all, you end up doing it for money."
(Unknown)
------------------------------
Date: Wed, 15 Dec 2004 14:29:00 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: How to do this job?
Message-Id: <olc0s01o1jf6g19a9k5duqq7kudfddorrv@4ax.com>
On Tue, 14 Dec 2004 14:14:25 +0800, "news.hinet.net"
<sonet.all@msa.hinet.net> wrote:
>Direcory:
>/usr/local/ap/
>Filename:
> 1
> 1.lock
> 2
> 3
> 4
> 4.lock
>
>want to list 2 and 3.
Quite a generic description, isn't it?
>========================================================
>opendir(DIR,"/usr/local/ap/");
>@dots = grep {-f "/usr/local/ap/$_" && $_ !~m/\.lock/} readdir(DIR);
I guess you may want /\.lock$/, just to be sure...
>close(DIR);
>========================================================
>The @dots have 1 2 3 4 elements. I know i can use -e to check the
>$filename.lock in loop.
>But how to make @dots just have 2 and 3? Becaues the directory have
>many files,i don't want to worse time to check the $filename.lock .
>please help!
You can use one more short-circuiting C<&&>, or C<and>; e.g.:
@dots = grep { !/\.lock$/ and -f "$dir/$_" and !-e "$dir/$_.lock" }
I moved the regex check to the front for system calls are generally
expensive. However I can give no guarantee that this will actually be
more efficient, but if you are really concerned about it (which IMHO
you shouldn't) then you can do some benchmark yourself.
As a side note there have been quite a few posts of this kind lately,
i.e. wrt reading a directory "manually" with readdir(): no real harm
done, but you may want to let perl help you with its own high level
glob() function instead:
@dots = grep { !/\.lock$/ and -f and !-e "$_.lock" } <path/*>;
This is not strictly equivalent to what you wrote, but it may be what
you're really after...
HTH,
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Wed, 15 Dec 2004 14:29:01 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: How to do this job?
Message-Id: <jad0s0h89fn33r88e7lt5epsv7d5d3ifjk@4ax.com>
On Tue, 14 Dec 2004 14:07:12 GMT, "Leon" <eon@hotmail.com> wrote:
>#!/usr/bin/perl
>use strict;
>use warnings;
As a side note: well done!
>opendir(DIR, "/usr/local/ap/");
>
># Grep statement additionally checks that the current file doesn't end with
>.lock AND that there isn't
># a .lock file. For instance, if current file was 1.lock then ! -e
>"/usr/local/ap/$_.lock" would have been
># checking for the existance of 1..lock.lock. Could get slightly confusing
>results.
As a side note, well written code should be self-explanatory and only
require minimal cmts. IMHO such verbose cmts do not add to the
readability of sources. As a side note to the side note, if really
needed you may want to give a peek into
perldoc -q 'large block'
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Wed, 15 Dec 2004 15:16:21 +0100
From: Christian Winter <thepoet_nospam@arcor.de>
Subject: Re: How to do this job?
Message-Id: <41c04735$0$16049$9b4e6d93@newsread4.arcor-online.net>
Leon wrote:
> "news.hinet.net" <sonet.all@msa.hinet.net> wrote in message
> news:cpm0cu$8kh$1@netnews.hinet.net...
>
>>Direcory:
>>/usr/local/ap/
>>Filename:
>> 1
>> 1.lock
>> 2
>> 3
>> 4
>> 4.lock
>>
>>want to list 2 and 3.
>
> #!/usr/bin/perl
> use strict;
> use warnings;
>
> opendir(DIR, "/usr/local/ap/");
>
> # Grep statement additionally checks that the current file doesn't end with
> .lock AND that there isn't
> # a .lock file. For instance, if current file was 1.lock then ! -e
> "/usr/local/ap/$_.lock" would have been
> # checking for the existance of 1..lock.lock. Could get slightly confusing
> results.
>
> my @dots = grep{-f "/usr/local/ap/$_" && $_ !~ m/\.lock$/ && ! -e
> "/usr/local/ap/$_.lock"}readdir(DIR);
> closedir(DIR);
>
> # This worked on my system:)
Could even be a little shorter:
-----------------------------------
#!/usr/bin/perl -w
use strict;
# chdir to the dir, so we don't need to retype all over:
chdir "/usr/local/ap";
my @dots = grep {
/^\d+$/ &! -e "$_.lock" && -f
} glob "*";
__END__
------------------------------------
But the OP asked to avoid additional testing with "-f", so
maybe he would preferr this one:
------------------------------------
#!/usr/bin/perl -w
use strict;
chdir "/usr/local/ap";
my @files = grep { -f } glob "*";
my %locks;
# some magic hash sliceism:
@locks{ grep { /\.lock$/ } @files } = ();
my @dots = grep {
/^\d+$/ &! exists $locks{$_}
} @files;
__END__
-------------------------------------
-Chris
------------------------------
Date: Wed, 15 Dec 2004 12:02:30 +0000
From: jp <tester@nospam.microrev.net>
Subject: Re: OS/2 port of Perl 5.8 not adding CR to \n
Message-Id: <R5qdnVYaHopKul3cRVnyhQ@eclipse.net.uk>
Shmuel (Seymour J.) Metz wrote:
> In <cgvs2t$2nst$1@agate.berkeley.edu>, on 08/30/2004
> at 06:36 PM, Ilya Zakharevich <nospam-abuse@ilyaz.org> said:
>
>
>>"Correct"???
>
>
> That is, I wanted to verify that the Perl at
> <http://www.cpan.org/authors/id/I/IL/ILYAZ/os2/582+/> is in fact the
> most recnt OS/2 port.
Perl builds on OS/2 straight out of the box (if you can manage to get
the environment set up correctly) so the currently most uptodate version
of Perl you can have it 5.8.6, but you'll have to build it yourself.
------------------------------
Date: Wed, 15 Dec 2004 09:51:41 -0500
From: "daniel kaplan" <nospam@nospam.com>
Subject: Pattern Matching
Message-Id: <1103122283.858781@nntp.acecape.com>
Is there any easy way to pattern match for names that might have an ' or a
`....you know, like O'Reilly, or someone might type it O`Neal. I would
think there would be some shortcut (i.e. \D, etc) already devised to make it
simpler.
Just unable to find one in any online tutlorial or book.
Thanks ahead,
DAniel
------------------------------
Date: 15 Dec 2004 14:57:36 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Pattern Matching
Message-Id: <cppjd0$pki$2@mamenchi.zrz.TU-Berlin.DE>
daniel kaplan <nospam@nospam.com> wrote in comp.lang.perl.misc:
> Is there any easy way to pattern match for names that might have an ' or a
> `....you know, like O'Reilly, or someone might type it O`Neal. I would
> think there would be some shortcut (i.e. \D, etc) already devised to make it
> simpler.
>
> Just unable to find one in any online tutlorial or book.
What's the problem? Neither "'" nor "`" are special in a regex.
Anno
------------------------------
Date: Wed, 15 Dec 2004 10:15:05 -0500
From: "daniel kaplan" <nospam@nospam.com>
Subject: Re: Pattern Matching
Message-Id: <1103123689.409900@nntp.acecape.com>
"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
news:cppjd0$pki$2@mamenchi.zrz.TU-Berlin.DE...
> What's the problem? Neither "'" nor "`" are special in a regex.
what i meant was, i have to take it beyond
=~ /\W/
as ' and ` will cause the above to be true...so as far as i can see, i have
to do a pattern match for every NON-word character, but leave out the ' and
the `.....so i thought there might be a shortcut....afterall, someone
realized that "_" does not belong in \W so was hoping there was another
shortcut for what i am looking for...
------------------------------
Date: Wed, 15 Dec 2004 10:24:50 -0500
From: "daniel kaplan" <nospam@nospam.com>
Subject: Re: Pattern Matching
Message-Id: <1103124461.378697@nntp.acecape.com>
"daniel kaplan" <nospam@nospam.com> wrote in message
news:1103123689.409900@nntp.acecape.com...
> what i meant was, i have to take it beyond
>
> =~ /\W/
i should have put this in....to me, this:
if( $last_name =~ /[0-9]|\s|[~!@\#$%^&*()_+{}|[]\:\";<>?,.\/]/ )
is just messy, and i keep thinking, what did I miss? so was hoping there
was a shortcut as I cannot be the first to encounter the fact that, "hey,
last names do have ' and ` sometimes
------------------------------
Date: Wed, 15 Dec 2004 18:03:04 +0100
From: frans abels <fabels@yahoo.com>
Subject: Re: Pattern Matching
Message-Id: <pan.2004.12.15.18.03.04.467939.444@yahoo.com>
On Wed, 15 Dec 2004 16:15:05 +0100, daniel kaplan wrote:
> "Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
> news:cppjd0$pki$2@mamenchi.zrz.TU-Berlin.DE...
>
>> What's the problem? Neither "'" nor "`" are special in a regex.
>
> what i meant was, i have to take it beyond
>
> =~ /\W/
It is pretty basic:
/['"]/ matches ' and "
/[^'"]/ matches everything but ' and "
/[\w'"]/ matches word-characters and ' and "
I hope that will help you.
------------------------------
Date: 15 Dec 2004 16:45:52 +0100
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: Pattern Matching
Message-Id: <yzdekhrlg3z.fsf@invalid.net>
"daniel kaplan" <nospam@nospam.com> writes:
> "daniel kaplan" <nospam@nospam.com> wrote in message
> news:1103123689.409900@nntp.acecape.com...
>
> > what i meant was, i have to take it beyond
> >
> > =~ /\W/
>
> i should have put this in....to me, this:
>
> if( $last_name =~ /[0-9]|\s|[~!@\#$%^&*()_+{}|[]\:\";<>?,.\/]/ )
>
> is just messy, and i keep thinking, what did I miss? so was hoping there
> was a shortcut as I cannot be the first to encounter the fact that, "hey,
> last names do have ' and ` sometimes
They have é and other non-ASCII characters too. If you write about
the South African San people, names can contain '!' characters. There
would be a need for different shortcuts at different times.
------------------------------
Date: Wed, 15 Dec 2004 10:46:30 -0500
From: "daniel kaplan" <nospam@nospam.com>
Subject: Re: Pattern Matching
Message-Id: <1103125574.119821@nntp.acecape.com>
"frans abels" <fabels@yahoo.com> wrote in message
news:pan.2004.12.15.18.03.04.467939.444@yahoo.com...
> /[\w'"]/ matches word-characters and ' and "
thanks, i was grabbing my left ear with my right hand by going all the way
around the top of my head
------------------------------
Date: Wed, 15 Dec 2004 10:53:13 -0500
From: "daniel kaplan" <nospam@nospam.com>
Subject: Re: Pattern Matching
Message-Id: <1103125977.703096@nntp.acecape.com>
"frans abels" <fabels@yahoo.com> wrote in message
news:pan.2004.12.15.18.03.04.467939.444@yahoo.com...
> /[\w'"]/ matches word-characters and ' and "
sorry answered to quick, still coming up short....i need to do the search
for anything that is NOT in the above
------------------------------
Date: Wed, 15 Dec 2004 15:59:16 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Pattern Matching
Message-Id: <obZvd.5916$mn6.1824@trnddc07>
daniel kaplan wrote:
> "frans abels" <fabels@yahoo.com> wrote in message
> news:pan.2004.12.15.18.03.04.467939.444@yahoo.com...
>
>> /[\w'"]/ matches word-characters and ' and "
>
> sorry answered to quick, still coming up short....i need to do the
> search for anything that is NOT in the above
Sorry for asking the obvious, but if this is so, then why don't you simply
negate the character class?
jue
------------------------------
Date: Wed, 15 Dec 2004 08:28:22 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Requiring perl scripts
Message-Id: <slrncs0ig6.1kn.tadmc@magna.augustmail.com>
Bigus <> wrote:
> If I do a "require login.cgi" in application.cgi will
> it just make the subroutines available or will it attempt to run all the
> code in login.cgi before the subroutines?
What happened when you tried it?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 15 Dec 2004 10:19:05 -0500
From: Shawn Corey <shawn.corey@sympatico.ca>
Subject: Re: Requiring perl scripts
Message-Id: <6BYvd.11571$%p1.1142350@news20.bellglobal.com>
Tad McClellan wrote:
> Bigus <> wrote:
>
>>If I do a "require login.cgi" in application.cgi will
>>it just make the subroutines available or will it attempt to run all the
>>code in login.cgi before the subroutines?
>
> What happened when you tried it?
It will die unless it returns a Perl True value. Since the only way a
required file to do this is for it to run the non-subroutine code, it
will run the non-subroutine code.
--- Shawn
------------------------------
Date: 15 Dec 2004 13:16:56 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Restricted Subsets of Perl
Message-Id: <cppdg8$pki$1@mamenchi.zrz.TU-Berlin.DE>
Andy Glew <andy.glew@intel.com> wrote in comp.lang.perl.misc:
> Andy Glew <andy.glew@intel.com> writes:
>
> > Q: are there any ways to restrict a bit of Perl code to a restricted
> > subset, a sandbox, of Perl - apart from taint?
> >
> > Perfunctory googling doesn't seem to find any package like
> > this, but I may not be using the right terminology.
>
> Embarassed. Slightly less perfunctory googling led me to the Safe
> package. It's what I need.
>
> However, my pondering how to implement this via reflection may still
> be worth discussing. If there were a standard query format, allowing
> us to enumerate all language elements and identifying what they do,
> it might allow more flexible Safe'ing.
Alternatively, one could consider a Parse::RecDescent grammar for an
appropriate subset of Perl. It would only have to recognize the
subset, interpretation would still be done by eval(), so the grammar
could be kept simple, it doesn't have to *do* anything.
The grammar below allows only assignment of arithmetic expressions
to scalars. So it allows "$deg = 2 * $pi / 360;", but rejects
"unlink '/etc/passwd';", as it should. It is incomplete (no unary
"-") and too simple to be practically useful, but it shows that the
approach is feasible.
Anno
my $grammar = << 'EOG';
confex: variable '=' expr ';' # start rule
expr: term add_op expr
expr: term
term: factor mult_op term
term: factor
factor: '(' expr ')'
factor: constant
factor: variable
constant: string
constant: number
add_op: /[+-]/
mult_op: m{[*/]}
string: /".*"/
number: /-?\d+/
variable: /\$[A-Za-z_]\w*/
EOG
------------------------------
Date: 15 Dec 2004 14:38:33 GMT
From: unacceptable@gmail.com (Mitchell Hulscher)
Subject: Script path
Message-Id: <41c04c69$0$23273$ba620dc5@nova.planet.nl>
Hey all,
I was wondering if there is a way to return the current file path
of the active script to a scalar.
All help is appreciated.
Thanks,
Mitch.
----------------------------------------------
Posted with NewsLeecher v2.0 RC2
* Binary Usenet Leeching Made Easy
* http://www.newsleecher.com/?usenet
----------------------------------------------
------------------------------
Date: Wed, 15 Dec 2004 09:58:59 -0500
From: "daniel kaplan" <nospam@nospam.com>
Subject: Re: Script path
Message-Id: <1103122722.661882@nntp.acecape.com>
"Mitchell Hulscher" <unacceptable@gmail.com> wrote in message
news:41c04c69$0$23273$ba620dc5@nova.planet.nl...
> Hey all,
>
> I was wondering if there is a way to return the current file path
> of the active script to a scalar.
> All help is appreciated.
perldoc FindBin
------------------------------
Date: 15 Dec 2004 15:34:15 GMT
From: unacceptable@gmail.com (Mitchell Hulscher)
Subject: Re: Script path
Message-Id: <41c05977$0$23272$ba620dc5@nova.planet.nl>
> perldoc FindBin
Thanks a lot.
Mitch.
----------------------------------------------
Posted with NewsLeecher v2.0 RC2
* Binary Usenet Leeching Made Easy
* http://www.newsleecher.com/?usenet
----------------------------------------------
------------------------------
Date: Wed, 15 Dec 2004 14:28:59 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: socket script dies
Message-Id: <6cgur05s14gcm75h1it0mdcig4anp6utcu@4ax.com>
On Mon, 13 Dec 2004 23:34:47 GMT, Larry <dontmewithme@got.it> wrote:
>I also tried with this:
>
>foreach $var (sort(keys(%SIG))) {
>$val = $SIG{$var};
>${var}='IGNORE';
>}
>
>but it didn't work...
Please as a general rule quote some relevant context for reference.
>I'M HAD!
"HAD"?!?
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 7521
***************************************