[23600] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5807 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Nov 15 09:05:46 2003

Date: Sat, 15 Nov 2003 06:05:06 -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           Sat, 15 Nov 2003     Volume: 10 Number: 5807

Today's topics:
    Re: ALRM weirdness in Perl 5.8.0 <usenet@morrow.me.uk>
    Re: arrange form data in same order as on form <me@privacy.net>
    Re: arrange form data in same order as on form <REMOVEsdnCAPS@comcast.net>
        extracting Javascript from a web page (Alex)
    Re: Giving back <flavell@ph.gla.ac.uk>
    Re: long running perl programs & memory untilization <stanb@panix.com>
    Re: my command (sorry newbe question) <usenet@morrow.me.uk>
    Re: my command (sorry newbe question) <bmb@ginger.libs.uga.edu>
    Re: Programming Pointer (William Herrera)
    Re: Programming Pointer <reachus@netlink.info>
    Re: regex to convert 1000000 -> 1,000,000 ? (bad_knee)
    Re: strange hash syntax <davido@pacifier.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 15 Nov 2003 07:55:31 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: ALRM weirdness in Perl 5.8.0
Message-Id: <bp4m5j$43q$1@wisteria.csv.warwick.ac.uk>


"Mark" <admin@asarian-host.net> wrote:
> I guess I will need something entirely different then to break out of the
> eval {} within a thread. Any ideas? :)

You want another thread that sleeps for a while and then kills the first.

Ben

-- 
For the last month, a large number of PSNs in the Arpa[Inter-]net have been
reporting symptoms of congestion ... These reports have been accompanied by an
increasing number of user complaints ... As of June,... the Arpanet contained
47 nodes and 63 links. [ftp://rtfm.mit.edu/pub/arpaprob.txt] * ben@morrow.me.uk


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

Date: Sat, 15 Nov 2003 19:37:39 +1300
From: "Tintin" <me@privacy.net>
Subject: Re: arrange form data in same order as on form
Message-Id: <bp4hl7$1kffm7$1@ID-172104.news.uni-berlin.de>


"Gunnar Hjalmarsson" <noreply@gunnar.cc> wrote in message
news:bp4c2u$1k3umr$1@ID-184292.news.uni-berlin.de...
> Tintin wrote:
> > Gunnar Hjalmarsson wrote:
> >> To me, a piece of code that does what it's _intended_ to do is
> >> not "buggy". It may have _limitations_, but limitations and bugs
> >> are not the same thing.
> >>
> >> If I want my program to print today's date in ISO 8601 format, I
> >> may use this code:
> >>
> >>     my $time = time;
> >>     sub myDate {
> >>         my @t = (gmtime $time)[3..5];
> >>         sprintf '%d-%02d-%02d', $t[2] += 1900, ++$t[1], $t[0];
> >>     }
> >>     print myDate();
> >>
> >> I could have used your Time::Format module instead, but if I
> >> don't need a variety of date and time formats in my program, I
> >> wouldn't likely have done so.
> >>
> >> Time::Format includes some nice tools for time formating, no
> >> doubt. Nevertheless, that fact wouldn't make you claim that my
> >> myDate() function is "buggy", right?
> >
> > Your analogy is not a good one.  An ISO8601 date format has very
> > rigid parameters, whereas CGI data is by its very nature, variable.
>
> True, but all potential variations are not applicable in all programs
> that parse CGI data. For instance, if you want that a program only
> parses POSTed data, it's not buggy because it isn't prepared to handle
> potential variations in data submitted via GET. Limited? Yes.
> Unflexible? Yes. Buggy? No.
>
> The only point with my example was to illustrate that distinction.
> Call a spade a spade! :)

I agree with you about not calling code buggy to a certain degree.  I
suppose you could argue that various Microsoft products that don't conform
to standards are limited and not buggy because they are deliberately
designed that way, however, the typical newbie or person that writes
"limited" CGI parsing code, generally does not write it deliberately with
limitations.  In most cases, I think it is fair to say they are writing code
which they think works for all occasions.




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

