[10846] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4447 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Dec 17 14:07:26 1998

Date: Thu, 17 Dec 98 11:00:25 -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, 17 Dec 1998     Volume: 8 Number: 4447

Today's topics:
        * Looking for CGI Form-to-Email for NT <v100x@vircom.com>
    Re: Can this be done <newsposter@cthulhu.demon.nl>
    Re: Complicated sorting problem (Larry Rosler)
    Re: DBD::Oracle (SELECT *) question... evlap@usa.net
    Re: hashes ptimmins@netserv.unmc.edu
        Help needed! (Tuomas Angervuori)
        Need to exclude certain Characters <mdevivio@vitamins.net>
    Re: Parsing string from browser input (Clay Irving)
    Re: Perl and FTP - without modules (James Peregrino)
    Re: Perl and FTP - without modules (I R A Aggie)
    Re: Posting Code for Review (Larry Rosler)
    Re: Posting Code for Review (Jim Seymour)
    Re: recursive dir in perl (Randal L. Schwartz)
        Review This For Me? (Note: 166 lines of code) (Jim Seymour)
    Re: Searching through a 10MB file (Christian M. Aranda)
    Re: Searching through a 10MB file (Christian M. Aranda)
    Re: Searching through a 10MB file (Christian M. Aranda)
        Send a FAX with perl? <guillaume@nospam.com>
    Re: sql in perl ? dave@mag-sol.com
        telnet by perl (Sam Curren)
    Re: Why doesn't setenv freeze my script <newsposter@cthulhu.demon.nl>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Thu, 17 Dec 1998 12:13:15 -0500
From: "Jon Yeager" <v100x@vircom.com>
Subject: * Looking for CGI Form-to-Email for NT
Message-Id: <RWae2.131$Hx5.104@wagner.videotron.net>

Hi,

I'm looking for an NT-compatible Form-to-Email script that can handle
REQUIRED fields.  It's important that it be able to force certain fields to
be answered before sending anything.  Preferably freeware, but not
necessarily (given no choice, I'd pay for it).

Any help in tracking something like this down would be greatly appreciated,

Jon Yeager




------------------------------

Date: Thu, 17 Dec 1998 10:59:51 -0500
From: Erik van Roode <newsposter@cthulhu.demon.nl>
Subject: Re: Can this be done
Message-Id: <36792A76.715BCBB1@cthulhu.demon.nl>

Henry Lifton wrote:
> 
> In an effort to get around the 1024 byte record limit in dbm files, I want to
> use a tab delimited text file.
> 
> While each record is large, there are only about 25 to 50 records,
> 
> I want to create an array or hash that I can use to pick the record I want
> using a key that is passed from another form.
> 
> Can anyone tell me how to code this.  I have the following, but it does not
> work.
> 
> open(land,'/data/land.txt') || die "can't open file land"; #this is the tab
> delimited text file
> 
> $key=$ENV{'PATH_INFO'};
> $key =~ s|/||;
> $info=$land{$key};
> 
> ($id,$address,$city,$type,$imp,$desc,$terms,$comments)=split('\t',$info);
> 
> $key is a number that corresponds to the first field $id and comes from
> the sending page.
> 
> In trying to debug it, I print the $key and $info variables.  $key comes up
> properly but $info is blank.
> 
> I need to be able to split this into the proper fields.
> 
> I would be grateful for any help

You did read the responses to your question: 'Why doesn't this work', right ?
Then show us you did ...

Erik



------------------------------

Date: Thu, 17 Dec 1998 08:52:21 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Complicated sorting problem
Message-Id: <MPG.10e2d69be14ac7b2989962@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and copy mailed.]

