Problem with interaction of open3, sysread and DBI (pg)

2020-03-22 Thread Mike Martin via beginners
I have a strange issue with sysread and postgres (and ffpeg/stderr) If the main program throws an error sysread stops if I write to the database (a log table) this is the program (need open3 because ffmpeg writes to stderr not stdout) use IPC::Open3; my($file,$in, $out); my $pid; use Symbol

Question re remove_tree and symlinks

2019-08-23 Thread Mike Martin
Am I right in believing that remove_tree from File::Path does not follow symlinks, ie: does not remove the linked file only the link if there are links in the direstories removed eg: #!/usr/bin/perl use strict; use File::Path('make_path','remove_tree'); my $dir='testdellink';# contains links to

Open and perl sub

2019-08-08 Thread Mike Martin via beginners
Is it possible to have the output of a perl module piped to open (open3 in my case), so I can use a file handle contains the output passed to sysread Odd question I know Thanks

How to test for existence of file with non-ascii characters

2018-12-26 Thread Mike Martin
Any ideas how to test for the existance of a file, when the file name contains extended ascii characters For example if the file contains emdash (U-2014) file -e always returns false thanks Mike

Re: Regex for date format

2018-06-29 Thread Mike Martin
Worked perfectly thanks, uri, and same technique works perfectly in postgresql regexp_replace for info On 29 June 2018 at 16:18, Mike Martin wrote: > Thanks > > > On Fri, 29 Jun 2018, 15:48 Uri Guttman, wrote: > >> On 06/29/2018 10:41 AM, Mike Martin wrote: >

Re: Regex for date format

2018-06-29 Thread Mike Martin
Thanks On Fri, 29 Jun 2018, 15:48 Uri Guttman, wrote: > On 06/29/2018 10:41 AM, Mike Martin wrote: > > sorry > -mm-dd hh:mm:ss.dd > eg: > 2018-01-01 12-45-10-456789 to > 2018-01-01 12:45:10.456789 > > > > please reply to the list and not to me! >

Regex for date format

2018-06-29 Thread Mike Martin
Hi I am trying to convert a string of the format 2018-01-01 16-45-21-654278 to a proper timestamp string so basically I want to replace all - after the date part I am getting a bit stuck, lookbehind doesnt seem to work as it includes the lookbehind on every occurence last attempt is s/(?<=

Unzipping pkzip archives

2018-05-22 Thread Mike Martin
Hi Does anyone know if there is a perl solution to uncompressing zip archives created with pkzip? I have tried Archive::Uncompress and IO::Archive and both fail with compression type 9 errors, apparently due to proprietary format thanks Mike

Find::Perl find not returning

2017-12-13 Thread Mike Martin
Hi I have the following code use strict; use File::Find; my @vsbe; my $top='P:\PT-6\PT-60\PT-603\Shared\Data Store\Files Dump Folder'; my $max_depth=9; my $cnt1=0; find({wanted=>\,preprocess=>\},$top) ; sub wanted1 { if ($cnt1 <=1000){ my $file = $File::Find::name; if (grep {/vsb$/} $file){

Re: IPC::Open3 and output

2017-07-10 Thread Mike Martin
2>&1") while $pid=open3(undef,undef,$file,$cmdprog, @args) does not until you iterate over the FH thanks On 10 July 2017 at 07:13, Chas. Owens <chas.ow...@gmail.com> wrote: > On Sun, Jul 9, 2017, 19:37 Mike Martin <redt...@gmail.com> wrote: > >> Hi >

IPC::Open3 and output

2017-07-09 Thread Mike Martin
Hi I am trying to use Open3 to capture stderr and avoiding the shell ie: my $str="-v 35 -i /data/Downloads/testinput.mp4 -c:v libx264 -preset fast -crf 28 -g 25 -c:a libmp3lame -b:a 128000 -threads 4 -af volume=2.5 -vf scale='352:trunc(ow/((1/sar)*dar)/2)*2',fps='fps= 20',setsar='1/1'

Warnings when sorting by hashref

2017-04-11 Thread Mike Martin
Hi I have the following code as an example against a hash of hashes, to sort by hashrf key foreach my $opt (sort {uc($options{$b}->{type}) cmp uc($options{$a}->{type})} keys %options){ my $type=$options{$opt}->{vtype}; $video_type->append_text($type) if defined($type)

Email Sender timeout with more than two paragraphs of text in body

2016-10-03 Thread Mike Martin
Hi I have the below script (extracted pertinent bits). The connection to the mail server times out if there is more than about 10 lines of text (sometimes less) There is no issue with how many attachments I can send, so getting a bit stumped Example below with specimen text (anonymised) The

problem with regex qr operator

2015-06-25 Thread Mike Martin
Hi I am currently getting issues with regexes that use the qr operator. The results with qr are different than without. This is a small sample program to illustrate it use strict; my $str='Database Administrator'; my $pattern=

Re: Looping regexes against a list

2015-01-20 Thread Mike Martin
Thanks for the idea about qr, I did try this before, but I've now relooked at at it and got about 75% improvement. As regards the uninitialized point the errors were coming from regexes (different ones) when the regex wasnt matching, so testing the result of each regex match was not really an

Looping regexes against a list

2015-01-19 Thread Mike Martin
Hi I am looking for the most performant way to achieve this I have a big list of text (47+ lines in a hash) I then run a hash ref consisting of replacement text - pattern to search - optional 3rd param for grouping matches So I loop through the text and then loop the regex hash against each

Re: Looping regexes against a list

2015-01-19 Thread Mike Martin
}-{replace} ; } } (jtitles is created from a bigger listing of unformatted text) On 19 January 2015 at 13:53, Brandon McCaig bamcc...@gmail.com wrote: Mike: On Mon, Jan 19, 2015 at 01:25:56PM +, Mike Martin wrote: Hi Hello, I am looking for the most performant way to achieve this I

Win32 and -d check erratic

2014-02-19 Thread Mike Martin
I've come across an odd issue with -d on a windows box I have a script which recurses through a directory structure down two levels eg: ─Customers Reports └───Customers Reports ─Internal Reports └───Report Project1 For the first one (Customer Reports) where the sub-directory has the same name

Issues with selectall_arrayref and perl 5.14

2012-06-01 Thread Mike Martin
Hi is anyone aware of any issues with DBD/DBI and perl 5.14.2? I have the following code (from memory) my $freqs=$dbh-selectall_hashref(select frequency,tsid,bandwidth from freqs,frequency); Which in 5.14.1 gave me a hash of hashes , however in 5.14.2 and associated updates with fedora 17

Re: Issues with selectall_arrayref and perl 5.14

2012-06-01 Thread Mike Martin
Hi is anyone aware of any issues with DBD/DBI and perl 5.14.2? I have the following code (from memory) my $freqs=$dbh-selectall_hashref(select frequency,tsid,bandwidth from freqs,frequency); Which in 5.14.1 gave me a hash of hashes , however in 5.14.2 and associated updates with fedora 17

Echo perl one-liner intact

2010-12-15 Thread Mike Martin
Hi I am trying pass a perl one-liner to at intact eg: echo 'perl -mLinux::DVB::DVBT -e 'my $dvb=Linux::DVB::DVBT-new(O_NONBLOCK,'O_RDONLY');$dvb-set_frontend('frequency' = '497167000','tsid' = '4222');my $file=/storage/burn/testol;my

Re: Echo perl one-liner intact

2010-12-15 Thread Mike Martin
On 15 December 2010 16:21, Jim Gibson jimsgib...@gmail.com wrote: On 12/15/10 Wed  Dec 15, 2010  8:05 AM, Mike Martin redt...@gmail.com scribbled: Hi I am trying pass a perl one-liner to at intact eg: echo 'perl -mLinux::DVB::DVBT -e 'my $dvb=Linux::DVB::DVBT-new(O_NONBLOCK,'O_RDONLY

Re: Accessing file system from CGI

2010-11-20 Thread Mike Martin
On 19 November 2010 09:13, Shlomi Fish shlo...@iglu.org.il wrote: On Thursday 18 November 2010 16:32:08 Mike Martin wrote: Has anyone got any approaches that enable cgi scripts to access the host filesystem (readonly) There shouldn't be any problem for a CGI script to access the filesystem

Accessing file system from CGI

2010-11-19 Thread Mike Martin
Has anyone got any approaches that enable cgi scripts to access the host filesystem (readonly) I am working on a doc viewer app (intended for release as part of a suite), but I am hitting the permission denied issue. This applies to ls, opendir and find. any ideas appreciated -- To

Re: Question about match behaviour

2010-08-05 Thread Mike Martin
- Show quoted text - On 5 August 2010 04:58, Chas. Owens chas.ow...@gmail.com wrote: On Wed, Aug 4, 2010 at 11:36, Mike Martin redt...@gmail.com wrote: snip This fails but if I replace $type_g=$options{$key}-[4] if $chk=~/$type/ with either $type_g=$options{$key}-[4] if $type=~/$chk

Re: Question about match behaviour

2010-08-05 Thread Mike Martin
On 5 August 2010 03:39, John W. Krahn jwkr...@shaw.ca wrote: Mike Martin wrote: Hi Hello, I have the following code my $type='val'; my $type_g; foreach my $key (keys %options){ my $chk=$options{$key}-[3]; $type_g=$options{$key}-[4] if $chk=~/$type/; #$type_g=$options{$key}-[4

Question about match behaviour

2010-08-04 Thread Mike Martin
Hi I have the following code my $type='val'; my $type_g; foreach my $key (keys %options){ my $chk=$options{$key}-[3]; $type_g=$options{$key}-[4] if $chk=~/$type/; #$type_g=$options{$key}-[4] if $type=~/$chk/; } print \n,$type,\t,$type_g,\n; This fails but if I replace $type_g=$options{$key}-[4]

Get variable name from a list

2010-07-24 Thread Mike Martin
Is this possible? I am trying to populate a hash with keys as variable name and value as variable value eg: my %hash; foreach my $w ($filename,$file_start,$file_time,$video_track,$audio_track,$quality,$sync){ my $hash{$key}= $w; } -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For

Problem with Gd module and animated Gifs

2010-07-04 Thread Mike Martin
Hi I am looking at creating animated gifs using this in the man page as a starting point my $gifdata = $image-gifanimbegin; $gifdata .= $image-gifanimadd;# first frame for (1..100) { # make a frame of right size my $frame =

How to get a computed string to act as a re in if statement

2008-07-30 Thread Mike Martin
Hi I am working on the sub below. The aim is to create a string from values passed to the sub-routine and then use that as a if criterion for the push operation. Is this possible? sub get_list { my ($black_list,$table,$crit)[EMAIL PROTECTED]; ### $crit is a hash reference containing key to

CGI problem fith file URIs

2008-03-10 Thread Mike Martin
I am developing a help viewer app with CGI pm. However I have hit a roadblocjk with the last part of the program This searches the /usr/share/doc heirarchy for html files and presents a dropdown list. However when I try to access the file ie: with file://usr/share/doc/somefile.html I cannot I

Ideas for matching several lines of code (C)

2008-01-16 Thread Mike Martin
Hi I am trying to extract about 10 lines of C code from a file. this is is basically what I am doing I am changing every enstance of a special character to \special character (to avoid errors) then tryng to match this ie: print something if $source=~/$diff/sg which gives no output - any tips

Problem with scope in CGI script

2007-11-04 Thread Mike Martin
Hi I have the following script #!/usr/bin/perl -w use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser warningsToBrowser); use strict; use File::Basename; our $list; sub run_cmd {return print span({-class='place_cmd'},submit(-name='action', -value=shift)),p}; my %opts=(entry=\entry,

Problem with repeating characters in regex

2007-09-27 Thread Mike Martin
Hi I am trying to capture only the first occurence of a charcter followed by any word ie: in this sample text !this is a first level heading !!this is a 2nd level heading I only want to find the first item and not the second current code $line=~s/\!(^\![A-Z][a-z].+)/$1/gc; it either doesnt

Probably silly question about loop

2007-09-05 Thread Mike Martin
I am having a problem with looping a string. This is my code my $string=ffmpeg -v 2 -i \/home/mike/vcr58uc.avi\ -itsoffset -0.1 -i \/home/mike/vcr58uc.avi\ -target dvd -y -s 352x288 -qscale 5 -bf 2 -g 15 -acodec mp2 -ac 2 -ab 64kk -me_range 63 -aspect 4:3 -map 1:0 -map 0:1

Re: Probably silly question about loop

2007-09-05 Thread Mike Martin
On 05/09/07, Tom Phoenix [EMAIL PROTECTED] wrote: On 9/5/07, Mike Martin [EMAIL PROTECTED] wrote: I am having a problem with looping a string. Have you tried stepping through your code in the debugger? while ($count lt $str_length){ That looks like a place where you used a string

GD and png question

2007-02-26 Thread Mike Martin
Does anyone know if it is possible to create an indexed png file with = 4 colors using GD Currently googling,but not found anything thus far -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

OS independent Hardware listing

2007-01-22 Thread Mike Martin
Is it possible to get a OS independendent listing of Hardware installed? In particular I want to get a list of following devices CD/DVD drives Video devices At the moment I am using Linux specific devices, but I would like the capability to use hardware description as used by native OS Thanks

Re: Designing forms/tables in CGI

2006-08-21 Thread Mike Martin
On 18/08/06, Mumia W. [EMAIL PROTECTED] wrote: On 08/18/2006 08:23 AM, Nath, Alok (STSD) wrote: Hi Guys, My question is can I create more that one form in the same page. Yes If yes , do I need to create separate cgi object for each form or one object for one page is

Converting Perl Script to Module

2006-08-09 Thread Mike Martin
Does anyone know of any resources to aid in this? I have a few scripts which I am trying to turn into modules, however the functions which run as a script (CGI) do not run as modules Any help etc -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Dynamically choosing CGI file based on form output

2006-07-27 Thread Mike Martin
I have the following code which should 1. Give user a choice of actions 2. Based on these go to the specified script I have the following issues 1. The Submit button needs clicking twice after selection 2. Only one value can be chosen, to choose another the form must be reloaded from scratch

Re: MOVE ON ALREADY!!!

2006-07-14 Thread Mike Martin
On 14/07/06, Mathew Snyder [EMAIL PROTECTED] wrote: Mike Martin wrote: On 13/07/06, OROSZI Balázs [EMAIL PROTECTED] wrote: Hi guys! I'm a total Perl beginner, and I delete most mails, as either I cannot answer or I'm not interested. I'm reading through this thread from the Trash folder

Re: MOVE ON ALREADY!!!

2006-07-13 Thread Mike Martin
On 13/07/06, OROSZI Balázs [EMAIL PROTECTED] wrote: Hi guys! I'm a total Perl beginner, and I delete most mails, as either I cannot answer or I'm not interested. I'm reading through this thread from the Trash folder, and this is what I gathered: Mr. Shawn H. Corey - calm guy, good Perl skills

CGI question on param

2006-07-07 Thread Mike Martin
Does anyone know if there is any way to split the param list returned by CGI.pm by record ie: I have an input form which is populated from a DB query which can have unlimited numbers of records. When the parameters come in the individual params are split, but not the lines for each form. Is

Removing print statements from cgi script

2006-06-30 Thread Mike Martin
Does anyone know if its possible to remove data printed from a web-page created from cgi.pm depnding on the effect of a sub-routine. ie: I print the header and a selection form which then runs a sub - is it posible to replace the contents without loading a new web-page Thanks -- To

ffmpeg and perl-gtk2

2006-05-08 Thread Mike Martin
I am not sure whether anyone can help here. I am building a gui for amongst other things ffmpeg and I seem to have hit an issue with ffmpeg. What I am trying to do is to run a ffmpeg command and then pass that to a TextView in the main window. ie: $fh- ffmpeg -i somefile opts outfile which

Question about File Uploads

2006-04-17 Thread Mike Martin
Hi I have a CGI script that uses filefields to get filenames before passing to the shell and I want to disable the creation of a tempfile. After googling for a while I cant find out where to turn this behaviour off. I have found references to $use_tempfiles variable, but am having difficulties

Setting Content-Length Header In CGI.pm

2006-04-17 Thread Mike Martin
Does anyone know if this is possible? I have a pair of scripts which take in up to 6 filefields, munge them so path info remains and get sent to shell commands. However after a certain amount of data I get a Invalid Content-Length error and it bombs out. Googled to no avail. As ever any help

Problem getting a value from a sub-routine

2006-03-14 Thread Mike Martin
Hi I have the following script (copied fairlay verbatim from gtk2-perl tutorial) and I cant seem to get the value out of the show_chooser sub-routine. It prints to the shell but doesnt seem to want to go any where else. I must be missing something simple. Any help appreciated #!/usr/bin/perl use

Re: Problem with with ParseExcel and file input

2006-02-17 Thread Mike Martin
On 2/16/06, Xavier Noria [EMAIL PROTECTED] wrote: On Feb 16, 2006, at 18:35, Mike Martin wrote: I have problems with reading in a file variable in Spreadsheet::Parsexcel. This is the relevant code. use strict; use warnings; open (INPUT,tele1); my @input1=INPUT; If those