Date: Sat, 15 Nov 2003 05:34:32 -0600
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: arrange form data in same order as on form
Message-Id: <Xns94344308AD986sdn.comcast@216.196.97.136>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

Gunnar Hjalmarsson <noreply@gunnar.cc> wrote in news:bp4c2u$1k3umr$1@ID-
184292.news.uni-berlin.de:

> True, but all potential variations are not applicable in all programs
> that parse CGI data. For instance, if you want that a program only
> parses POSTed data, it's not buggy because it isn't prepared to handle
> potential variations in data submitted via GET. Limited? Yes.
> Unflexible? Yes. Buggy? No.

I just can't believe that anyone would advocate writing one's own limited 
CGI parsing code from scratch, against using the robust, flexible CGI.pm 
off the shelf.

- -- 
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print

-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBP7YPeGPeouIeTNHoEQL4WwCcDCElVH4KVgAhcWhfYDH5SIAquzUAoJWF
JAjzO/Q+EBQWtA9mhvGYZslH
=dmtq
-----END PGP SIGNATURE-----


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

Date: 15 Nov 2003 03:32:37 -0800
From: aturchin@iname.com (Alex)
Subject: extracting Javascript from a web page
Message-Id: <d3d1b4a1.0311150332.4f7d0ce7@posting.google.com>

Hi Everyone,

I have a perl script which tries to read a web page and then submit
data to a form using LWP::UserAgent. The page has some Javascript in
the header which does not show when I look at the page's source, and
which - I suspect - is crucial to filling the form out correctly (I
keep getting 500 Server Error otherwise).

I am trying to find out if there is a way to see that "hidden"
Javascript so I could amend my form submission accordingly. It seems
like there HAS to be a way since every browser can see it, and
therefore UserAgent should be seeing it too. However, I dumped and
looked through the entire $response variable (not just
$response->{'content'}) but the Javascript code appears to be hidden
there as well.

To forestall the potential flames: I DO have the permission of the
website owners to do what I am doing but their tech support is
obviously only from 9-5 and not necessarily immediately responsive so
I am trying to get as much as I can done by myself.

Thanks very much for your help!

Alex

P.S. Please feel free to cc your responses to my email.


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

Date: Sat, 15 Nov 2003 13:50:33 +0000
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: Giving back
Message-Id: <Pine.LNX.4.53.0311151329460.11512@ppepc56.ph.gla.ac.uk>

On Sat, 15 Nov 2003, Gunnar Hjalmarsson wrote:

> Trent Curry wrote:
> > Just a little question, why do newer readers use > > > instead of
> > >>> which gives more room for quoted text? It seems to me more and
> > more readers use this for now instead of the spaced out version.
> > Just wondering.
>
> Is that so? In that case, fewer and fewer developers read and/or care
> to comply with applicable standards, such as RFC2646. Sad!

I'm getting increasingly impatient with myself for following-up this
off-topic thread, but ...

Automatic re-flowing of text is surely only permissible according to
this RFC when the item's content type has been suitably declared in
the headers?  That means, first and foremost, conformance with MIME
specifications.  See e.g the USEFOR draft, section 3.1.2.2, keeping in
mind of course that USEFOR is still just a draft of a best-practice
recommendation.  But it's the nearest that we have to a viable spec,
since rfc1036 is positively geriatric but its successors never quite
made it to official status.

The people who were making allegations about other contributors'
software being outdated, were themselves posting in Stone-age formats
which pre-dated MIME, and thus their postings were were required to be
treated as literally text/plain US-ASCII in the meaning of RFC2046
(i.e format=fixed in the terms of RFC2646).

But I doubt that they are sufficiently well-informed to appreciate
how silly that makes them look.  Now I really must stop doing this.

all the best


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

Date: Sat, 15 Nov 2003 13:46:03 +0000 (UTC)
From: Stan Brown <stanb@panix.com>
Subject: Re: long running perl programs & memory untilization
Message-Id: <bp5amr$5q0$1@reader2.panix.com>

In <bp1547$h0a$2@wisteria.csv.warwick.ac.uk> Ben Morrow <usenet@morrow.me.uk> writes:


>Stan Brown <stanb@panix.com> wrote:
>> In <20031113163837.417$N1@newsreader.com> ctcgag@hotmail.com writes:
>> 
>> >Stan Brown <stanb@panix.com> wrote:
>> >>
>> >> Thanks. The latest one of these "long running" scripts to exhibit this
>> >> behavior, is really quite simple, in what it does, and has no real
>> >> complex data structures.
>> >>
>> >> I suppose it would be inappropriate to post it here for criticism, right?
>> 
>> >As long as the script is short and strict, it wouldn't be at all
>> >inappropriate.  Does the script run full-bore for months, or is it some
>> >kind of server-like thing that spends most of it's time waiting?
>> 
>> It does setup stuff (a lot of that), and then goes into a loop. In this
>> loop it does a system call

>This is a little confusing... when I first read it, I parsed it as
>'system call' in the sense of something like fcntl(2). It would be
>better to say 'it runs v4lctl with system()' or something :).

>> to v4lctl to capture an image, then goes bacl to
>> sleep and waits. Curently it's one image every 10 seconds. Running since
>> moday, it had grown to a size of 1/2 a gig :-(

>What does it do with the image? Are you sure you aren't keeping them
>all in memory somewhere by mistake?

>Post just the loop for us to have a look at.

Well, since I aparantely ofended all of you by posting it all, as I judge
from zero reolies, here is the cut down version:


#!/usr/bin/perl -w

# "@(#)webcam.pl	
#
# "%W% %E% %U%";  /* SCCS what string */
# 
# webcam.pl
#
# 10-30-2003 SDB XXXXXXXXXXXXXXX
#
# Captures video images

use strict;
use AppConfig::File;
use IO::Handle;
use Getopt::Mixed "nextOption" ;
use Time::HiRes qw( gettimeofday tv_interval);
use Data::Dumper;
use Term::ANSIColor qw(:constants);
use Date::Calc qw( Today Day_of_Week );
use Time::Local;
use Time::CTime;
use Time::HiRes qw(gettimeofday);
use Image::Magick;
use File::Path;
use File::lockf;
use Term::ANSIColor qw(:constants);
use Video::Capture::V4l;
use Imager;
use Devel::Leak;

# Config file name goes here
# May be modifed with -f <filename> at runtime
$::cfg_file = "/opt/local/lib/webcam.conf";

# Can be turned on at runtime with a -d
$::Debug=0;

$::OverRide_PID_File = 0;
$::Grab_Use_Internal = 1;



sub addtime($$$$$) {
##################################################################
#
# reads in temporary capture file adds timestamp, and writes
# it to the permanent location
#
# Argument 1 is filename that the labled image should be stored as
#
# Argument 2 is the label to apply
#
# Argument 3 is the filename that the image is curently in
#
# Argument 4 is the color to label the image with
#
# Argument 5 is the font size to use for the label
#
###################################################################
my $final_filename = $_[0];
my $l_tstamp = $_[1];
my $l_tmpfile = $_[2];
my $l_lbl_color = $_[3];
my $l_lbl_size = $_[4];
my $image = Image::Magick->new(magick=>'GIF',font=>'clean');
my $function_name = (caller(0))[3];
my $argtmp = join ', ', map "Arg$_ " . 
			( defined $_[$_] ? "->$_[$_]<-" : 
			'*UNDEF*'), 0 .. $#_;

print_debug(2,"Entering $function_name()\n",0,0);
print_debug(3,"$argtmp\n",0,0);

    $image->Read($l_tmpfile);
    
    #On ajoute le text
    $image->Annotate(fill=>'white',
    			pointsize=>$l_lbl_size,
			text=>$l_tstamp,
			gravity=>'SouthWest',
			stroke=>$l_lbl_color,
			fill=>'black',
			y=>(int($l_lbl_size * 1.4)));


    #On écrit le fichier
    $image->Write($final_filename); 
    print_debug(3,"Returning from $function_name()\n",0,0);
}


sub grab_one($$) {
##################################################################
#
# grab_one
# 
# Grabs one frame from video capture card
#
# Argument 1 is the name of the file to save to
#
# Argument 2 is the video object
#
# Retruns 1 if capture succceded, 0 otherwise
#
##################################################################
my $l_tmpfile = $_[0];
my $grab = $_[1];
my $function_name = (caller(0))[3];
my $argtmp = join ', ', map "Arg$_ " . 
			( defined $_[$_] ? "->$_[$_]<-" : 
			'*UNDEF*'), 0 .. $#_;
print_debug(2,"Entering $function_name()\n",0,0);
print_debug(3,"$argtmp\n",0,0);
my $fr;
my $temp = '';
$| = 1;
my $frame = 0;
my $count = 0;

$fr    = $grab->capture( $frame, 844 , 576 );

for ( 0 .. 1 ) {
    my $nfr = $grab->capture( 1 - $frame, 844, 576 );
    if ( ! $grab->sync($frame))
    {
	logit(1,
		$::config{webcam_log_file},
		"Can't synch this frame");
    	return(0);
    }
    unless ( $count == 0 ) {

        # save $fr now, as it contains the raw BGR data
        $temp = '';
        if( ! open( JP, '>', \$temp ))
	{
		logit(1,
			$::config{webcam_log_file},
			"Can't Open temporary file $temp");
	    	return(0);
	}
        print JP "P6\n840 576\n255\n";    #header
        $nfr = reverse $nfr;
        print JP $nfr;
        close JP;

        my $img = Imager->new();
        if ( ! $img->read( data => $temp, type => 'pnm' ))
	{
		logit(1,
			$::config{webcam_log_file},
			"$img->errstr()");
	}
        $img->flip( dir => "hv" );
        if ( ! $img->write( data => \$temp, type => 'jpeg' ))
	{
		logit(1,
			$::config{webcam_log_file},
			"$img->errstr()");
	}
    }
    $count++;
    $frame = 1 - $frame;
    $fr    = $nfr;
} # endfor

# Save it
if( ! open( JP, "> $l_tmpfile" ))
{
	logit(1,
		$::config{webcam_log_file},
		"Can't Open temporary file $l_tmpfile");
    	return(0);
}
print JP $temp;
close JP;
print_debug(3,"Returning from $function_name()\n",0,0);
return(1);
}


# main()
my @t;
my @fields;
my $tt;
my $incd;
my $my_pid;
my $handle;
my $filename;
my $last_field;
my $grab;
my $good_frame;
my $sleep_time;
my ($last_trigger_time, $grab_time);
my ($movie_dirname , $movie_filename);
my ($tmp , $tmp2);
my ($dcount, $ndcount);
my $timestamp;
my $dirname = '';
my $prev_dirname = '';
my $tmpfile = "/tmp/webcam$$.jpeg"; 

if ($::Grab_Use_Internal != 1)
{
	system("/usr/bin/v4lctl -c $::config{video_dev} setinput $::config{video_type}");
}
else
{
	$grab = init_video($::config{video_dev});
}

$dcount = Devel::Leak::NoteSV($handle);
while (1) # Forever
{

	# This program inherently will run forever
	# To cause it to stop, remove it's pid file
	if( ! (-r $::config{webcam_pid_file}))
	{
		last;
	}
	$last_trigger_time = gettimeofday;
	logit(6,
		$::config{webcam_log_file},
		"Start of loop, elapsed time in this capture 0 seconds");


	# if $dirname contains a / then it must have already been set up
	# so we need to save a copy that will be used later
	# # to check to se if it has been changed
	# we use this to trigger directory completion processing
	if ( $dirname =~ m'[^/]' )
	{
		$prev_dirname = $dirname;
	}
	

	# Build directory name
	@t = localtime(time);
	$dirname = strftime $::config{dest_directory_template} , @t;
	$dirname = join '' , $::config{dest_dir} , $dirname , '/';

	# build filename
	$filename = strftime $::config{dest_file_template} , @t;
	$filename = join '' , $filename , '.jpeg';

	# Does the destination directory exist?
	if( ! (-r $dirname))
	{
		# No, need to create it
		# This is also the place to add any processing that 
		# may be required at directory creation time
		logit(3,
				$::config{webcam_log_file},
				"Need to create new directory $dirname");
		eval { mkpath($dirname) };
		if ($@) 
		{
			logit(1,
				$::config{webcam_log_file},
				"Failed to create new directory $dirname");
			print "Failed to creat directory $dirname\n";
			clean_house(1);
		}
		# Ok we've created the new directory
		# Were we using one before? Or is this initial
		# startup ?
		if ( $prev_dirname =~ m'/$' )
		{
			if(-r $prev_dirname)
			{
				# Post directory fill processing goes hee
				# Trigger mpeg creation here
				# Build directory name
				$movie_dirname = $::config{dest_dir};
				# Does the destination directory exist?
				if( ! (-r $movie_dirname))
				{
					# No, need to create it
					logit(3,
							$::config{webcam_log_file},
							"Need to create new directory $movie_dirname");
					eval { mkpath($movie_dirname) };
					if ($@) 
					{
						logit(1,
						$::config{webcam_log_file},
						"Failed to create new directory $movie_dirname");
						print "Failed to create directory $dirname\n";
						clean_house(1);
					}
				}
				@fields = split "/", $prev_dirname;
				$last_field = $fields[(scalar(@fields) - 1)];
				$movie_filename = join '' , $last_field , ".mpeg";
				logit(3,
					$::config{webcam_log_file},
					"Creating new movie file from the contents of directory $prev_dirname it's filename will be $movie_filename. It will be placed in $movie_dirname");
				system("$::config{movie_maker_script} -s $prev_dirname -p $movie_dirname -c $movie_filename &");
			}
		}
	}
	
	# trigger capture here
	$tt = gettimeofday-$last_trigger_time;
	logit(6,
		$::config{webcam_log_file},
		"Elapsed time just before capture is called $tt");
	if ($::Grab_Use_Internal != 1)
	{
		system("/usr/bin/v4lctl -c $::config{video_dev} snap jpeg 844x576  $tmpfile");
		$good_frame = 1;
	}
	else
	{
		$good_frame = grab_one($tmpfile,$grab);
	}
	$tt = gettimeofday-$last_trigger_time;
	logit(6,
		$::config{webcam_log_file},
		"Elapsed time just after capture is called $tt");

	if( $good_frame == 1)
	{
		# Create string to label image with
		$timestamp = scalar(localtime(time));
		$tmp = join '' , $dirname, $filename;
		$tmp2 = join '' , ' ' ,$::config{camera_ID} , ' - ' , $timestamp;
		addtime($tmp,
			$tmp2,
			$tmpfile,
			$::config{im_lbl_color},
			$::config{label_font_size});
	}
	unlink($tmpfile);
	$tt = gettimeofday-$last_trigger_time;
	logit(6,
		$::config{webcam_log_file},
		"Elapsed time just after timestamping $tt");

	$grab_time = gettimeofday-$last_trigger_time;
	$sleep_time = $::config{interval_time} - $grab_time;
	$grab_time = sprintf "%0.9f" , $grab_time;
	$sleep_time = sprintf "%0.9f" , $sleep_time;
	if ($sleep_time < (0.5 * $::config{interval_time})) # < 50%
	{
		print BOLD RED ON_WHITE "Grab time = $grab_time Sleep time = $sleep_time";
	}
	else
	{
		if ($sleep_time < (0.7 * $::config{interval_time})) # > 50% < 70%
		{
			print BOLD RED ON_BLACK "Grab time = $grab_time Sleep time = $sleep_time";
		}
		else # > 70%
		{
			print BOLD BLUE ON_BLACK "Grab time = $grab_time Sleep time = $sleep_time";
		}
		
	}
	print "\n";
	logit(3,
		$::config{webcam_log_file},
		"Total time to capture and procees this image $grab_time seconds");
	logit(4,
		$::config{webcam_log_file},
		"Need to sleep for $sleep_time seconds");
	if($sleep_time < 1)
	{
		logit(1,
			$::config{webcam_log_file},
			"You're pushing it buster, I almost didn't get back to grab a frame");
	}
	if($sleep_time <= 0)
	{
		logit(1,
			$::config{webcam_log_file},
			"Frame missed due to system load!");
	}

	# The standard high resolution timer, sleeps for the value in the last
	# argument in seconds.
	select undef, undef, undef, $sleep_time;
$ndcount = Devel::Leak::CheckSV($handle);
if($dcount != $ndcount)
{
	$incd = $ndcount - $dcount;
	print "------> $incd more objects found\n";
}
$dcount = Devel::Leak::NoteSV($handle);
}

logit(3,
	$::config{webcam_log_file},
	"Normal exit");
clean_house(1);


No matter whether this is run with the "internal" graber, or the external
system(0 call to v4lctl it grows rapidly.

What am I doing wrong.
-- 
"They that would give up essential liberty for temporary safety deserve
neither liberty nor safety."
						-- Benjamin Franklin


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

Date: Sat, 15 Nov 2003 08:11:32 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: my command (sorry newbe question)
Message-Id: <bp4n3k$43q$2@wisteria.csv.warwick.ac.uk>


Brad Baxter <bmb@ginger.libs.uga.edu> wrote:
> On Wed, 12 Nov 2003, Chris Mattern wrote:
> 
> > Chris Lynch wrote:
> > > You don't always need the "my" when you declare a variable.
> >
> > If you program with strict (and you should *always* program with
> > strict), then you will need *something*--my, our, global, whatever...
> 
> my, our, local, PACKAGE::, what else?

use vars

*var = \$var;

These are equivalent, and both have been obsoleted by our().

Ben

-- 
  The cosmos, at best, is like a rubbish heap scattered at random.
                                                         - Heraclitus
  ben@morrow.me.uk


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

Date: Sat, 15 Nov 2003 08:31:22 -0500
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: my command (sorry newbe question)
Message-Id: <Pine.A41.4.58.0311150816500.10448@ginger.libs.uga.edu>

On Sat, 15 Nov 2003, Ben Morrow wrote:
> Brad Baxter <bmb@ginger.libs.uga.edu> wrote:
> > On Wed, 12 Nov 2003, Chris Mattern wrote:
> > > Chris Lynch wrote:
> > > > You don't always need the "my" when you declare a variable.
> > >
> > > If you program with strict (and you should *always* program with
> > > strict), then you will need *something*--my, our, global, whatever...
> >
> > my, our, local, PACKAGE::, what else?
>
> use vars
>
> *var = \$var;
>
> These are equivalent, and both have been obsoleted by our().

Yes, I should have included use vars with our.  But I don't follow the
second example, so I'm sure I'm missing something that I ought to know.

In the first case below, I took your example literally, though I feel you
didn't mean it that way.  In the second case, I changed it to what I
thought you meant.  But I don't catch how this would be used to avoid the
other ways to declare ...

bmb >> cat -n ./qt
     1  #!/usr/local/bin/perl
     2  use strict;
     3  use warnings;
     4
     5  *var = \$var;

bmb >> ./qt
Variable "$var" is not imported at ./qt line 5.
Global symbol "$var" requires explicit package name at ./qt line 5.
Execution of ./qt aborted due to compilation errors.


bmb >> cat -n ./qt
     1  #!/usr/local/bin/perl
     2  use strict;
     3  use warnings;
     4  my $var1 = 1;
     5  *var2 = \$var1;
     6  print $var2;

bmb >> ./qt
Variable "$var2" is not imported at ./qt line 6.
Global symbol "$var2" requires explicit package name at ./qt line 6.
Execution of ./qt aborted due to compilation errors.

Puzzled,

Brad


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

Date: Sat, 15 Nov 2003 04:56:21 GMT
From: wherrera@lynxview.com (William Herrera)
Subject: Re: Programming Pointer
Message-Id: <3fb5b196.353702325@news2.news.adelphia.net>

On Fri, 14 Nov 2003 21:34:18 -0500, "Gary" <reachus@netlink.info> wrote:

>I have a simple cgi in perl that basically dumpls a file to the screen from
>an SQL database and every field can be chaged. Once I have written the rows
>to the screen, and the user has changed potentially several rows, what is
>the easiest way to update the database with the new entries ?
>
>Basically existing Perl program looks like this.
>
># make connection to database
>$dbh = DBI->connect($connectionInfo,$userid,$passwd);
>
># prepare and execute query
>$query = "SELECT * FROM WGTextDescription";
>
>

The problem is not Perl DBI, you have that down, more or less. It's that you
want a nice GUI interface for updates? And don't feel like drawing one up
yourself?

Look at some of the existing interfaces, eg
http://www.cgiscriptshop.com/products/mdm/index.html

and maybe use some of those ideas.


---
Use the domain skylightview (dot) com for the reply address instead.


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

Date: Sat, 15 Nov 2003 08:19:39 -0500
From: "Gary" <reachus@netlink.info>
Subject: Re: Programming Pointer
Message-Id: <PJptb.8574$HD3.953@lakeread06>

Are you saying that the crude way I have described here is the way.

i.e There is no changed record status maintained or clever little technique
for doing this update. You have to actually code it (Updates)manually in
full every time.

Assuming you do not buy the tools where it is already written for your use.

regards
Gary
"William Herrera" <wherrera@lynxview.com> wrote in message
news:3fb5b274.353924451@news2.news.adelphia.net...
> On Fri, 14 Nov 2003 21:34:18 -0500, "Gary" <reachus@netlink.info> wrote:
>
> >I have a simple cgi in perl that basically dumpls a file to the screen
from
> >an SQL database and every field can be chaged. Once I have written the
rows
> >to the screen, and the user has changed potentially several rows, what is
> >the easiest way to update the database with the new entries ?
> >
> >Basically existing Perl program looks like this.
> >
> ># make connection to database
> >$dbh = DBI->connect($connectionInfo,$userid,$passwd);
> >
> ># prepare and execute query
> >$query = "SELECT * FROM WGTextDescription";
> >
> >
>
> The problem is not Perl DBI, you have that down, more or less. It's that
you
> want a nice GUI interface for updates? And don't feel like drawing one up
> yourself?
>
> Look at some of the existing interfaces, eg
> http://www.cgiscriptshop.com/products/mdm/index.html
>
> and maybe use some of those ideas.
>
>
> ---
> Use the domain skylightview (dot) com for the reply address instead.




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

Date: 15 Nov 2003 05:38:41 -0800
From: bl8n8r@yahoo.com (bad_knee)
Subject: Re: regex to convert 1000000 -> 1,000,000 ?
Message-Id: <e817ca4d.0311150538.7a3e30df@posting.google.com>

bl8n8r@yahoo.com (bad_knee) wrote in message news:<e817ca4d.0311141105.1cc58788@posting.google.com>...
> Hello,
> I was wondering if anyone had a quick one for "commatizing" a
> number in perl? 
> 
> Thanks

Sheesh.. thought this would be an easy one for you guys.
Oh well, for anyone interested...

$number = "10001324512461346234500";
$sep = ",";
$number =~ s/(^[-+]?\d+?(?=(?>(?:\d{3})+)(?!\d))|\G\d{3}(?=\d))/$1$sep/g;
print "num:$number\n";

cheers!


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

Date: Sat, 15 Nov 2003 08:29:09 GMT
From: "Dave Oswald" <davido@pacifier.com>
Subject: Re: strange hash syntax
Message-Id: <ptltb.771$i24.640833@news3.news.adelphia.net>


"Torch" <rvw_torch@hotmail.com> wrote

> I encountered a hash syntax I have never seen before, can somebody
> help me understanding it.
>
> $somehash{$somekey} = [ @somearray];
>
> When I do print"$somehash{$somekey}" I get some strange number
> ARRAY(0x20038114)as an output.
> What does this mean????
> I can;t find anything in my book and I do not nkow how to start
> looking for it on the net...

You're looking at the creation of an anonymous array, whos referent will be
a hash element.

If your book doesn't discuss references and anonymous arrays, you'd better
get a different book, or read 'perlref' from the Perl POD.




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

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


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