In article <3678da3a.9515536@news.skynet.be> on Thu, 17 Dec 1998 
10:31:27 GMT, Bart Lateur <bart.lateur@skynet.be> says...
+ Tim Gim Yee wrote:
+ 
+ >Here's an example of the Orcish Maneuver to go along with Uri's
+ >explanation above.  This one sorts files by date:
+ >
+ >my %age;
+ >@sorted = sort { 
+ >    ($age{$a} ||= -M $a) <=>
+ >    ($age{$b} ||= -M $b)
+ >} @files;
+ >
+ >Pronounce ||= as 'or cache' (give me the file age 'or cache' an
+ >expensive calculation of it), and instead of calling it the 'or-cache
+ >method'... well, at least that's the way I think it goes.
+ 
+ Aha! Now I get it. Clever trick. That does indicate that Larry
+ Rossler's "Orcish manoeuver" isn't one at all.

The approach I posted (precomputing and caching the sort comparands by a 

prepass through the data) has the '-cish' part, and -- as you discuss 
further below -- the 'Or-' part has the dual distinctions of being 
slower (because of the unnecessary test made on every comparison) or 
*much* slower (because any of the comparands that is FALSE is recomputed 

every time it is used).

It -- and the default-sort approach we have been exploring -- needs a 
new name.

BTW, thanks for the extra 's' in my name -- I have accumulated quite a 
collection of them, which I will bequeath to my children to enlarge 
their own collections.  I *had* to answer this post, so DejaNews would 
find me by name in it.  :-)
 
+ >Newsgroups: comp.lang.perl.misc
+ >Subject: Re: Sorting problem: Is there a better way?
+ >Date: Sun, 13 Dec 1998 18:52:37 -0800
+ >Message-ID: <MPG.10de1d51f12e3aab989957@nntp.hpl.hp.com>
+  
+ Also, note that this cache trick doesn't work if for some reason the
+ RHS returns a false value.
+ 
+ Damned. We're there again. See the current thread on 'counterintuitive
+ behavior of "shift'.
+ 
+ It's about time "we" make a new version of || (and && ?) that does
+ continue depending on the "definedness" of the left side result, 
+ instead of the "true-ness" ("truth" doesn't feel right).
+ 
+ I propose the operators ||| (triple vertical bar), in line with the
+ tradition of "|" and "||".
+ 
+ Examples:
+ 
+ 	$cache{$a} |||= -M $a
+ 	$one = shift ||| 1;
+ 
+ It would keep the left side value value, if it is defined (even if
+ "false"). Otherwise, the right side is evaluated. Mmmm... *I* like it.

That is enticing, and obviates the wordy locution I posted in the thread 

you referred to above.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: Thu, 17 Dec 1998 18:04:48 GMT
From: evlap@usa.net
Subject: Re: DBD::Oracle (SELECT *) question...
Message-Id: <75bh3v$229$1@nnrp1.dejanews.com>

Hi All!
I have a trouble with my query result. I wonder why the queries below
give different result with DBD::Oracle.
1) SELECT * FROM A_C where Code=2
2) SELECT Code, ReferEnce, Title,... FROM A_C where Code=2
Although everything works properly with sqlplus!
Actually, after fetching in variables, $Code - undefined but other fields/vars
seem to be OK. I tried 2 ways:
1) @row = $cursor->fetchrow_array;
   $Code=$row[0];
   ....
2) my($Code,
   ...);
   $cursor->execute;
   $cursor->bind_columns(undef, \($Code,  ... ));
   $cursor->fetch;
--------------
Eh... The same result, $Code - undefined (as perl debugger says).
However the query "SELECT Code, ..." brings correct result.
If this a glitch of DBD::Oracle?
Oracle works on other computer and is called via sql*net v1 (SCO Oracle
7.0.13). A_C is a view like "SELECT Code, .... FROM...".

Regards, Eugene.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: Thu, 17 Dec 1998 15:51:46 GMT
From: ptimmins@netserv.unmc.edu
Subject: Re: hashes
Message-Id: <75b9ag$qtq$1@nnrp1.dejanews.com>

In article <36781DB2.26708A46@rica.net>,
  tabo <cswfrank@rica.net> wrote:

> is there a way to get the number of items in a hash table?

$count = keys %hash;

Patrick Timmins
$monger{Omaha}[0]

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: Thu, 17 Dec 1998 18:52:29 GMT
From: tumppi@icon.fi (Tuomas Angervuori)
Subject: Help needed!
Message-Id: <Un3NuHgI1diW-pn2-6DyTyh2Dt5fl@aada.dyn.icon.fi>

I have a string, for example "> > Blaah blaah". How can I count, how 
many ">" characters there are in the string?

Thanks in advance,

	-Tumppi


------------------------------

Date: Thu, 17 Dec 1998 11:00:05 -0500
From: Michael <mdevivio@vitamins.net>
Subject: Need to exclude certain Characters
Message-Id: <36792A85.5B5ACEBF@vitamins.net>

Hello,

I need to exclude certain characters from a screen name field I am
working on. I just want [a-z][A-Z][0-9] but want to make sure nothing
else gets in such as $^&*( etc.

I am unsure of the format of this. My e-mail address is
mike@vitamins.netX (remove the X after net so I don't get spammed).
Thank you in advance for your help.

Regards,

Michael




------------------------------

Date: 17 Dec 1998 12:48:43 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Parsing string from browser input
Message-Id: <75bg5r$93k@panix.com>

In <75arhq$f2c$1@nnrp1.dejanews.com> nguyen.van@imvi.bls.com writes:

>I have some problem with my perl CGI. I create a script to take the input
>from browser, which then using Date::Manip module to convert string to date.
>After converting to date, it look for a file name with date attached at the
>end of the file (ie filename.12171998) and open the file and show output to
>browser. I have tried to write it but somehow not work for me

>____________________________________________________________________

>use CGI;
>use Date::Manip qw(ParseDate UnixDate);
>$query = new CGI;
>$| = 1;
>print "Content-type:text/html\n\n";

>read ( STDIN, $request_string, $ENV{'CONTENT_LENGTH'});
>( $key, $value ) = split ( /=/, $request_string );
>$value =~ s/\+/ /g;
>$key =~ s/\+/ /g;
>$value =~ s/%([0-9a-fA-F][0-9a-fA-F])/pack("C", hex($1))/eg;
>$key =~ s/%([0-9a-fA-F][0-9a-fA-F])/pack("C", hex($1))/eg;
>$view_all = $query->param('see'); where "see" is a Name variable in HTML

>_____________________________________________________________________-

Why are you beating your head against the wall? -- You are using CGI.pm!

  use CGI qw(:standard);

  print header;
  print start_html(-title=>'My Page',
                   -author=>'clay@panix.com');

  $view_all = param('see');

or

  use CGI qw(:standard);

  $query = new CGI;

  print $query->header(),
        $query->start_html(-title=>'My Page',
                           -author=>'clay@panix.com'),
  $view_all = $query->param('see');
  
-- 
Clay Irving
clay@panix.com


------------------------------

Date: Thu, 17 Dec 1998 11:36:23 -0500
From: james_peregrino@harvard.edu (James Peregrino)
Subject: Re: Perl and FTP - without modules
Message-Id: <1dk6hxt.zpwy3n5jmj7kN@dcepf5.harvard.edu>

Randal Schwartz <merlyn@stonehenge.com> wrote:

> First off, your subject line translates for me as:
> 
> "I'm willing to beat my head against the wall senselessly for
> some large number of minutes or hours because I don't understand
> that libnet can be installed by mortals."
> 
> So, having said that, my very FIRST advice to you is:
> 
>       ## Don't Reinvent the Wheel ##
>       use Net::FTP;

Some people don't use modules because they mistakenly think it will
bloat their code and slow things down.

And some people, as Randal points out, don't realize they can install
modules in their own account, without asking the very busy grumpy
sysadmin.

[for those who see this in dejanews and now want some helpful info:]

>From the README of libnet:
If you want to install a private copy of libnet in your home
directory, then you should try to produce the initial Makefile with
something like this command:

  perl Makefile.PL PREFIX=~/perl

And some people want to just play.  Maybe this person took a protocol
he's familiar with and tried to see if he could fake it at the socket
level in Perl.  Perl makes it fun to play and watch the bytes go by.

-James
-- 
 James Peregrino                                 (617)496-6288 (v)
 Manager of Comp. Services                       (617)495-5685 (f)
 Harvard Div. Cont. Ed.
 james_peregrino@harvard.edu


------------------------------

Date: Thu, 17 Dec 1998 12:34:28 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Perl and FTP - without modules
Message-Id: <fl_aggie-1712981234280001@aggie.coaps.fsu.edu>

In article <1dk6hxt.zpwy3n5jmj7kN@dcepf5.harvard.edu>,
james_peregrino@harvard.edu (James Peregrino) wrote:

+ Some people don't use modules because they mistakenly think it will
+ bloat their code and slow things down.
+ 
+ And some people, as Randal points out, don't realize they can install
+ modules in their own account, without asking the very busy grumpy
+ sysadmin.

Then why does the example code contain:

+ use IO::Socket;

? Isn't that a module? am I being to literal?

James


------------------------------

Date: Thu, 17 Dec 1998 08:08:36 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Posting Code for Review
Message-Id: <MPG.10e2cc5c47a8623e989961@nntp.hpl.hp.com>

In article <ebohlmanF43vxC.29D@netcom.com> on Thu, 17 Dec 1998 11:00:48 
GMT, Eric Bohlman <ebohlman@netcom.com> says...
> Jim Seymour <jseymour@jimsun.LinxNet.com> wrote:
> : Is it okay to post code for review here in comp.lang.perl.misc?
> : (Providing it's not *too* large.)  I looked at the FAQs but did
> : not see this issue addressed.  Maybe I missed it.
> 
> : I'd simply like a review of one of my latest efforts to see if
> : I'm "on track", as it were.
> 
> It's done, and is OK unless done so often that it starts to overwhelm the 
> group.  What's *not* OK is to post a long piece of code, claim that it 
> isn't working properly but you don't understand what it means, and ask 
> other people to fix it for you.  But you're not going to do that.  Perl 
> is what it is today because so much Perl code has been peer-reviewed.

One approach is to post a URL that allows those interest to read the 
code using their browsers.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: 17 Dec 1998 18:10:28 GMT
From: jseymour@jimsun.LinxNet.com (Jim Seymour)
Subject: Re: Posting Code for Review
Message-Id: <75bhek$l6g$2@jimsun.uucp>

In article <MPG.10e2cc5c47a8623e989961@nntp.hpl.hp.com>,
	lr@hpl.hp.com (Larry Rosler) writes:
> In article <ebohlmanF43vxC.29D@netcom.com> on Thu, 17 Dec 1998 11:00:48 
> GMT, Eric Bohlman <ebohlman@netcom.com> says...
>> Jim Seymour <jseymour@jimsun.LinxNet.com> wrote:
>> : Is it okay to post code for review here in comp.lang.perl.misc?
[snip]
>> It's done, and is OK ...
[snip]
> 
> One approach is to post a URL that allows those interest to read the 
> code using their browsers.

Doh!  Where is my head at?  Too late--I already posted it.

Wouldn't this subject would be a good one for the FAQ?  Including
something along the lines of Eric's comments and your suggestion?

Regards,
Jim
-- 
Jim Seymour
jseymour@jimsun.LinxNet.com
http://home.msen.com/~jimsun


------------------------------

Date: Thu, 17 Dec 1998 18:32:07 GMT
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: recursive dir in perl
Message-Id: <m1k8zqk49p.fsf@halfdome.holdit.com>

>>>>> "Bulls" == Bulls Fan <dsfamily@bangornews.infi.net> writes:

Bulls> Calle Dybedahl wrote:
>> 
>> pser <pascal.serode@alcatel.fr> writes:
>> 
>> > What I need, in fact, is just a script able to go down directories
>> > , recursively, building a list of every file met.
>> 
>> perldoc File::Find
>> --
Bulls> or you could just use this:

Bulls>    foreach $_ (readdir DIR ){          # for each file in this directory
Bulls>       if( -r $_ and -w $_ ){              # if it is readable and
Bulls> writeable
Bulls>          if( -d $_ and $_ !~ /^\.{1,2}$/ ){  # if the current item is a
Bulls> directory not named as '.' or '..'
Bulls>             getAllFilenames( "$fod\/$_" );   # go recursive

No.  You aren't checking if it's a symlink.  You will follow symlinks
erroneously.  This is Bad.

Please don't reinvent File::Find unless you understand why File::Find
does everything that it does.  Hint:  File::Find works well, so don't
reinvent it. :)

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: 17 Dec 1998 16:04:01 GMT
From: jseymour@jimsun.LinxNet.com (Jim Seymour)
Subject: Review This For Me? (Note: 166 lines of code)
Message-Id: <75ba1h$l6g$1@jimsun.uucp>

Hi All,

I've been learning/coding Perl for a few months now, and I *think*
I'm ready to submit my progress in learning the language to the
slings and arrows of those who've been doing it a lot longer :-).

------------------------- begin included text --------------------------
#!/usr/bin/perl -w
#
# xfersumm.pl - Produce summaries of FTP xfer entries in xferlog
#
# Usage:
#    xfersumm [-q] [-d <today|yesterday>] [file1 [file2 [filen [...]]]]
#
# Options:
#     -d today     - means just today
#     -d yesterday - means just "yesterday"
#
#     -q           - quiet: don't print headings for empty reports
#
#    If no file(s) specified, reads from stdin.  Output is to stdout.
#
# Typical usage:
#    Produce a report of previous day's activities:
#        xfersumm.pl -d yesterday /var/log/xferlog
#    A report of prior week's activities (after weekly log rotate):
#        xfersumm.pl /var/log/xferlog.1
#    What's happened so far today:
#        xfersumm.pl -d today /var/log/xferlog
#
# TBD:
#    date ranges, "lastweek", etc.?)
#

use strict;
use Getopt::Std;

use vars qw(
    $usageMsg
    $size $fname $direction $userType $userID $agent
    $opt_q $opt_d
    $dateStr
    @flds
    %userInCnt %userInSize %fileInCnt %anonInCnt %anonInSize
    %anonFileInCnt %userOutCnt %userOutSize %fileOutCnt %anonOutCnt
    %anonOutSize %anonFileOutCnt
);

$usageMsg = "usage: xfersumm [-q] [-d <today|yesterday>]";

# Fields in the logfile entries
#$rmtHost   = 6;	# for future use
$size      = 7;		# file size
$fname     = 8;		# file name
$direction = 11;	# "i" is incoming, "o" is outgoing
$userType  = 12;	# "r" is real, "a" is anon
$userID    = 13;	# will be login name or email address
$agent     = 14;	# i.e.: "ftp"

$opt_q = 0;	# for "simpler" tests later in case not set
getopts('qd:') ||
    die "$usageMsg\n";

$dateStr = get_datestr($opt_d) if(defined($opt_d));

while(<>) {
    chomp;
    next if(defined($dateStr) && ! /^$dateStr/);
    @flds = split;
    next unless($flds[$agent] eq "ftp");
    if($flds[$direction] eq "i") {
	# puts
	if($flds[$userType] eq "r") {
	    # real user
	    ++$userInCnt{$flds[$userID]};
	    $userInSize{$flds[$userID]} += $flds[$size];
	    ++$fileInCnt{$flds[$fname]};
	} else {
	    # anon user
	    ++$anonInCnt{$flds[$userID]};
	    $anonInSize{$flds[$userID]} += $flds[$size];
	    ++$anonFileInCnt{$flds[$fname]};
	}
    } else {
	# gets
	if($flds[$userType] eq "r") {
	    # real user
	    ++$userOutCnt{$flds[$userID]};
	    $userOutSize{$flds[$userID]} += $flds[$size];
	    ++$fileOutCnt{$flds[$fname]};
	} else {
	    # anon user
	    ++$anonOutCnt{$flds[$userID]};
	    $anonOutSize{$flds[$userID]} += $flds[$size];
	    ++$anonFileOutCnt{$flds[$fname]};
	}
    }
}

if(defined($dateStr)) {
    print "File xfer summaries for $dateStr\n";
}

# emit real user summaries
print_user_by_cnt_vals(\%userOutCnt, \%userOutSize, "real user FTP \"gets\" by username");
print_user_by_cnt_vals(\%userInCnt,  \%userInSize,  "real user FTP \"puts\" by username");
print_file_by_cnt_vals(\%fileOutCnt, "real user FTP \"gets\" by file");
print_file_by_cnt_vals(\%fileInCnt,  "real user FTP \"puts\" by file");
# emit anonymous user summaries
print_user_by_cnt_vals(\%anonOutCnt, \%anonOutSize, "anonymous FTP \"gets\" by user");
print_user_by_cnt_vals(\%anonInCnt,  \%anonInSize,  "anonymous FTP \"puts\" by user");
# print file summaries
print_file_by_cnt_vals(\%anonFileOutCnt, "anonymous FTP \"gets\" by file");
print_file_by_cnt_vals(\%anonFileInCnt,  "anonymous FTP \"puts\" by file");


# print user info hash contents sorted by numeric values in descending
# order (i.e.: highest first)
sub print_user_by_cnt_vals {
    my($hashName, $sizeHashName, $title) = @_;
    my $dottedLine;
    unless(%$hashName) {
	return if($opt_q);
	$dottedLine = ": none";
    } else {
	$dottedLine = "\n" . "-" x length($title);
    }
    print "\n$title$dottedLine\n";
    foreach (reverse sort { $hashName->{$a} <=> $hashName->{$b} } keys(%$hashName)) {
	if($sizeHashName->{$_} > 1024) {
	    printf "%3d  %6dk  %s\n", $hashName->{$_}, int($sizeHashName->{$_} / 1024), $_;
	} else {
	    printf "%3d   %6d  %s\n", $hashName->{$_}, $sizeHashName->{$_}, $_;
	}
    }
}

# print file info hash contents sorted by numeric values in descending
# order (i.e.: highest first)
sub print_file_by_cnt_vals {
    my($hashName, $title) = @_;
    my $dottedLine;
    unless(%$hashName) {
	return if($opt_q);
	$dottedLine = ": none";
    } else {
	$dottedLine = "\n" . "-" x length($title);
    }
    print "\n$title$dottedLine\n";
    foreach (reverse sort { $hashName->{$a} <=> $hashName->{$b} } keys(%$hashName)) {
	printf "%3d  %s\n", $hashName->{$_}, $_;
    }
}

# return a date string to match in log
sub get_datestr {
    my @monthNames = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
    my @weekDays = qw(Sun Mon Tue Wed Thu Fri Sat);
    my $aDay = 60 * 60 * 24;

    my $dateOpt = $_[0];

    my $time = time();
    if($dateOpt eq "yesterday") {
	$time -= $aDay;
    } elsif($dateOpt ne "today") {
	die "$usageMsg\n";
    }
    my ($t_mday, $t_mon, $t_wday) = (localtime($time))[3,4,6];

    return sprintf("%s %s %2d", $weekDays[$t_wday], $monthNames[$t_mon],
                   $t_mday);
}
-------------------------- end included text ---------------------------

How am I doing?

Thanks In Advance,
Jim
-- 
Jim Seymour
jseymour@jimsun.LinxNet.com
http://home.msen.com/~jimsun


------------------------------

Date: Thu, 17 Dec 1998 17:49:45 GMT
From: christian.aranda@iiginc.com (Christian M. Aranda)
Subject: Re: Searching through a 10MB file
Message-Id: <75bge4$iam$3@news-2.news.gte.net>

Thanks for all the help, guys!  Below, please find my modified version
of the mudule.  It is MUCH faster than the first.  I know there is so
much more I could do to make it faster, but in the interest of time I
could not.

sub get_ddts_record
{
	open(DDTS_DATA, "$ddts_file") ||
		&err_msg("fatal", "Unable to open data file", "open",
undef ) ;

   $start = "Start: $ddts_value{identifier}";
   $end_record = "End: $ddts_value{identifier}";
   $BugIdFound = 0;
   $GetData = 0;
   $Done = 0;
   undef($attached_record);

   while (<DDTS_DATA>) {
      chop($_);

      if (index($_, $start) == 0) { $BugIdFound = 1; }
      if (index($_, "History") == 0 && $BugIdFound) { $GetData = 1; }
      if (index($_, $end_record) == 0 && $BugIdFound) { $GetData = 0;
$Done = 1; }

      if ($GetData &&! $Done) {
         $attached_record .= "$_\n";
      }
   }

@comments = split("Related-file:",$attached_record);
close(DDTS_DATA);
        
}

One final thought:  Larry asked why I was creating a variable just to
split it.  Basically, I need all the data between "Start: " and
"End:".  Then, based on the identifier "Related-file" I need to break
it up into different related files.  I'm sure there is a better way to
do it, but that's what I came up with.

Thanks again!


Christian M. Aranda
Impact Innovations Group
------------------------
Decide what you want then decide
what you'll give up for it.  Me?
I'll give up sleep.


------------------------------

Date: Thu, 17 Dec 1998 17:50:10 GMT
From: christian.aranda@iiginc.com (Christian M. Aranda)
Subject: Re: Searching through a 10MB file
Message-Id: <75bget$iam$4@news-2.news.gte.net>

Thanks for all the help, guys!  Below, please find my modified version
of the mudule.  It is MUCH faster than the first.  I know there is so
much more I could do to make it faster, but in the interest of time I
could not.

sub get_ddts_record
{
	open(DDTS_DATA, "$ddts_file") ||
		&err_msg("fatal", "Unable to open data file", "open",
undef ) ;

   $start = "Start: $ddts_value{identifier}";
   $end_record = "End: $ddts_value{identifier}";
   $BugIdFound = 0;
   $GetData = 0;
   $Done = 0;
   undef($attached_record);

   while (<DDTS_DATA>) {
      chop($_);

      if (index($_, $start) == 0) { $BugIdFound = 1; }
      if (index($_, "History") == 0 && $BugIdFound) { $GetData = 1; }
      if (index($_, $end_record) == 0 && $BugIdFound) { $GetData = 0;
$Done = 1; }

      if ($GetData &&! $Done) {
         $attached_record .= "$_\n";
      }
   }

@comments = split("Related-file:",$attached_record);
close(DDTS_DATA);
        
}

One final thought:  Larry asked why I was creating a variable just to
split it.  Basically, I need all the data between "Start: " and
"End:".  Then, based on the identifier "Related-file" I need to break
it up into different related files.  I'm sure there is a better way to
do it, but that's what I came up with.

Thanks again!


Christian M. Aranda
Impact Innovations Group
------------------------
Decide what you want then decide
what you'll give up for it.  Me?
I'll give up sleep.


------------------------------

Date: Thu, 17 Dec 1998 17:50:21 GMT
From: christian.aranda@iiginc.com (Christian M. Aranda)
Subject: Re: Searching through a 10MB file
Message-Id: <75bgf9$iam$5@news-2.news.gte.net>

Thanks for all the help, guys!  Below, please find my modified version
of the mudule.  It is MUCH faster than the first.  I know there is so
much more I could do to make it faster, but in the interest of time I
could not.

sub get_ddts_record
{
	open(DDTS_DATA, "$ddts_file") ||
		&err_msg("fatal", "Unable to open data file", "open",
undef ) ;

   $start = "Start: $ddts_value{identifier}";
   $end_record = "End: $ddts_value{identifier}";
   $BugIdFound = 0;
   $GetData = 0;
   $Done = 0;
   undef($attached_record);

   while (<DDTS_DATA>) {
      chop($_);

      if (index($_, $start) == 0) { $BugIdFound = 1; }
      if (index($_, "History") == 0 && $BugIdFound) { $GetData = 1; }
      if (index($_, $end_record) == 0 && $BugIdFound) { $GetData = 0;
$Done = 1; }

      if ($GetData &&! $Done) {
         $attached_record .= "$_\n";
      }
   }

@comments = split("Related-file:",$attached_record);
close(DDTS_DATA);
        
}

One final thought:  Larry asked why I was creating a variable just to
split it.  Basically, I need all the data between "Start: " and
"End:".  Then, based on the identifier "Related-file" I need to break
it up into different related files.  I'm sure there is a better way to
do it, but that's what I came up with.

Thanks again!


Christian M. Aranda
Impact Innovations Group
------------------------
Decide what you want then decide
what you'll give up for it.  Me?
I'll give up sleep.


------------------------------

Date: Thu, 17 Dec 1998 17:43:02 -0000
From: "Guillaume Buat-Menard" <guillaume@nospam.com>
Subject: Send a FAX with perl?
Message-Id: <75bg31$h7l$1@newsreader2.core.theplanet.net>

Hi all,

I would like to know if its possible to send a fax with a Perl module.
I think I red somewhere that it is possible with the NET:FTP module but I
can't find any documentation on that anymore.
If its possible, where is the best place to download this module (I'm
running NT serverPack 3.0 on NT 4.0) and where I can find an example of code
to help me out.

Thanks for your help,

Guillaume.




------------------------------

Date: Thu, 17 Dec 1998 17:31:45 GMT
From: dave@mag-sol.com
Subject: Re: sql in perl ?
Message-Id: <75bf62$en$1@nnrp1.dejanews.com>

In article <3678F0A8.10AC@norsar.no>,
  Kamran Iranpour <kamran@norsar.no> wrote:
> Hi
>
>   I am a newbie in perl so have patience with me.
>   I am writing a CGI-script in perl which recieve s
>   a field from a html page and then is supposed to handle that
>   as a key for data in a Oracle database, fetch the data
>   and send them back to the page. Is there a package in perl
>   for doing sql calls to Oracle ? Or maybe you will be kind
>   to forward me to a faq dealing with this issue.

You need to look at DBI and DBD::Oracle. You can get them both from CPAN
<http://www.perl.com/CPAN/>.

Dave...

--
Magnum Solutions Ltd: <http://www.mag-sol.com/>
London Perl M[ou]ngers: <http://london.pm.org/>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: Thu, 17 Dec 1998 10:27:03 -0800
From: samc@empirewest.com (Sam Curren)
Subject: telnet by perl
Message-Id: <MPG.10e2ecce22aa267b9896c2@news.sonic.net>

I'm attempting to open a telnet session to a server on a specific port, 
wait for the init string, then send it one line of text and disconnect.

All servers being linux.

Being able to save all the output of the other server would be a plus.

I can do all the work, but does anyone have a general place to start? I'd 
rather use a module then a system call, but a system call can be made.

TIA -Sam


------------------------------

Date: Thu, 17 Dec 1998 10:57:12 -0500
From: Erik van Roode <newsposter@cthulhu.demon.nl>
Subject: Re: Why doesn't setenv freeze my script
Message-Id: <367929D8.235D8AE@cthulhu.demon.nl>

Tad McClellan wrote:
> 
> Tommy1452 (tommy1452@aol.com) wrote:
> : The following command:
> : setenv HTTP_USER_AGENT "Mozilla/4.0 (compatible; MSIE 4.01; Windows 98)";
> : stops my script dead in it's tracks, how come?
> 
>    You seem to have wandered into the Perl newsgroup by mistake.
> 
>    There is no Perl in your question...

Ofcourse, just mention Windows 98 and everything comes to a halt ;)
This remark is _not_ caused by having 6 days experience in working
with Windows 98. It doesn't have Perl installed yet :)

Erik




------------------------------

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 4447
**************************************

home help back first fref pref prev next nref lref last post