[19336] in Perl-Users-Digest
Perl-Users Digest, Issue: 1531 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 15 14:06:05 2001
Date: Wed, 15 Aug 2001 11:05:13 -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: <997898713-v10-i1531@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 15 Aug 2001 Volume: 10 Number: 1531
Today's topics:
accessing multiple hashes and regex <leary@foad.NOSPAM.org>
Re: accessing multiple hashes and regex (John J. Trammell)
Re: accessing multiple hashes and regex <mbudash@sonic.net>
Alphabetized list of perldoc documentation?? <miscellaneousemail@yahoo.com>
Re: Alphabetized list of perldoc documentation?? <randy@theoryx5.uwinnipeg.ca>
Re: Alphabetized list of perldoc documentation?? <miscellaneousemail@yahoo.com>
Any way of detecting running in eval? <lapplisa-no-spam@cotse.com>
Re: Any way of detecting running in eval? <uri@sysarch.com>
Re: array question... sort of <leary@foad.NOSPAM.org>
Re: behavior in a while loop (Tad McClellan)
Re: behavior in a while loop (djcabz)
Re: Can someone critique my code and point to better wa <samneric@tigerriverOMIT-THIS.com>
Re: Crypt::RSA, does that exist? I just want to decode (Anno Siegel)
Re: Evaluation order of object methods (Anno Siegel)
Re: Evaluation order of object methods (Anno Siegel)
FTP Problems with Perl (MartelLM)
Function prototype causing type error?? <miscellaneousemail@yahoo.com>
GnuPG::Tie::Encrypt Issue (Blixa Bargeld)
Re: help :) <yanoff@yahoo.com>
Help w/grep <jlm@cca-int.com>
Re: Help with an HTML parsing problem <jurgenex@hotmail.com>
Re: How could chomp the blanks of one sentence? <iltzu@sci.invalid>
Re: How do I: Count characters between < > in a string? <godzilla@stomp.stomp.tokyo>
How to send output to both a file and stdout <gfu@gscmail.gsfc.nasa.gov>
Re: How to send output to both a file and stdout <ilya@martynov.org>
Re: How to send output to both a file and stdout (Tad McClellan)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 15 Aug 2001 10:03:36 -0500
From: "Leary" <leary@foad.NOSPAM.org>
Subject: accessing multiple hashes and regex
Message-Id: <cKwe7.690$0M1.9303@e3500-atl1.usenetserver.com>
I have 2 hashes, built from seperate sources, that I need to get at. The
keys should be the same in both hashes. In one hash the keys are integers
without leading zero's, in the other hash what should be the same keys have
leading zero's, padded to 5 digits. I was trying to use the code below to
get at the data. The $aact_names hash has the "non-leading zero" keys.
foreach $key (keys (%acct_tot)) {
printf "%10d %30s %15.2f\n", $key, $acct_names{/$key/}, $acct_tot{$key};
}
No smiles :(
------------------------------
Date: 15 Aug 2001 15:54:09 GMT
From: trammell@haqq.hypersloth.invalid (John J. Trammell)
Subject: Re: accessing multiple hashes and regex
Message-Id: <slrn9nl6p0.4vk.trammell@haqq.hypersloth.net>
On Wed, 15 Aug 2001 10:03:36 -0500, Leary <leary@foad.NOSPAM.org> wrote:
[snip]
> foreach $key (keys (%acct_tot)) {
[snip]
I'm guessing you don't have 'use strict' on. Peril!
--
Never hit anyone with glasses. Instead, use your fist.
------------------------------
Date: Wed, 15 Aug 2001 15:54:01 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: accessing multiple hashes and regex
Message-Id: <mbudash-6D3B40.08540315082001@news.sonic.net>
In article <cKwe7.690$0M1.9303@e3500-atl1.usenetserver.com>, "Leary"
<leary@foad.NOSPAM.org> wrote:
> I have 2 hashes, built from seperate sources, that I need to get at. The
> keys should be the same in both hashes. In one hash the keys are integers
> without leading zero's, in the other hash what should be the same keys
> have
> leading zero's, padded to 5 digits. I was trying to use the code below to
> get at the data. The $aact_names hash has the "non-leading zero" keys.
>
> foreach $key (keys (%acct_tot)) {
> printf "%10d %30s %15.2f\n", $key, $acct_names{/$key/},
> $acct_tot{$key};
> }
>
> No smiles :(
how 'bout:
$acct_names{sprintf("%05d",$key)}
hth-
--
Michael Budash ~~~~~~~~~~ mbudash@sonic.net
------------------------------
Date: Wed, 15 Aug 2001 17:09:41 GMT
From: Carlos C. Gonzalez <miscellaneousemail@yahoo.com>
Subject: Alphabetized list of perldoc documentation??
Message-Id: <MPG.15e45adfa89c8579989754@news.edmonton.telusplanet.net>
Hi everyone,
I have noticed that in both the ActiveState and the www.perldoc.com list
of perldocs that the lists are not in alphabetical order. It's a pain to
look one up because I have to do a bunch of scanning of the list before I
find the one I am looking for (although I am finding that I am starting
to get to know about where one is because of repeated scanning for the
same perldoc).
Anyways I am wondering if anyone knows of a link to where I can find the
list of perldocs in alphabetical order by name? Regardless of the
increasing or decreasing complexity of the content or the order in which
they "should" be read?
Thanks.
---
Carlos
www.internetsuccess.ca
*NOTE*: Internet Success is NOT yet fully operational so although you are
welcomed to visit and take a look, trying to subscribe will only be a
frustration for you as your data will not be saved at this time.
------------------------------
Date: 15 Aug 2001 17:40:26 GMT
From: Randy Kobes <randy@theoryx5.uwinnipeg.ca>
Subject: Re: Alphabetized list of perldoc documentation??
Message-Id: <9lec6a$bho$1@canopus.cc.umanitoba.ca>
In comp.lang.perl.misc,
Carlos C. Gonzalez <miscellaneousemail@yahoo.com> wrote:
> [...] I am wondering if anyone knows of a link to where I can find the
> list of perldocs in alphabetical order by name? Regardless of the
> increasing or decreasing complexity of the content or the order in which
> they "should" be read?
What about http://perldoc.cpan.org?
best regards,
randy kobes
------------------------------
Date: Wed, 15 Aug 2001 18:01:14 GMT
From: Carlos C. Gonzalez <miscellaneousemail@yahoo.com>
Subject: Re: Alphabetized list of perldoc documentation??
Message-Id: <MPG.15e467095edad364989757@news.edmonton.telusplanet.net>
In article <9lec6a$bho$1@canopus.cc.umanitoba.ca>, Randy Kobes at
randy@theoryx5.uwinnipeg.ca says...
> What about http://perldoc.cpan.org?
Well....it's a bit of hassle to look through everything that shows up at
the above link to find perlfunc for example. Nice link though. I will
have to add it to my set of links.
I have to scroll up and down until the perlf..'s come into view. I was
hoping for a way to just view the basic perldoc's alphabetically.
Perldoc's as in perlfunc, perlsyn, perlfag, etc..
Thanks.
---
Carlos
www.internetsuccess.ca
*NOTE*: Internet Success is NOT yet fully operational so although you are
welcomed to visit and take a look, trying to subscribe will only be a
frustration for you as your data will not be saved at this time.
------------------------------
Date: Wed, 15 Aug 2001 12:30:29 -0400 (EDT)
From: <lapplisa-no-spam@cotse.com>
Subject: Any way of detecting running in eval?
Message-Id: <bGFwcGxpc2E=.908dfd276d5c102e8ea0b3f2e8b490f7@997893029.cotse.com>
Hi!
Is there any way to detect that code is running in an
eval context? I've tried caller, but that doesn't seem
to work.
I'm looking for something like this
----
#!/perl -w
use strict;
my $str = "if (context eq eval) {print "in eval";}";
eval $str;
----
Where "context eq eval" actually works. There must be
some way to access this runtime, becuase the perl
interpreter can throw errors identifying the offending
line as "eval 6" when $str contains an error in the
above code.
Any takers?
------------------------------
Date: Wed, 15 Aug 2001 16:34:31 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Any way of detecting running in eval?
Message-Id: <x7u1z9jn8o.fsf@home.sysarch.com>
>>>>> "X" == <lapplisa-no-spam@cotse.com> writes:
X> Is there any way to detect that code is running in an eval context?
X> I've tried caller, but that doesn't seem to work.
from purl on irc:
Look buddy, doesn't work is a strong statement. Does it sit on
the couch all day? Is it making faces at you? Does it want more
money? Please be specific!
define doesn't work. this is like saying + doesn't work for addition.
why would the docs claim caller knows about eval? many people have used
it and it seems to work for them. so what did you try? where is you
non-working code?
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Search or Offer Perl Jobs -------------------------- http://jobs.perl.org
------------------------------
Date: Mon, 13 Aug 2001 15:10:33 -0500
From: "Leary" <leary@foad.NOSPAM.org>
Subject: Re: array question... sort of
Message-Id: <bKwe7.688$0M1.9303@e3500-atl1.usenetserver.com>
Please disregard previous post... my stupid fingers<g> caused a typo which,
when corrected, made all the below mentioned errors disappear.
"Leary" <leary@foad.NOSPAM.org> wrote
>
> "Tad McClellan" <tadmc@augustmail.com> wrote;
> > Leary <leary@foad.NOSPAM.org> wrote:
> >
> <snip>
> >
> > When you find yourself explicitly indexing into an array, you
> > should pause and consider if you doing it the "non-Perl way".
> > You seldom need to index arrays yourself in Perl:
> >
> > foreach my $aref ( @array ) {
> > $tot += $aref->[8];
> > }
> >
> This loop causes an error;
> Use of uninitialized value in array element at C:\Perl\hsesum4.pl line 18,
> <TEST
> DATA> line 979.
>
> I'm guessing that is just an eof thing since my sample data has exactly
979
> lines in it, starting at one, not zero.
>
> It also gives an incorrect total, 7785.25. The difference is the exact
> amount of the first transaction in the sample data I am working with ...
> could it have added that first element twice?
>
> > Let perl manage the indexing for you. Machines make mistakes far
> > less often than people do :-)
>
>
>
>
------------------------------
Date: Wed, 15 Aug 2001 10:43:58 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: behavior in a while loop
Message-Id: <slrn9nl2le.1au.tadmc@tadmc26.august.net>
djcabz <c_barbet@hotmail.com> wrote:
>tadmc@augustmail.com (Tad McClellan) wrote in message news:<slrn9nj3c8.b3i.tadmc@tadmc26.august.net>...
>> I do not understand the question.
>>
>> If you can come up with a short and complete program that we
>> can run, we can probably help you fix it.
>>
> ^^^^ - I did not see relevency in posting the entire program,
That's fine, as I did not suggest that you post the entire program. :-)
>> We dunno what is in $fsndir. You never showed us. So we can't
>> help with debugging that part.
>> And your diag message says "copy" when you are NOT doing
>> any copying. That's kinda misleading.
>>
> ^^^^ - I've corrected it to say move. I initially had "use
>File::Copy" and was using the copy command. The final goal is to move
>the file; I understand rename is better. -cb
>
>Tad, I hope you are having a better day...
Better than when?
>I sincerly appreciate your
>assistance although there is no need to attack a person who is asking
>a question(s).
I have reviewed both of my followups to you. I can not see
a personal attack in either of them. I can only find comments
about your code, none about _you_.
Please quote what you are referring to there.
>#### VARIBLE DEFINITIONS #####
>$fsndir = shift || '.';
Are sure you will never have a directory named "0" (zero)?
The above will fail if you do.
my $fsndir = '.';
$fsndir = shift if defined $ARGV[0];
>#### opening log files and creating directories
>open(ERROR_LOG, ">>./fatal_error.log") or die "Could not open
>ERROR_LOG: $!\n";
>if (!chdir "./fsn") {
> mkdir("./fsn",0777);
You might not be able to create the directory. You should check
the return value:
mkdir("./fsn",0777) or die "could not create ./fsn directory $!";
Now that you have made it, don't you want to try chdir()ing again?
If not, then maybe you wanted a file test instead of chdir()?
if ( ! -d './fsn') {
>#### Create list of files FromScan
>open(FSN_LIST, ">./fromscan.lst") or die ERROR_LOG, "\nCould not open
>./fromscan.lst: $!";
This is still broken.
die() does not take a filehandle argument. For functions that _do_
take a filehandle, you do not put a comma after the filehandle.
>opendir FSN_DIR, $fsndir or die "Error opening directory $fsndir: $!
>\n";
>while ($fileFSN = readdir FSN_DIR) {
> next if ($fileFSN=~/^\./ || $fileFSN!~/$\.fsn/);
^
^
I think you put that anchor in the wrong place?
next if ($fileFSN=~/^\./ || $fileFSN!~/\.fsn$/);
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 15 Aug 2001 10:29:11 -0700
From: c_barbet@hotmail.com (djcabz)
Subject: Re: behavior in a while loop
Message-Id: <4256dfd1.0108150929.30126351@posting.google.com>
OK I have a tendency to answer my own postings, (I am a twisted
cookie)
I believe my checking for the directory using
if (!chdir "./fsn") ...
is causing the problem. Looking at it again, I am realizing that the
program is writing the file where I told it to cd to './fsn' I
believe I know what I need to do from here. Recommendation welcomed!!
Again, thanks to Tad and Ren.
-cb
[snippage]
> <please excuse Google Post for any formating issue>
>
> [The Problem Restated]: If fromscan.lst is empty the program moves
> the file fromscan.lst to the ./fsn directory. If there are '*.fsn'
> files to move, everything is good Life plays out as expected. [Using
> the Nutshell book to learn perl is not easy. I bought the wrong book
> for Learning Perl. Bare with or correct any unusual coding habits, I
> expect to get better.]
>
>
> #!/usr/bin/perl -w
>
> ### perl modules
>
>
> #### VARIBLE DEFINITIONS #####
> $fsndir = shift || '.';
>
> #### opening log files and creating directories
> open(ERROR_LOG, ">>./fatal_error.log") or die "Could not open
> ERROR_LOG: $!\n";
> if (!chdir "./fsn") {
> mkdir("./fsn",0777);
> print ERROR_LOG "\nHad to create ./fsn Directory";
> }
>
> #### Create list of files FromScan
> open(FSN_LIST, ">./fromscan.lst") or die ERROR_LOG, "\nCould not open
> ./fromscan.lst: $!";
> opendir FSN_DIR, $fsndir or die "Error opening directory $fsndir: $!
> \n";
> while ($fileFSN = readdir FSN_DIR) {
> next if ($fileFSN=~/^\./ || $fileFSN!~/$\.fsn/);
> print FSN_LIST "$fileFSN\n";
> }
> close(FSN_LIST) or warn ERROR_LOG, "\nCould not close ./fsnlist.lst:
> $!";
> closedir(FSN_DIR) or warn ERROR_LOG, "Could not close $fsndir: $!";
>
> open(FSN_LIST, "./fromscan.lst") or die ERROR_LOG, "\nCould not read
> ./fromscan.lst: $!";
> while (<FSN_LIST>) {
> print "I passed this file: $_";
> chomp($_);
> rename("$fsndir/$_", "./fsn/$_") || die ERROR_LOG, "\nCould not
> copy $_: $!";
> }
> #while ($fileFSNL = <FSN_LIST>) {
> # print "I passed this file: $fileFSNL";
> # chomp($fileFSNL);
> # rename("$fsndir/$fileFSNL", "./fsn/$fileFSNL") || die ERROR_LOG,
> "\nCould not copy $fileFSNL: $!";
> #}
>
> #### closing temporary and log files
> close(ERROR_LOG) or warn ERROR_LOG, "\nfatal_error.log did not close:
> $!";
------------------------------
Date: Wed, 15 Aug 2001 13:09:42 -0400
From: Samneric <samneric@tigerriverOMIT-THIS.com>
Subject: Re: Can someone critique my code and point to better way??
Message-Id: <MPG.15e4769361eb238989683@news.usit.net>
You've gotten many good responses regarding your code structure. But I wanted
to point out a basic syntax error that I didn't see mentioned elsewhere.
Carlos C. Gonzalez wrote:
> sub load_array
> {
> my ($array, $delimited_string) = @_;
$array gets assigned a reference to an array here.
>
> (@$array[0], @$array[1], @$array[2], @$array[3], @$array[4],
> @$array[5]) = split(/,/,$delimited_string);
> }
If you declare "my @array", you access the array itself with "@array", while
you access its scalar elements with "$array[]".
In your load_array() sub above, you declare "my $array" as a scalar which is
assigned the value of a reference to an array. That means that the referenced
array itself is accessed with "@$array", while its individual scalar elements
are accessed with "$$array[]".
Just as you wouldn't assign to the first element of "@array" with:
"@array[0] = $some_scalar" -- (you would use "$array[0]") --
you also wouldn't assign to the first element of "@$array" via:
"@$array[0] = $some_scalar", as you indirectly did in your code above.
You would need to use "$$array[0]"
(You could alternately use "$array->[0]")
------------------------------
Date: 15 Aug 2001 17:43:58 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Crypt::RSA, does that exist? I just want to decode...
Message-Id: <9leccu$5de$1@mamenchi.zrz.TU-Berlin.DE>
According to Torsten Mohr <tmohr@s.netic.de>:
> Hi everybody,
>
> i'd like to decrypt an RSA-encoded "number" or "chiffre".
> I took the algorithm from "Applied Kryptography".
> I got the private key (consists of d and n) and the
> block to decode, everything as a Math::BigInt.
>
> Now i have to do this calculation:
>
> m = c ** d mod n
>
> Sadly, c and d (also n) are 1024 bit BigInt numbers.
So? Overloading makes things easy:
use Math::BigInt ':constant'; # so numbers are born as BigInt's
my ( $c, $d, $n) = ( 298, 101, 100);
my $m = $c ** $d % $n;
calculates the result just fine. Of course, that calculates a far
larger intermediate result ($c ** $d) than necessary, which will
become a problem when you get serious about BigInt.
> In Java the class "BigInteger" has a method "modPow",
> that exactly does what i need. That method is kind of
> complicated and based on the "chinese remainder theorem".
>
> Does something like that exist for Perl?
Not to my knowledge. But you don't need the power of the Chinese
Remainder Theorem to calculate a power modulo something efficiently.
There are simple algorithms, and I'm sure "Applied Kryptography"
deals with them, or points to sources that do.
Anno
------------------------------
Date: 15 Aug 2001 16:38:18 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Evaluation order of object methods
Message-Id: <9le8hq$2sv$1@mamenchi.zrz.TU-Berlin.DE>
According to Daniel Berger <djberg96@hotmail.com>:
> Hi all,
>
> It's late. Couldn't sleep. Hopefully this makes sense.
>
> I've got question on object methods. Setting up methods is easy, as is
> calling individual methods. For this particular object that I have created,
> I would like to return $self if called in void context or an array or array
> ref if called in list or scalar context, respectively. No problem.
>
> However, where I'm having trouble is when I want to 'stack' methods that
> ultimately are called in list or scalar context.
>
> First, my very simple object.
Do you mean class?
> ##############################################
> package Some::Object;
> use strict;
>
> my @array; # This is our global array that we manipulate
A single array?
> sub new{
> my $class = shift;
> @array = @_;
> my $self = [];
> bless($self, $class);
> }
If you have only one array to maintain, what do you need objects for?
You can do that, but then your methods should be class methods, not
object methods.
> sub length{
> return scalar @array;
> }
>
> sub unique{
> my $self = shift;
> my %item;
> foreach(@array){ $item{$_}++ }
>
> unless(defined wantarray){
> @array = keys %item;
> return $self;
> }
>
> my @keys = keys %item;
> return @keys if wantarray;
> return \@keys;
> }
> ###########################################
>
> Now, what I would like to be able to do is:
>
> my $so = Some::Object->new(1,2,3,4,5,2,3,4);
> my $length = $array->unique()->length(); # Want to return '5'
Method chaining is possible, as long as every method returns an object.
Since you plan to return various things, depending on context, that
approach won't work here.
Frankly, your code above doesn't make much sense. You seem confused
about the role of classes vs. objects, and where to put the data.
Probably perltoot (an object-oriented tutorial for Perl) could help
you make a more focused design.
Anno
------------------------------
Date: 15 Aug 2001 16:42:53 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Evaluation order of object methods
Message-Id: <9le8qd$2sv$2@mamenchi.zrz.TU-Berlin.DE>
According to Michael Schlueter <Michael.Schlueter@philips.com>:
> begin 666 phone.txt
Ugh. Don't post uuencoded files. Append text if you must. Binaries
are for binary groups.
Anno
------------------------------
Date: 15 Aug 2001 16:22:09 GMT
From: martellm@aol.com (MartelLM)
Subject: FTP Problems with Perl
Message-Id: <20010815122209.06622.00002618@mb-fc.aol.com>
Hi Folks,
I have a script that is simulating a FTP MGET. It grabs each file and writes
the filename to an archive.txt file. The problem is that the files don't
appear to get compelelty transferred...they are cut-off and the entire body of
the files does not get FTPed. Any help is appreciated...script is below.
my $ftp;
chdir $docBaseDir . $partnerDir . "xml";
$ftp = Net::FTP -> new($server) or Error("Can't open server");
$ftp -> login($user, $password);
foreach my $file ($ftp->ls("*.xml")) {
$ftp->get($file) or warn $ftp->message;
# write file
$outputname = $docBaseDir . $partnerDir . $archiveFile;
open (OUTFILE, ">>$outputname");
$filename = $docBaseDir . $partnerDir . "xml" . $dirStruct . $file .
"\n";
print OUTFILE $filename;
close OUTFILE;
$ftp->delete($file)
}
$ftp -> quit();
}
------------------------------
Date: Wed, 15 Aug 2001 17:49:56 GMT
From: Carlos C. Gonzalez <miscellaneousemail@yahoo.com>
Subject: Function prototype causing type error??
Message-Id: <MPG.15e463d4e0dba78a989755@news.edmonton.telusplanet.net>
Hi everyone,
I am looking at including function prototypes in my sub definitions so
that in the future I can glance at a sub and know what kind of parameters
I called it with instead of searching through the code for the calling
statement. Or taking the time just now to write laborious comment blocks
above my subs. Especially tiny subs.
If I run the following code as is (sections irrelevant to the question of
this post have been left out)....
#!/usr/bin/perl -W
use CGI::Carp qw(carpout fatalsToBrowser);
use diagnostics;
use strict;
use DB_File;
my $file_spec = "d:/www/temp.dat";
my %data;
# sub close_file (\%);
# sub open_file (\%, $);
open_file(\%data, $file_spec);
close_file(\%data);
sub close_file(\%)
{
my ($hashref) = @_;
untie %$hashref;
}
sub open_file(\%, $)
{
my ($hashref, $file_name) = @_;
tie %$hashref, "DB_File", $file_name, O_RDWR|O_CREAT, 0666, $DB_HASH
or die "Cannot open $file_name: $!\n";
}
I get a warning saying that the function prototypes have not been able to
be checked because the subs were not yet defined when they were called.
No problem. I understand this.
Sooo...I uncomment the sub declarations at the top of the code and Perl
tells me that:
"Type of arg 1 to main::open_file must be a hash (not reference
constructor)..."
Can't I use a prototype to indicate exactly the type of variable I have
called a sub with? If I have to change the squiggly things "\%..." to
something other than what I use in front of the calling parameters it
will defeat the purpose for which I want to use prototypes (not exactly
the stated purpose for them in Perl - to overload existing functions - to
be sure but still...). Maybe I will have to settle for writing the
calling parameters above the sub manually after all. Which isn't so bad I
guess but I was hoping I could use prototypes to give me an easy way to
know what the calling parameters were.?
Any comments?
---
Carlos
www.internetsuccess.ca
*NOTE*: Internet Success is NOT yet fully operational so although you are
welcomed to visit and take a look, trying to subscribe will only be a
frustration for you as your data will not be saved at this time.
------------------------------
Date: 15 Aug 2001 09:34:57 -0700
From: taviny@hotmail.com (Blixa Bargeld)
Subject: GnuPG::Tie::Encrypt Issue
Message-Id: <c36b2f02.0108150834.5c15fbd4@posting.google.com>
Hi. I'm having a problem with this Perl module. I have a cgi script
that takes data from a form, encrypts it & sends it along in an email
message. When executed from a browser my script is crashing & I've
pinpointed it to be at the point where I try to encrypt the data. The
code I'm using to encrypt is similar to this:
tie *CIPHER, 'GnuPG::Tie::Encrypt', armor => 1, recipient => 'My UID';
print CIPHER "$text";
local $/ = undef;
my $ciphertext = <CIPHER>;
close CIPHER;
untie *CIPHER;
The funny thing is this works fine from the command line (when I'm
logged in with my userid). I know that the web server executes as
'nobody' so is this possibly a permissions issue? If so, how do I get
around this?
Thanks.
------------------------------
Date: Wed, 15 Aug 2001 10:27:44 -0500
From: Scott Yanoff <yanoff@yahoo.com>
Subject: Re: help :)
Message-Id: <3B7A94F0.652F7A26@yahoo.com>
Tad McClellan wrote:
>
> Scott Yanoff <yanoff@yahoo.com> wrote:
> >Tad McClellan wrote:
> >> Scott Yanoff <yanoff@yahoo.com> wrote:
>
> >> /$MyArray[$i]/i =~ /$user_input/i
>
> [snip]
>
> >Isn't the above checking to see $user_input was contained within
> >$MyArray[$i]?
>
> No, if we wanted that we would write this instead:
>
> $MyArray[$i] =~ /$user_input/i
That's the way I would have done it, I just had a brainfart. Sometimes
you look at code and can't see why it is wrong.....
Thanks,
--
-Scott
yanoff@yahoo.com | http://www.yanoff.org | AOL IM: SAY KJY
------------------------------
Date: Wed, 15 Aug 2001 12:31:24 -0400
From: jlm <jlm@cca-int.com>
Subject: Help w/grep
Message-Id: <3B7AA3DC.4D001409@cca-int.com>
I wrote a search engine in perl/cgi for our web site that searches for
files containing user supplied text string.
@farr = `find $dir -type f -exec grep -il $text {} \\;`;
I then proces the array constructing url's as I go & write out new web
page. Works great.
Now management wants the ability to optionally specify two strings and
return results only if both strings appear in a file.
I can't seem to figure out how to manipulate grep to do that.
Can someone solve this problem?
Or maybe the perl grep function can do the job better?
Thanks for the help...jim
------------------------------
Date: Wed, 15 Aug 2001 08:59:39 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Help with an HTML parsing problem
Message-Id: <3b7a9c6c$1@news.microsoft.com>
"Dav Lam" <crud@hongkong.com> wrote in message
news:fc25f4f2.0108150157.1cca9167@posting.google.com...
> I want to determine from an html that if it contains a hyperlink which
> name--the text between the start and end tags of that hyperlink--is
> "next", i've read the HTML::LinkExtor manpage and it seemds that it
> can only parse out the attribute and what tag is it the link
>
> Can anyone give me a clue how to do this task?
HTML::Parser will take you a long way.
jue
------------------------------
Date: 15 Aug 2001 15:20:03 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: How could chomp the blanks of one sentence?
Message-Id: <997888127.27089@itz.pp.sci.fi>
In article <slrn9n8j4n.1sj.tadmc@tadmc26.august.net>, Tad McClellan wrote:
>anon@anon.com <anon@anon.com> wrote:
>>
>>s/^\s*(.*?)\s*$/$1/
>
>And the answer to the FAQ that is this thread says this about
>that code:
>
> "Not only is this unnecessarily slow and destructive, it also
> fails with embedded newlines."
>
>And the 3e Camel book no longer has the code above, it instead
>has code like in the FAQ answer (p154).
Note that the FAQ answer isn't the fastest solution either, at least not
for typical input where the number of internal blanks exceeds the number
of trailing blanks. This is actually faster:
s/^\s+//;
1 while s/\s\z//;
Benchmarks can be found in the FWP mailing list archives.
(Arguably the FAQ answer *ought to* be faster. The perl regex engine
simply doesn't currently make the optimization that would make it so.)
--
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real! This is a discussion group, not a helpdesk. You post something,
we discuss its implications. If the discussion happens to answer a question
you've asked, that's incidental." -- nobull in comp.lang.perl.misc
------------------------------
Date: Wed, 15 Aug 2001 08:07:53 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: How do I: Count characters between < > in a string?
Message-Id: <3B7A9049.670C0160@stomp.stomp.tokyo>
Acacia wrote:
> I have a webpage and on the main page I want only the
> first 200 characters of each news post. However, when
> I include a HTML link (or any other <> tag) such as
> <a href="http://yadadaya">
> amongst the first 200 characters, it outputs only
> 174 visible characters (200 minus the given link code).
Your approach is highly illogical.
Extract your two-hundred characters from your news text,
then add your html tags.
Godzilla!
------------------------------
Date: Wed, 15 Aug 2001 11:48:52 -0400
From: Gary Fu <gfu@gscmail.gsfc.nasa.gov>
Subject: How to send output to both a file and stdout
Message-Id: <3B7A99E3.2F7AAFB5@gscmail.gsfc.nasa.gov>
Hi,
Is there a simple way to use one print statement to send the output
to both a file and the stdout ?
TIA.
Gary
------------------------------
Date: 15 Aug 2001 19:57:31 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: How to send output to both a file and stdout
Message-Id: <87zo9148pg.fsf@abra.ru>
GF> Hi,
GF> Is there a simple way to use one print statement to send the output
GF> to both a file and the stdout ?
GF> TIA.
GF> Gary
sub my_print(@) {
print @_;
print FILE @_;
}
my_print "Of course you can do it\n";
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/) |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80 E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/) |
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
------------------------------
Date: Wed, 15 Aug 2001 12:09:02 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: How to send output to both a file and stdout
Message-Id: <slrn9nl7ku.1of.tadmc@tadmc26.august.net>
Gary Fu <gfu@gscmail.gsfc.nasa.gov> wrote:
>
>Is there a simple way to use one print statement to send the output
>to both a file and the stdout ?
Perl FAQ, part 5:
"How do I print to more than one file at once?"
Please check the Perl FAQs *before* posting to the Perl newsgroup.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 1531
***************************************