transfer...stination(3tcl)
π NAME π
transfer::data::destination β the data destination, bestie π
So like, this is transfer::data::destination, a page from the <pink>3tcl</pink> manual, living under the big <purple>Data transfer facilities</purple> umbrella. Let's go β¨
πΈ SYNOPSIS πΈ
package require Tcl 8.5 9
package require snit ?1.0?
package require transfer::data::destination ?0.3?
transfer::data::destination objectName ?options...?
objectName method ?arg arg ...?
objectName destroy
objectName put chunk
objectName done
objectName valid msgvar
objectName receive channel done
π¦ DESCRIPTION π¦
Okay so this package hands you objects that are, like, mainly about describing where data is going β the destination of a data transfer, periodt. π«
But wait, there's more (there's always more): these objects can also kick off the reception of information coming from a channel, dropping it right into the destination they describe. Slay. π
β API β
β¨ transfer::data::destination objectName ?options...? β¨
This command creates a brand new data destination object, and that object comes with its very own Tcl command whose name is objectName. The whole personality of that object command is explained in full detail in the sections Object command and Object methods β go read those, fr fr. And the set of supported options? That's all in the Options section. π
Where does the object command live? If objectName is not fully qualified, it gets created under the current namespace. If it is fully qualified, it goes in the namespace you specified. Either way, the command hands you back the fully qualified name of the object command as its result. π
π«Ά OBJECT COMMAND π«Ά
Every single object created by the ::transfer::data::destination command has this general form:
objectName method ?arg arg ...?
The method method plus its arg'uments decide the exact behaviour of the command. Detailed specs? Section Object methods, obviously. π
π OBJECT METHODS π
objectName destroy
This method destroys the object. Now listen β if you do this while the object is busy receiving information from a channel, you're gonna get errors later on, when the reception finishes and tries to reach for the data structures of the object you already yeeted into the void. So like, don't do that. π
objectName put chunk
The main receptor method. It saves the received chunk of data into whatever destination you configured. You have to call this for each piece of data received. No skipping. π
objectName done
The secondary receptor method. It finalizes the receiver. You have to call it when the receiving channel signals EOF. After that? Neither this method nor put can be called anymore. Closed for business, bestie. πͺ
objectName valid msgvar
This method checks the configuration of the object for validity. It returns a boolean flag: True if the object is valid, False otherwise. And in that second case, the variable whose name is stored in msgvar gets set to an error message describing the problem it found with the configuration. If everything's fine, that variable doesn't get touched at all. π€·ββοΈ
objectName receive channel done
This method initiates the reception of data from the specified channel. The data it receives gets stored into the configured destination, via calls to the methods put and done. When the reception completes, the command prefix done is invoked, with the number of received characters appended to it as the sole additional argument. π«
π₯ OPTIONS π₯
Every data destination supports the options below. Real talk though: they're all semi-exclusive β each one specifies a different type of destination plus its associated info. So if you specify these options more than once, it's the last one you specified that actually configures the object. Last one wins, iykyk. π
-channel handleβ says the destination of the data is a channel, and its argument is the handle of the channel to write the received data to. π‘-file pathβ says the destination of the data is a file, and its argument is the path of the file to write the received data to. π-variable varnameβ says the destination of the data is a variable, and its argument contains the name of the variable to write the received data to. The variable is assumed to be global or namespaced, anchored at the global namespace. π-progress commandβ if you specify this one, it defines a command to be invoked for each chunk of bytes received, letting you monitor the progress of the data reception. The callback is always invoked with one additional argument: the number of bytes received so far. π
π BUGS, IDEAS, FEEDBACK π
This document, and the package it describes, will undoubtedly contain bugs and other problems. I know, I know, tragic. π Please report such in the category transfer of the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist](http://core.tcl.tk/tcllib/reportlist). Also please report any ideas for enhancements you may have for either the package and/or the documentation. We love ideas. π«Ά
When proposing code changes, please provide unified diffs, i.e the output of diff -u. No cap.
Note further that attachments are strongly preferred over inlined patches. Attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar. That's the vibe. β¨
π KEYWORDS π
channel, copy, data destination, transfer
π CATEGORY π
Transfer module
π COPYRIGHT π
Copyright (c) 2006-2009 Andreas Kupries <andreas_kupries@users.sourceforge.net>
okay that's the whole page, you ate it, no crumbs π This was transfer::data::destination out of the <purple>tcllib</purple> docs, version <hotpink>0.3</hotpink>, sitting pretty in section <cyan>3tcl</cyan> β mwah, bye bestie πβ¨π
π¦ where this page comes from
- debian trixie: tcllib 2.0+dfsg-4 Β· Tcl
- ubuntu questing: tcllib 2.0+dfsg-4
- ubuntu resolute: tcllib 2.0+dfsg-5 Β· Tcl
- ubuntu stonking: tcllib 2.0+dfsg-6 Β· Tcl
- Copyright (c) 2006-2009 Andreas Kupries <andreas_kupries@users\&.sourceforge\&.net>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms